/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/vec4.c File Reference

#include <memory.h>
#include <assert.h>
#include "utility.h"
#include "vec4.h"
#include "mat4.h"

Go to the source code of this file.

Functions

kmVec4kmVec4Fill (kmVec4 *pOut, kmScalar x, kmScalar y, kmScalar z, kmScalar w)
kmVec4kmVec4Add (kmVec4 *pOut, const kmVec4 *pV1, const kmVec4 *pV2)
kmScalar kmVec4Dot (const kmVec4 *pV1, const kmVec4 *pV2)
 Returns the dot product of 2 4D vectors.
kmScalar kmVec4Length (const kmVec4 *pIn)
kmScalar kmVec4LengthSq (const kmVec4 *pIn)
 Returns the length of the 4D vector squared.
kmVec4kmVec4Lerp (kmVec4 *pOut, const kmVec4 *pV1, const kmVec4 *pV2, kmScalar t)
 Returns the interpolation of 2 4D vectors based on t. Currently not implemented!
kmVec4kmVec4Normalize (kmVec4 *pOut, const kmVec4 *pIn)
 Normalizes a 4D vector. The result is stored in pOut. pOut is returned.
kmVec4kmVec4Scale (kmVec4 *pOut, const kmVec4 *pIn, const kmScalar s)
 Scales a vector to the required length. This performs a Normalize before multiplying by S.
kmVec4kmVec4Subtract (kmVec4 *pOut, const kmVec4 *pV1, const kmVec4 *pV2)
 Subtracts one 4D pV2 from pV1. The result is stored in pOut. pOut is returned.
kmVec4kmVec4Transform (kmVec4 *pOut, const kmVec4 *pV, const kmMat4 *pM)
 Transforms a 4D vector by a matrix, the result is stored in pOut, and pOut is returned.
kmVec4kmVec4TransformArray (kmVec4 *pOut, unsigned int outStride, const kmVec4 *pV, unsigned int vStride, const kmMat4 *pM, unsigned int count)
 Loops through an input array transforming each vec4 by the matrix.
int kmVec4AreEqual (const kmVec4 *p1, const kmVec4 *p2)
kmVec4kmVec4Assign (kmVec4 *pOut, const kmVec4 *pIn)


Function Documentation

kmVec4* kmVec4Add ( kmVec4 pOut,
const kmVec4 pV1,
const kmVec4 pV2 
)

Adds 2 4D vectors together. The result is store in pOut, the function returns pOut so that it can be nested in another function.

Definition at line 47 of file vec4.c.

References kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

int kmVec4AreEqual ( const kmVec4 p1,
const kmVec4 p2 
)

Definition at line 155 of file vec4.c.

References kmEpsilon, kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

kmVec4* kmVec4Assign ( kmVec4 pOut,
const kmVec4 pIn 
)

Definition at line 164 of file vec4.c.

kmScalar kmVec4Dot ( const kmVec4 pV1,
const kmVec4 pV2 
)

Returns the dot product of 2 4D vectors.

Definition at line 74 of file vec4.c.

References kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

kmVec4* kmVec4Fill ( kmVec4 pOut,
kmScalar  x,
kmScalar  y,
kmScalar  z,
kmScalar  w 
)

Definition at line 35 of file vec4.c.

References kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

kmScalar kmVec4Length ( const kmVec4 pIn  ) 

Returns the length of a 4D vector, this uses a sqrt so if the squared length will do use kmVec4LengthSq

Definition at line 83 of file vec4.c.

References kmSQR(), kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

Referenced by kmVec4Normalize().

kmScalar kmVec4LengthSq ( const kmVec4 pIn  ) 

Returns the length of the 4D vector squared.

Definition at line 88 of file vec4.c.

References kmSQR(), kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

kmVec4* kmVec4Lerp ( kmVec4 pOut,
const kmVec4 pV1,
const kmVec4 pV2,
kmScalar  t 
)

Returns the interpolation of 2 4D vectors based on t. Currently not implemented!

Definition at line 93 of file vec4.c.

kmVec4* kmVec4Normalize ( kmVec4 pOut,
const kmVec4 pIn 
)

Normalizes a 4D vector. The result is stored in pOut. pOut is returned.

Definition at line 99 of file vec4.c.

References kmScalar, kmVec4Length(), kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

Referenced by kmVec4Scale().

kmVec4* kmVec4Scale ( kmVec4 pOut,
const kmVec4 pIn,
const kmScalar  s 
)

Scales a vector to the required length. This performs a Normalize before multiplying by S.

Scales a vector to length s.

Definition at line 111 of file vec4.c.

References kmVec4Normalize(), kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

kmVec4* kmVec4Subtract ( kmVec4 pOut,
const kmVec4 pV1,
const kmVec4 pV2 
)

Subtracts one 4D pV2 from pV1. The result is stored in pOut. pOut is returned.

Definition at line 122 of file vec4.c.

References kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

kmVec4* kmVec4Transform ( kmVec4 pOut,
const kmVec4 pV,
const kmMat4 pM 
)

Transforms a 4D vector by a matrix, the result is stored in pOut, and pOut is returned.

Definition at line 132 of file vec4.c.

References kmMat4::mat, kmVec4::w, kmVec4::x, kmVec4::y, and kmVec4::z.

Referenced by kmVec4TransformArray().

kmVec4* kmVec4TransformArray ( kmVec4 pOut,
unsigned int  outStride,
const kmVec4 pV,
unsigned int  vStride,
const kmMat4 pM,
unsigned int  count 
)

Loops through an input array transforming each vec4 by the matrix.

Definition at line 141 of file vec4.c.

References kmVec4Transform().


Generated on Mon Dec 29 18:40:11 2008 for Kazmath by  doxygen 1.5.6