MatrixFactory class
Updated:
13 May 2019
The MatrixFactory class provides a convenient way to generate different kinds of transformation matrices.
This example shows how to transform a point between coordinate systems.
Model myModel = new Model();
WorkPlaneHandler myWorkPlaneHandler = myModel.GetWorkPlaneHandler();
Beam myBeam = new Beam();
Point myPoint = new Point(100,200,300);
//Using the current work plane
TransformationPlane currentPlane = myWorkPlaneHandler.GetCurrentTransformationPlane();
myModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
//Get matrix to transform to the beam's local coordinate system
Matrix transformationMatrix = MatrixFactory.ToCoordinateSystem(myBeam.GetCoordinateSystem());
//Transform the point from current work plane to the local coordinate system
Point localPoint = TransformationMatrix.Transform(myPoint);
//Get the matrix to transform from local to current work plane
Matrix TransformationMatrix = MatrixFactory.FromCoordinateSystem(myBeam.GetCoordinateSystem());
//Transform the point from local to the current work plane coordinate system
myPoint = TransformationMatrix.Transform(localPoint);