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

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

Go to the source code of this file.

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 *pV, const kmMat4 *pM)
kmVec3kmVec3InverseTransform (kmVec3 *pOut, const kmVec3 *pVect, const kmMat4 *pM)
kmVec3kmVec3InverseTransformNormal (kmVec3 *pOut, const kmVec3 *pVect, const kmMat4 *pM)
kmVec3kmVec3TransformCoord (kmVec3 *pOut, const kmVec3 *pV, const kmMat4 *pM)
kmVec3kmVec3TransformNormal (kmVec3 *pOut, const kmVec3 *pV, const kmMat4 *pM)
kmVec3kmVec3Scale (kmVec3 *pOut, const kmVec3 *pIn, const kmScalar s)
int kmVec3AreEqual (const kmVec3 *p1, const kmVec3 *p2)
kmVec3kmVec3Assign (kmVec3 *pOut, const kmVec3 *pIn)
kmVec3kmVec3Zero (kmVec3 *pOut)


Detailed Description

Definition in file vec3.c.


Function Documentation

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

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 
)

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 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 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 pVect,
const kmMat4 pM 
)

Definition at line 180 of file vec3.c.

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

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

Definition at line 199 of file vec3.c.

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

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 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 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 
)

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 
)

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 pV,
const kmMat4 pM 
)

Transforms vector (x, y, z, 1) by a given matrix. The result is stored in pOut. pOut is returned.

Definition at line 159 of file vec3.c.

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

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

NOT COMPLETE, DO NOT USE!

Definition at line 217 of file vec3.c.

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

Definition at line 230 of file vec3.c.

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

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