Xors3d Engine
3D maths

Functions

float xTFormedX ()
 Returns the X component of the last xTFormPoint(), xTFormVector() or xTFormNormal() operation.
float xTFormedY ()
 Returns the Y component of the last xTFormPoint(), xTFormVector() or xTFormNormal() operation.
float xTFormedZ ()
 Returns the Z component of the last xTFormPoint(), xTFormVector() or xTFormNormal() operation.
void xTFormNormal (float x, float y, float z, Entity *source, Entity *destination)
 Transforms vector between coordinate systems.
void xTFormPoint (float x, float y, float z, Entity *source, Entity *destination)
 Transforms point between coordinate systems.
void xTFormVector (float x, float y, float z, Entity *source, Entity *destination)
 Transforms vector between coordinate systems.
float xVectorPitch (float x, float y, float z)
 Returns the pitch value of a vector.
float xVectorYaw (float x, float y, float z)
 Returns the yaw value of a vector.

Function Documentation

float xVectorPitch ( float  x,
float  y,
float  z 
)

Returns the pitch value of a vector.

Using this command will return the same result as using xEntityPitch() to get the pitch value of an entity that is pointing in the vector's direction.

Parameters:
xx vector length
yy vector length
zz vector length
float xVectorYaw ( float  x,
float  y,
float  z 
)

Returns the yaw value of a vector.

Using this command will return the same result as using xEntityYaw() to get the yaw value of an entity that is pointing in the vector's direction.

Parameters:
xx vector length
yy vector length
zz vector length
float xTFormedX ( )

Returns the X component of the last xTFormPoint(), xTFormVector() or xTFormNormal() operation.

float xTFormedY ( )

Returns the Y component of the last xTFormPoint(), xTFormVector() or xTFormNormal() operation.

float xTFormedZ ( )

Returns the Z component of the last xTFormPoint(), xTFormVector() or xTFormNormal() operation.

void xTFormPoint ( float  x,
float  y,
float  z,
Entity *  source,
Entity *  destination 
)

Transforms point between coordinate systems.

After using xTFormPoint() the new components can be read with xTFormedX(), xTFormedY() and xTFormedZ(). See xEntityX() for details about local coordinates. Consider a sphere built with xCreateSphere(). The 'north pole' is at (0.0, 1.0, 0.0). At first, local and global coordinates are the same. As the sphere is moved, turned and scaled the global coordinates of the point change. But it is always at (0.0, 1.0, 0.0) in the sphere's local space.

Parameters:
xx component of a vector in 3D space
yy component of a vector in 3D space
zz component of a vector in 3D space
sourceHandle of source entity, or 0 for 3d world
destinationHandle of dstination entity, or 0 for 3d world
void xTFormVector ( float  x,
float  y,
float  z,
Entity *  source,
Entity *  destination 
)

Transforms vector between coordinate systems.

After using xTFormVector() the new components can be read with xTFormedX(), xTFormedY() and xTFormedZ(). See xEntityX() for details about local coordinates. Similar to xTFormPoint(), but operates on a vector. A vector can be thought of as 'displacement relative to current location'. For example, vector (1.0, 2.0, 3.0) means one step to the right, two steps up and three steps forward.

Parameters:
xx component of a vector in 3D space
yy component of a vector in 3D space
zz component of a vector in 3D space
sourceHandle of source entity, or 0 for 3d world
destinationHandle of dstination entity, or 0 for 3d world
void xTFormNormal ( float  x,
float  y,
float  z,
Entity *  source,
Entity *  destination 
)

Transforms vector between coordinate systems.

After using xTFormNormal() the new components can be read with xTFormedX(), xTFormedY() and xTFormedZ(). This is exactly the same as xTFormVector() but with one added feature. After the transformation the new vector is 'normalized', meaning it is scaled to have length 1. For example, suppose the result of xTFormVector is (1.0, 2.0, 2.0). This vector has length sqrt(1.0 * 1.0 + 2.0 * 2.0 + 2.0 * 2.0) = sqrt(9.0) = 3.0 This means xTFormNormal() would produce (1.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0).

Parameters:
xx component of a vector in 3D space
yy component of a vector in 3D space
zz component of a vector in 3D space
sourceHandle of source entity, or 0 for 3d world
destinationHandle of dstination entity, or 0 for 3d world