The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoTransform

Structure to represent transforms. More...

Files

file  SoTransform.c
file  SoTransform.h

Data Structures

struct  SoTransform
 Transformation class definition. More...


Functions

void SoTransformMakeIdentity (SoTransform *a_This)
 Resets the transformation.

void SoTransformSetRotateX (SoTransform *a_This, s32 a_Angle)
 Sets the rotation angle around the X-axis.

void SoTransformSetRotateY (SoTransform *a_This, s32 a_Angle)
 Sets the rotation angle around the Y-axis.

void SoTransformSetRotateZ (SoTransform *a_This, s32 a_Angle)
 Sets the rotation angle around the Z-axis.

void SoTransformSetTranslation (SoTransform *a_This, sofixedpoint a_X, sofixedpoint a_Y, sofixedpoint a_Z)
 Sets the translational part of the transform.

void SoTransformRotateX (SoTransform *a_This, s32 a_Angle)
 Rotates the transform around the X-axis.

void SoTransformRotateY (SoTransform *a_This, s32 a_Angle)
 Rotates the transform around the Y-axis.

void SoTransformRotateZ (SoTransform *a_This, s32 a_Angle)
 Rotates the transform around the Z-axis.

void SoTransformTranslate (SoTransform *a_This, sofixedpoint a_X, sofixedpoint a_Y, sofixedpoint a_Z)
 Translates the transform.

void SoTransformToMatrix (SoTransform *a_This, SoMatrix *a_Matrix)
 Returns a 3 by 4 matrix representation of the transform.

void SoTransformToInverseMatrix (SoTransform *a_This, SoMatrix *a_Matrix)
 Returns a 3 by 4 matrix representation of the inverse of this transform.

void SoTransformSetScale (SoTransform *a_This, sofixedpoint a_ScaleX, sofixedpoint a_ScaleY, sofixedpoint a_ScaleZ)
 Sets the uniform scale value.


Detailed Description

Structure to represent transforms.

This module contains the definition of a transformation. A transformation can be represented by a matrix as well, but a matrix is more sensitive for accumulating errors, especially because we are using a low-precision fixed point format. That's why you should use this transformation class and not convert it to a matrix until the very last moment.

Note that the transform separately stores its translation, scaling, and rotation and they do not interact with each other. When constructing a matrix from a transform, we always composite them in the order X rotation, Y rotation, Z rotation, translation, scale. For this reason, transforms are not ideal for use in hierarchical scene graphs.


Function Documentation

void SoTransformMakeIdentity SoTransform   a_This
 

Resets the transformation.

Sets the transformation to the identity-transform. Sets the translation part to zero. Sets the rotational part to zero, and sets the uniform scale to one.

Parameters:
a_This  This pointer

void SoTransformRotateX SoTransform   a_This,
s32    a_Angle
 

Rotates the transform around the X-axis.

The difference between this one and SetTransformRotateX is that this one adds the angle to the existing angle.

Parameters:
a_This  This pointer
a_Angle  Angle. A Full circle is 256 degrees

void SoTransformRotateY SoTransform   a_This,
s32    a_Angle
 

Rotates the transform around the Y-axis.

The difference between this one and SetTransformRotateY is that this one adds the angle to the existing angle.

Parameters:
a_This  This pointer
a_Angle  Angle. A Full circle is 256 degrees

void SoTransformRotateZ SoTransform   a_This,
s32    a_Angle
 

Rotates the transform around the Z-axis.

The difference between this one and SetTransformRotateZ is that this one adds the angle to the existing angle.

Parameters:
a_This  This pointer
a_Angle  Angle. A Full circle is 256 degrees

void SoTransformSetRotateX SoTransform   a_This,
s32    a_Angle
 

Sets the rotation angle around the X-axis.

Parameters:
a_This  This pointer
a_Angle  Angle. A Full circle is 256 degrees

void SoTransformSetRotateY SoTransform   a_This,
s32    a_Angle
 

Sets the rotation angle around the Y-axis.

Parameters:
a_This  This pointer
a_Angle  Angle. A Full circle is 256 degrees

void SoTransformSetRotateZ SoTransform   a_This,
s32    a_Angle
 

Sets the rotation angle around the Z-axis.

Parameters:
a_This  This pointer
a_Angle  Angle. A Full circle is 256 degrees

void SoTransformSetScale SoTransform   a_This,
sofixedpoint    a_ScaleX,
sofixedpoint    a_ScaleY,
sofixedpoint    a_ScaleZ
 

Sets the uniform scale value.

Parameters:
a_This  This pointer
a_ScaleX  Fixed point scale factor. X component.
a_ScaleY  Fixed point scale factor. Y component.
a_ScaleZ  Fixed point scale factor. Z component.

void SoTransformSetTranslation SoTransform   a_This,
sofixedpoint    a_X,
sofixedpoint    a_Y,
sofixedpoint    a_Z
 

Sets the translational part of the transform.

Parameters:
a_This  This pointer
a_X  Fixed point X part of the translate
a_Y  Fixed point Y part of the translate
a_Z  Fixed point Z part of the translate

void SoTransformToInverseMatrix SoTransform   a_This,
SoMatrix   a_Matrix
 

Returns a 3 by 4 matrix representation of the inverse of this transform.

Todo:
Optimize this method
Parameters:
a_This  This pointer
a_Matrix  [OUT] Resulting matrix

void SoTransformToMatrix SoTransform   a_This,
SoMatrix   a_Matrix
 

Returns a 3 by 4 matrix representation of the transform.

Todo:
Optimize this method
Parameters:
a_This  This pointer
a_Matrix  [OUT] Resulting matrix

void SoTransformTranslate SoTransform   a_This,
sofixedpoint    a_X,
sofixedpoint    a_Y,
sofixedpoint    a_Z
 

Translates the transform.

The difference between this one and SoTransformSetTranslate is that in this Method the translation is added to the existing transformation.

Parameters:
a_This  This pointer
a_X  Fixed point X part of the translate
a_Y  Fixed point Y part of the translate
a_Z  Fixed point Z part of the translate


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.