1 #ifndef __PGS_VECTOR3D_H__
2 #define __PGS_VECTOR3D_H__
3 
4 #include "pg_sphere.h"
5 
6 /* Vector declarations */
7 
8 /*
9  * The definition of a three dimensional vector data structure.
10  */
11 typedef struct
12 {
13 	float8	x;	/* x (-1.0 .. 1.0) */
14 	float8	y;	/* y (-1.0 .. 1.0) */
15 	float8	z;	/* z (-1.0 .. 1.0) */
16 } Vector3D;
17 
18 
19 /*
20  * Calculate the cross product of two vectors. Puts
21  * cross product of v1 and v2 into out and returns it.
22  */
23 void	vector3d_cross(Vector3D *out, const Vector3D *v1, const Vector3D *v2);
24 
25 /*
26  * Checks equality of two vectors.
27  */
28 bool	vector3d_eq(const Vector3D *a, const Vector3D *b);
29 
30 /*
31  * Calculate the scalar product of two vectors.
32  */
33 float8	vector3d_scalar(Vector3D *v1, Vector3D *v2);
34 
35 /*
36  * Calculate the length of a vector.
37  */
38 float8	vector3d_length(const Vector3D *v);
39 
40 #endif
41