vect.h
2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Copyright 1991, 1992, 1993, 1994, 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
#ifndef VECTDEF
#define VECTDEF
#include "gu.h"
typedef struct vect {
float x, y, z, w;
} vect;
typedef struct dvect {
double x, y, z, w;
} dvect;
void vcopy(vect *v1, vect *v2);
void vprint( vect *v );
void dvprint(dvect *v);
void vprint4(vect *v);
void vset(vect *v, float x, float y, float z);
void vzero(vect *v);
void vone(vect *v);
void vset4(vect *v, float x, float y, float z, float w);
void vnormal(void *v);
float vlength(vect *v);
void vscale(vect *v, float mul);
void vmult(vect *src1, vect *src2, vect *dst);
void vadd(vect *src1, vect *src2, vect *dst);
void vsub(vect *src1, vect *src2, vect *dst);
void vhalf(vect *v1, vect *v2, vect *half);
float vdot(vect *v1, vect *v2);
double dvdot(dvect *v1, dvect *v2);
void vcross(vect *v1, vect *v2, vect *cross);
void vplane(vect *normal, vect *point, vect *plane);
void dvplane( dvect *normal, dvect *point, dvect *plane);
void vdirection(vect *v1, vect *dir);
void makeplane(vect *p1, vect *p2, vect *p3, vect *v);
void vreflect(vect *in, vect *mirror, vect *out);
void vmatrixcopy(float m1[4][4], float m2[4][4]);
void vmultmatrix(float m1[4][4], float m2[4][4], float prod[4][4]);
void vtransform(vect *v, float mat[4][4], vect *vt);
void vlerp(vect *v0, vect *v1, vect *v, float p);
void dvlerp(dvect *v0, dvect *v1, dvect *v, float p);
float flerp(float f0, float f1, float p);
double dlerp(double f0, double f1, double p);
int lerp(int i0, int i1, float p);
void vclamp(vect *v);
int trinormal(vect *p00, vect *p01, vect *p10, vect *n, float tol );
int dtrinormal( dvect *p00, dvect *p01, dvect *p10, dvect *n, double tol );
void myidentity( float mat[4][4] );
#endif /* VECTDEF */