Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RwV3d
[Vector Types]


Data Structures

struct   RwV3d

Functions

RwReal  RwV3dNormalize (RwV3d *out, const RwV3d *in)
RwReal  RwV3dLength (const RwV3d *in)
void  RwV3dAssign (RwV3d *target, const RwV3d *source)
void  RwV3dAdd (RwV3d *out, const RwV3d *ina, const RwV3d *inb)
void  RwV3dSub (RwV3d *out, const RwV3d *ina, const RwV3d *inb)
void  RwV3dScale (RwV3d *out, const RwV3d *in, RwReal scalar)
void  RwV3dIncrementScaled (RwV3d *out, const RwV3d *in, RwReal scalar)
void  RwV3dNegate (RwV3d *out, const RwV3d *in)
RwReal  RwV3dDotProduct (const RwV3d *ina, const RwV3d *inb)
void  RwV3dCrossProduct (RwV3d *out, const RwV3d *ina, const RwV3d *inb)
RwV3d RwV3dTransformPoints (RwV3d *pointsOut, const RwV3d *pointsIn, RwInt32 numPoints, const RwMatrix *matrix)
RwV3d RwV3dTransformVectors (RwV3d *vectorsOut, const RwV3d *vectorsIn, RwInt32 numPoints, const RwMatrix *matrix)

Detailed Description

3D Vector mathematics.

RwV3d Overview

Requirements

Overview

This is RenderWare's 3D vector object.

The API covers the 3D vector basics, including: addition, subtraction, cross and dot products, length determination, negation, normalization and more. It is primarily used in the context of RenderWare's 3D Immediate Mode API RwIm3D and the scene graph API Scene Management . It is also used to represent a 3D coordinate or point in other parts of the API, such as RwBBox.


Function Documentation

void RwV3dAdd RwV3d   out,
const RwV3d   ina,
const RwV3d   inb
 

RwV3dAdd is used to add together the specified 3D vectors. The result of the addition is placed in a third 3D vector.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
out  A pointer to the 3D vector that will receive the result of the addition
ina  A pointer to the first 3D vector
inb  A pointer to the second 3D vector
Returns:
None
See also:
RwV3dIncrementScaled , RwV3dScale , RwV3dSub , RwV3dTransformPoints , RwV3dTransformVectors
void RwV3dAssign RwV3d   target,
const RwV3d   source
 

RwV3dAssign is used to assign to the first 3D vectors the value of the second 3D vector.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
target  Pointer to the target 3D vector that will receive the assignment
source  Pointer to the source 3D vector
Returns:
None
See also:
RwV3dAdd , RwV3dIncrementScaled , RwV3dScale , RwV3dSub , RwV3dTransformPoints , RwV3dTransformVectors
void RwV3dCrossProduct RwV3d   out,
const RwV3d   ina,
const RwV3d   inb
 

RwV3dCrossProduct is used to calculate the cross product of the specified 3D vectors, in the order given. The result of the cross product is placed in a third 3D vector.

Note:
The argument corresponding to the output 3D vector should not point to either of the other arguments.
Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
out  A pointer to the 3D vector that will receive the cross product vector
ina  A pointer to the first 3D vector
inb  A pointer to the second 3D vector
Returns:
None
See also:
RwV3dDotProduct
RwReal RwV3dDotProduct const RwV3d   ina,
const RwV3d   inb
 

RwV3dDotProduct is used to calculate the scalar product of the specified 3D vectors.

Note:
that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
ina  A pointer to the first 3D vector
inb  A pointer to the second 3D vector
Returns:
Returns an RwReal value equal to the scalar product of the two input vectors if successful or -1 if there is an error
See also:
RwV3dCrossProduct
void RwV3dIncrementScaled RwV3d   out,
const RwV3d   in,
RwReal    scalar
 

RwV3dIncrementScaled multiplies the second 3D vector by the given scalar and increments the first 3D vector by this amount

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
out  A pointer to the 3D vector that will accumulate the result
in  A pointer to the 3D vector that will be scaled
scalar  An RwReal value equal to the scaled factor
Returns:
None
See also:
RwV3dAdd , RwV3dScale , RwV3dSub , RwV3dTransformPoints , RwV3dTransformVectors
RwReal RwV3dLength const RwV3d   in
 

RwV3dLength is used to calculate the length of the specified 3D vector.

Note:
This function uses an efficient customized procedure for calculating square roots, which will be accurate enough for most input vectors. However, application developers should be aware that the accuracy of the results produced from RwV3dLength may become unacceptable for vectors of very small magnitude.
Parameters:
in  A pointer to the 3D vector
Returns:
Returns an RwReal value equal to the vector's length if successful or zero if there is an error
See also:
RwV3dNormalize
void RwV3dNegate RwV3d   out,
const RwV3d   in
 

RwV3dNegate negates the second 3D vector and returns the result in the first 3D vector.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
out  A pointer to the 3D vector that will receive the result
in  A pointer to the 3D vector that will be negated
Returns:
None
See also:
RwV3dTransformPoints , RwV3dTransformVectors
RwReal RwV3dNormalize RwV3d   out,
const RwV3d   in
 

RwV3dNormalize is used to normalize the specified 3D vector. The input and output arguments can point to the same 3D vector.

Note:
It is an error to try to normalize a vector whose length is zero. If this condition is detected RwV3dNormalize places a vector with components (0,0,0) in the output argument and returns 0.0.
Note:
This function uses an efficient customized procedure for calculating square roots, which will be accurate enough for most input vectors. However, application developers should be aware that the accuracy of the results produced from RwV3dNormalize may become unacceptable for vectors of very small magnitude.
Parameters:
out  A pointer to a 3D vector that will receive the normalized vector
in  A pointer to the 3D vector
Returns:
Returns an RwReal value equal to the original length of the vector if successful or zero if there is an error
See also:
RwV3dLength
void RwV3dScale RwV3d   out,
const RwV3d   in,
RwReal    scalar
 

RwV3dScale is used to multiply the specified 3D vector by the given scalar. The result is placed in a second 3D vector.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
out  A pointer to the 3D vector that will receive the result
in  A pointer to the 3D vector that will be scaled
scalar  An RwReal value equal to the scale factor
Returns:
None
See also:
RwV3dAdd , RwV3dIncrementScaled , RwV3dSub , RwV3dTransformPoints , RwV3dTransformVectors
void RwV3dSub RwV3d   out,
const RwV3d   ina,
const RwV3d   inb
 

RwV3dSub is used to subtract the specified 3D vectors. The second vector is subtracted from the first. The result of the subtraction is placed in a third 3D vector.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
out  A pointer to the 3D vector that will receive the result of the subtraction
ina  A pointer to the first 3D vector
inb  A pointer to the second 3D vector
Returns:
None
See also:
RwV3dAdd , RwV3dIncrementScaled , RwV3dScale , RwV3dTransformPoints , RwV3dTransformVectors
RwV3d* RwV3dTransformPoints RwV3d   pointsOut,
const RwV3d   pointsIn,
RwInt32    numPoints,
const RwMatrix   matrix
 

RwV3dTransformPoints uses the given matrix describing a transformation and applies it to the specified array of points. The results are then placed in another array (which may be the same array as the source).

Note:
The source and destination array may be separate or coincident, but the result is not defined if the source and destination overlap in any other way (i.e. if they are offset from one another but still overlap).
Parameters:
pointsOut  A pointer to an array of RwV3ds that are to receive the results of the point transformation
pointsIn  A pointer to an array of RwV3ds that are to supply to points to be transformed
numPoints  A number of points to transform
matrix  A pointer to the matrix supplying the transformation
Returns:
Returns a pointer to the transformed point array if successful or NULL if there is an error
See also:
RwMatrixTransform , RwV3dTransformVectors
RwV3d* RwV3dTransformVectors RwV3d   vectorsOut,
const RwV3d   vectorsIn,
RwInt32    numPoints,
const RwMatrix   matrix
 

RwV3dTransformVectors uses the given matrix describing a transformation and applies it to the specified array of vectors. The results are then placed in another array (which may be the same array as the source).

Note:
The source and destination array may be separate or coincident, but the result is not defined if the source and destination overlap in any other way (ie, if they are offset from one another but still overlap).
Parameters:
vectorsOut  A pointer to an array of RwV3ds that are to receive the results of the vector transformation
vectorsIn  A pointer to an array of RwV3ds that are to supply to vectors to be transformed
numPoints  A number of vectors to transform
matrix  A pointer to the matrix supplying the transformation
Returns:
Returns a pointer to the transformed vector if successful or NULL if there is an error
See also:
RwMatrixTransform , RwV3dTransformPoints

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:13 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)