This is a general question about the API rather than a specific model.
If I am writing my own importer for another application, and this format is simple compared to Aspose.ThreeD. In this app a node only has translation, rotation and scale. No geometric properties or pre/post rotation.
I need to know the following:
- how do I correctly transform Geometry.ControlPoints into both local node coordinates
- same as above but into global scene coordinate
Less about implementation details and more about whether additional transformations are necessary, especially considering the additions of GeometricRotation, GeometricScaling and GeometricTranslation. Also I’m not sure on whether PreRotation and PostRotation are in the Node.Transform.
I have attached an example file, but again that’s not the important bit. I’m looking for the rules and documentation.
TeapotScene.zip (100.6 KB)
scene.RootNode.Accept( node =>
Mesh mesh = node.GetEntity<Mesh>();
if ( mesh != null )
foreach ( int meshPolygon in mesh.Polygons )
// Polygon in glo
var globalPolygonPoints = new Vector3[meshPolygon.Length];
for ( int i = 0; i < meshPolygon.Length; i++ )
int cIndex = meshPolygon[i];
Vector3 controlPoint = new Vector3( mesh.ControlPoints[cIndex] );
// Is this correct?
Vector3 globalControlPoint = node.GlobalTransform.TransformMatrix.MultiplyPoint( controlPoint );
// Does the above take care of:
// Do I need to construct my own goemetric transform matrix??
Vector3 gRotation = node.Transform.GeometricRotation;
Matrix4 geometricMatrix = ( new TransformBuilder( ComposeOrder.Prepend ) )
.Translate( node.Transform.GeometricTranslation )
.RotateEulerDegree( gRotation.x, gRotation.y,
.Scale( node.Transform.GeometricScaling ).Matrix;
// OR Is this correct?
globalControlPoint = ( node.GlobalTransform.TransformMatrix * geometricMatrix ).MultiplyPoint( controlPoint );
globalPolygonPoints[i] = globalControlPoint;
// Render my global polygon in native application
// e.g. RenderPolygon( globalPolygonPoints );
Given the additions of Geometric properties of a node’s transform, does it make sense to add a read-only property, or extension method to Node to get the transformation matrix required to transform Geometry into global and local space?