/ich/Programmieren/KazadeEngine/NeHeKazmath/kazmath/src/vec3.h File Reference

#include <assert.h>

Go to the source code of this file.

Data Structures

struct  kmVec3

Defines

#define kmScalar   float

Functions

kmVec3kmVec3Fill (kmVec3 *pOut, kmScalar x, kmScalar y, kmScalar z)
kmScalar kmVec3Length (const kmVec3 *pIn)
kmScalar kmVec3LengthSq (const kmVec3 *pIn)
kmVec3kmVec3Normalize (kmVec3 *pOut, const kmVec3 *pIn)
kmVec3kmVec3Cross (kmVec3 *pOut, const kmVec3 *pV1, const kmVec3 *pV2)
kmScalar kmVec3Dot (const kmVec3 *pV1, const kmVec3 *pV2)
kmVec3kmVec3Add (kmVec3 *pOut, const kmVec3 *pV1, const kmVec3 *pV2)
kmVec3kmVec3Subtract (kmVec3 *pOut, const kmVec3 *pV1, const kmVec3 *pV2)
kmVec3kmVec3Transform (kmVec3 *pOut, const kmVec3 *pV1, const struct kmMat4 *pM)
kmVec3kmVec3TransformNormal (kmVec3 *pOut, const kmVec3 *pV, const struct kmMat4 *pM)
kmVec3kmVec3TransformCoord (kmVec3 *pOut, const kmVec3 *pV, const struct kmMat4 *pM)
kmVec3kmVec3Scale (kmVec3 *pOut, const kmVec3 *pIn, const kmScalar s)
int kmVec3AreEqual (const kmVec3 *p1, const kmVec3 *p2)
kmVec3kmVec3InverseTransform (kmVec3 *pOut, const kmVec3 *pV, const struct kmMat4 *pM)
kmVec3kmVec3InverseTransformNormal (kmVec3 *pOut, const kmVec3 *pVect, const struct kmMat4 *pM)
kmVec3kmVec3Assign (kmVec3 *pOut, const kmVec3 *pIn)
kmVec3kmVec3Zero (kmVec3 *pOut)


Define Documentation

#define kmScalar   float

Definition at line 32 of file vec3.h.


Function Documentation

kmVec3* kmVec3Add ( kmVec3 pOut,
const kmVec3 pV1,
const kmVec3 pV2 
)

Returns the cosine of the angle between 2 vectors

Adds 2 vectors and returns the result. The resulting vector is stored in pOut.

Definition at line 121 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmQuaternionMultiplyVec3().

int kmVec3AreEqual ( const kmVec3 p1,
const kmVec3 p2 
)

Scales a vector to length s

Returns KM_TRUE if the 2 vectors are approximately equal

Definition at line 268 of file vec3.c.

References kmEpsilon, kmVec3::x, kmVec3::y, and kmVec3::z.

kmVec3* kmVec3Assign ( kmVec3 pOut,
const kmVec3 pIn 
)

Assigns pIn to pOut. Returns pOut. If pIn and pOut are the same then nothing happens but pOut is still returned

Definition at line 283 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmMat4LookAt(), and kmQuaternionRotationBetweenVec3().

kmVec3* kmVec3Cross ( kmVec3 pOut,
const kmVec3 pV1,
const kmVec3 pV2 
)

Returns the vector passed in set to unit length

Returns a vector perpendicular to 2 other vectors. The result is stored in pOut.

Definition at line 91 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmMat4LookAt(), kmPlaneFromPoints(), kmQuaternionMultiplyVec3(), and kmQuaternionRotationBetweenVec3().

kmScalar kmVec3Dot ( const kmVec3 pV1,
const kmVec3 pV2 
)

Returns a vector perpendicular to 2 other vectors

Returns the cosine of the angle between 2 vectors

Definition at line 110 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmPlaneFromPointNormal(), kmPlaneFromPoints(), and kmQuaternionRotationBetweenVec3().

kmVec3* kmVec3Fill ( kmVec3 pOut,
kmScalar  x,
kmScalar  y,
kmScalar  z 
)

Fill a kmVec3 structure using 3 floating point values The result is store in pOut, returns pOut

Definition at line 42 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmGLRotatef(), kazmathxx::Vec3::operator*(), kazmathxx::Vec3::operator+(), kazmathxx::Vec3::operator-(), and kazmathxx::Vec3::operator/().

kmVec3* kmVec3InverseTransform ( kmVec3 pOut,
const kmVec3 pV,
const struct kmMat4 pM 
)

kmVec3* kmVec3InverseTransformNormal ( kmVec3 pOut,
const kmVec3 pVect,
const struct kmMat4 pM 
)

kmScalar kmVec3Length ( const kmVec3 pIn  ) 

Returns the length of the vector

Definition at line 54 of file vec3.c.

References kmSQR(), kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmPlaneNormalize(), and kmVec3Normalize().

kmScalar kmVec3LengthSq ( const kmVec3 pIn  ) 

Returns the length of the vector

Returns the square of the length of the vector

Definition at line 62 of file vec3.c.

References kmSQR(), kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmQuaternionRotationBetweenVec3().

kmVec3* kmVec3Normalize ( kmVec3 pOut,
const kmVec3 pIn 
)

Returns the square of the length of the vector

Returns the vector passed in set to unit length the result is stored in pOut.

Definition at line 71 of file vec3.c.

References kmScalar, kmVec3Length(), kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmMat4GetForwardVec3(), kmMat4GetRightVec3(), kmMat4GetUpVec3(), kmMat4LookAt(), kmPlaneFromPoints(), kmPlaneNormalize(), kmQuaternionRotationBetweenVec3(), and kmQuaternionToAxisAngle().

kmVec3* kmVec3Scale ( kmVec3 pOut,
const kmVec3 pIn,
const kmScalar  s 
)

Transforms a 3D vector by a given matrix, projecting the result back into w = 1.

Scales a vector to length s. Does not normalize first, you should do that!

Definition at line 256 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmPlaneFromPoints(), and kmQuaternionMultiplyVec3().

kmVec3* kmVec3Subtract ( kmVec3 pOut,
const kmVec3 pV1,
const kmVec3 pV2 
)

Adds 2 vectors and returns the result

Subtracts 2 vectors and returns the result. The result is stored in pOut.

Definition at line 140 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.

Referenced by kmMat4LookAt(), kmPlaneFromPoints(), and kmPlaneIntersectLine().

kmVec3* kmVec3Transform ( kmVec3 pOut,
const kmVec3 pV1,
const struct kmMat4 pM 
)

Subtracts 2 vectors and returns the result

kmVec3* kmVec3TransformCoord ( kmVec3 pOut,
const kmVec3 pV,
const struct kmMat4 pM 
)

kmVec3* kmVec3TransformNormal ( kmVec3 pOut,
const kmVec3 pV,
const struct kmMat4 pM 
)

kmVec3* kmVec3Zero ( kmVec3 pOut  ) 

Sets all the elements of pOut to zero. Returns pOut.

Definition at line 298 of file vec3.c.

References kmVec3::x, kmVec3::y, and kmVec3::z.


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