PROGRAMMER'S GUIDEMathematical calculation library
BackForward
Mathematical calculation library

2.1 Data structure


 List
 Title
Data specifications
 Data
2D point data
 Data Name
MthXy
 No
1

typedef struct MthXy {
     Fixed32 x; / * X coordinate * /
     Fixed32 y; / * Y coordinate * /
} MthXy; 


 List
 Title
Data specifications
 Data
3D point data
 Data Name
MthXyz
 No
2

typedef struct MthXyz {
     Fixed32 x; / * X coordinate * /
     Fixed32 y; / * Y coordinate * /
     Fixed32 z; / * Z coordinate * /
} MthXyz; 


 List
 Title
Data specifications
 Data
3-by-4 matrix data
 Data Name
MthMatrix
 No
3

Typedef struct MthMatrix {
     Fixed32 val [3] [4]; / * 3 rows 4 columns fixed point data * /
} MthMatrix 


 List
 Title
Data specifications
 Data
Matrix stack table
 Data Name
MthMatrixTbl
 No
Four

typedef struct MthMatrixTbl {
     Uint16 stackSize; / * Number of matrix stack entries * /
     MthMatrix * current; / * Current matrix pointer * /
     MthMatrix * stack; / * Matrix stack pointer * /
} MthMatrixTbl; 


 List
 Title
Data specifications
 Data
Polygon data column coordinate transformation parameters
 Data Name
MthPolyTransParm
 No
Five

 typedef struct MthPolyTransParm {
     MthViewLight * viewLight; / * Coordinate system conversion parameters * /
     Uint32 surfCount; / * Number of polygon faces * /
     MthXyz * surfPoint; / * Representative point of polygon surface for surface brightness calculation * /
     MthXyz * surfNormal; / * Polygon surface normal * /
     Sint32 * surfBright; / * Polygon surface brightness calculation result * /
     Uint32 transViewVertCount; / * Number of vertex entries for viewpoint coordinate transformation * /
     MthXyz * transViewVertSrc; / * Vertex data before viewpoint coordinate conversion * /
     MthXyz * transViewVertAns; / * Vertex data after viewpoint coordinate conversion * /
     Uint32 gourVertCount; / * Number of vertex entries in vertex brightness calculation * /
     MthXyz * vertNormal; / * Vertex normal for vertex brightness calculation * /
     Sint32 * vertBright; / * Vertex brightness calculation result * /
     Uint32 transWorldVertCount; / * Number of vertex entries for world coordinate transformation * /
     MthXyz * transWorldVertSrc; / * Vertex data before world coordinate conversion * /
     MthXyz * transWorldVertAns; / * Vertex data after world coordinate transformation * /
} MthPolyTransParm; 


 List
 Title
Data specifications
 Data
Coordinate system transformation parameters
 Data Name
MthViewLight
 No
6

 typedef struct MthViewLight {
     MthMatrix viewMatrix; / * Conversion matrix to viewpoint coordinate system * /
     MthXyz lightVector; / * Light source vector in the viewpoint coordinate system * /
     MthMatrix worldMatrix; / * Conversion matrix to world coordinate system * /
} MthViewLight;


BackForward
PROGRAMMER'S GUIDEMathematical calculation library
Copyright SEGA ENTERPRISES, LTD., 1997