vvector.h File Reference

Efficient basic 3D vector arithmetic functionality. More...

#include "vvector.c"

Include dependency graph for vvector.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef float f3 [3]
 Array of three floats.
typedef double d3 [3]
 Array of three doubles.

Functions

void VScalarMultiplyf (f3 dest, float scalar, const f3 v)
 Multiply each element in v by scalar and put result in dest.
void VPlusf (f3 dest, const f3 v1, const f3 v2)
 dest[i] = v1[i] + v2[i], i=1,2,3
void VMinusf (f3 dest, const f3 v1, const f3 v2)
 dest[i] = v1[i] - v2[i], i=1,2,3
void VCopyf (f3 dest, const f3 src)
 Copy src to dest (dest[i] = src[i], i=1,2,3).
float VDotf (const f3 v1, const f3 v2)
 Compute dot product of v1 and v2.
void VCrossf (f3 dest, const f3 v1, const f3 v2)
 Compute cross product of v1 and v2 (v1 x v2) and put the resulting vector in dest.
void VProjf (f3 dest, const f3 of, const f3 to)
 Compute the projection of 'of' onto 'to' (proj_to(of)) and put the result in dest.
void VPerpf (f3 dest, const f3 of, const f3 to)
 Compute the perpendicular part of 'of' onto 'to' (perp_to(of)) and put the result in dest.
void VRotZf (f3 dest, const f3 v, float angle)
 Rotate v angle rad around Z axis and put result in dest.
void VRotXf (f3 dest, const f3 v, float angle)
 Rotate v angle rad around X axis and put result in dest.
void VRotYf (f3 dest, const f3 v, float angle)
 Rotate v angle rad around Y axis and put result in dest.
void VRotNf (f3 dest, const f3 v, const f3 n, float angle)
 Rotate v angle rad around the axis pointed out by n, which does not need to be normalized.
void VNormalizef (f3 v)
 Normalize v (v[i] = v[i]/|v|, i=1,2,3).
float VLengthf (const f3 v)
 Compute the length |v| of v.
void VScalarMultiplyd (d3 dest, double scalar, const d3 v)
 Multiply each element in v by scalar and put result in dest.
void VPlusd (d3 dest, const d3 v1, const d3 v2)
 dest[i] = v1[i] + v2[i], i=1,2,3
void VMinusd (d3 dest, const d3 v1, const d3 v2)
 dest[i] = v1[i] - v2[i], i=1,2,3
void VCopyd (d3 dest, const d3 src)
 Copy src to dest (dest[i] = src[i], i=1,2,3).
double VDotd (const d3 v1, const d3 v2)
 Compute dot product of v1 and v2.
void VCrossd (d3 dest, const d3 v1, const d3 v2)
 Compute cross product of v1 and v2 (v1 x v2) and put the resulting vector in dest.
void VProjd (d3 dest, const d3 of, const d3 to)
 Compute the projection of 'of' onto 'to' (proj_to(of)) and put the result in dest.
void VPerpd (d3 dest, const d3 of, const d3 to)
 Compute the perpendicular part of 'of' onto 'to' (perp_to(of)) and put the result in dest.
void VRotZd (d3 dest, const d3 v, double angle)
 Rotate v ange rad around Z axis and put result in dest.
void VRotXd (d3 dest, const d3 v, double angle)
 Rotate v angle rad around X axis and put result in dest.
void VRotYd (d3 dest, const d3 v, double angle)
 Rotate v angle rad around Y axis and put result in dest.
void VRotNd (d3 dest, const d3 v, const d3 n, double angle)
 Rotate v angle rad around the axis pointed out by n, which does not need to be normalized.
void VNormalized (d3 v)
 Normalize v (v[i] = v[i]/|v|, i=1,2,3).
double VLengthd (const d3 v)
 Compute the length |v| of v.


Detailed Description

Efficient basic 3D vector arithmetic functionality.

The functions provided operate on two different data types, f3 and d3 which are pointers to three floats or doubles respectivly. All function names are prefixed with a capital V and end in f for the single precission version (float) or d for the double precission version (double).

Author:
Daniel Aarno
Version:
0.1.0

Typedef Documentation

typedef double d3[3]

Array of three doubles.

typedef float f3[3]

Array of three floats.


Function Documentation

void VCopyd ( d3  dest,
const d3  src 
)

Copy src to dest (dest[i] = src[i], i=1,2,3).

void VCopyf ( f3  dest,
const f3  src 
)

Copy src to dest (dest[i] = src[i], i=1,2,3).

void VCrossd ( d3  dest,
const d3  v1,
const d3  v2 
)

Compute cross product of v1 and v2 (v1 x v2) and put the resulting vector in dest.

void VCrossf ( f3  dest,
const f3  v1,
const f3  v2 
)

Compute cross product of v1 and v2 (v1 x v2) and put the resulting vector in dest.

double VDotd ( const d3  v1,
const d3  v2 
)

Compute dot product of v1 and v2.

float VDotf ( const f3  v1,
const f3  v2 
)

Compute dot product of v1 and v2.

double VLengthd ( const d3  v  ) 

Compute the length |v| of v.

float VLengthf ( const f3  v  ) 

Compute the length |v| of v.

void VMinusd ( d3  dest,
const d3  v1,
const d3  v2 
)

dest[i] = v1[i] - v2[i], i=1,2,3

void VMinusf ( f3  dest,
const f3  v1,
const f3  v2 
)

dest[i] = v1[i] - v2[i], i=1,2,3

void VNormalized ( d3  v  ) 

Normalize v (v[i] = v[i]/|v|, i=1,2,3).

void VNormalizef ( f3  v  ) 

Normalize v (v[i] = v[i]/|v|, i=1,2,3).

void VPerpd ( d3  dest,
const d3  of,
const d3  to 
)

Compute the perpendicular part of 'of' onto 'to' (perp_to(of)) and put the result in dest.

'to' does not have to be of unit length

void VPerpf ( f3  dest,
const f3  of,
const f3  to 
)

Compute the perpendicular part of 'of' onto 'to' (perp_to(of)) and put the result in dest.

'to' does not have to be of unit length

void VPlusd ( d3  dest,
const d3  v1,
const d3  v2 
)

dest[i] = v1[i] + v2[i], i=1,2,3

void VPlusf ( f3  dest,
const f3  v1,
const f3  v2 
)

dest[i] = v1[i] + v2[i], i=1,2,3

void VProjd ( d3  dest,
const d3  of,
const d3  to 
)

Compute the projection of 'of' onto 'to' (proj_to(of)) and put the result in dest.

'to' does not have to be of unit length

void VProjf ( f3  dest,
const f3  of,
const f3  to 
)

Compute the projection of 'of' onto 'to' (proj_to(of)) and put the result in dest.

'to' does not have to be of unit length

void VRotNd ( d3  dest,
const d3  v,
const d3  n,
double  angle 
)

Rotate v angle rad around the axis pointed out by n, which does not need to be normalized.

void VRotNf ( f3  dest,
const f3  v,
const f3  n,
float  angle 
)

Rotate v angle rad around the axis pointed out by n, which does not need to be normalized.

void VRotXd ( d3  dest,
const d3  v,
double  angle 
)

Rotate v angle rad around X axis and put result in dest.

void VRotXf ( f3  dest,
const f3  v,
float  angle 
)

Rotate v angle rad around X axis and put result in dest.

void VRotYd ( d3  dest,
const d3  v,
double  angle 
)

Rotate v angle rad around Y axis and put result in dest.

void VRotYf ( f3  dest,
const f3  v,
float  angle 
)

Rotate v angle rad around Y axis and put result in dest.

void VRotZd ( d3  dest,
const d3  v,
double  angle 
)

Rotate v ange rad around Z axis and put result in dest.

void VRotZf ( f3  dest,
const f3  v,
float  angle 
)

Rotate v angle rad around Z axis and put result in dest.

void VScalarMultiplyd ( d3  dest,
double  scalar,
const d3  v 
)

Multiply each element in v by scalar and put result in dest.

void VScalarMultiplyf ( f3  dest,
float  scalar,
const f3  v 
)

Multiply each element in v by scalar and put result in dest.


Generated on Sun Mar 11 15:33:25 2007 for MetalWarriors by  doxygen 1.4.7