File: vector3d.h

package info (click to toggle)
pgsphere 1.1.1%2B2018.10.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,188 kB
  • sloc: ansic: 9,874; sql: 2,872; perl: 168; yacc: 145; makefile: 132; xml: 65; lex: 55; sh: 1
file content (40 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (3)
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
#ifndef __PGS_VECTOR3D_H__
#define __PGS_VECTOR3D_H__

#include "pg_sphere.h"

/* Vector declarations */

/*
 * The definition of a three dimensional vector data structure.
 */
typedef struct
{
	float8	x;	/* x (-1.0 .. 1.0) */
	float8	y;	/* y (-1.0 .. 1.0) */
	float8	z;	/* z (-1.0 .. 1.0) */
} Vector3D;


/*
 * Calculate the cross product of two vectors. Puts
 * cross product of v1 and v2 into out and returns it.
 */
void	vector3d_cross(Vector3D *out, const Vector3D *v1, const Vector3D *v2);

/*
 * Checks equality of two vectors.
 */
bool	vector3d_eq(const Vector3D *a, const Vector3D *b);

/*
 * Calculate the scalar product of two vectors.
 */
float8	vector3d_scalar(Vector3D *v1, Vector3D *v2);

/*
 * Calculate the length of a vector.
 */
float8	vector3d_length(const Vector3D *v);

#endif