How to implement AcGeMatrix3d::setToWorldToPlane(const AcGePlane& plane)

How to implement AcGeMatrix3d::setToWorldToPlane(const AcGePlane& plane)

Anonymous
Not applicable
797 Views
1 Reply
Message 1 of 2

How to implement AcGeMatrix3d::setToWorldToPlane(const AcGePlane& plane)

Anonymous
Not applicable

Hello, everyone!

 

I Have imp a Matrix3d of myself.The interface of it is very similar with AcGeMatrix3d,And I have imp a cmpare function to cmp them for testing the equality.

All other interface is done well. But I really don't know

     setToWorldToPlane(const AcGePlane& plane);

planeInput plane specifies a UCS whose origin is the origin of the plane, whose x-axis is the x-axis of the plane, etc.

How To imp it?

Thanks!

0 Likes
798 Views
1 Reply
Reply (1)
Message 2 of 2

Balaji_Ram
Alumni
Alumni

Hi,

 

The AcGeMatrix3d::setToPlaneToWorld determines the transformation required from the plane to the world. Here is a sample code snippet that uses the AcGeMatrix3d::alignCoordSys to determine the same matrix. I hope this helps you understand what the AcGeMatrix3d::setToPlaneToWorld does.

 

AcGePlane testPlane = AcGePlane::kZXPlane; 

// Plane Origin, X axis, Y axis and Z axis
AcGePoint3d	fromOrigin;  
AcGeVector3d fromXAxis;
AcGeVector3d fromYAxis; 
testPlane.getCoordSystem(fromOrigin, fromXAxis, fromYAxis);
AcGeVector3d fromZAxis = testPlane.normal();

AcGeMatrix3d mat1 = AcGeMatrix3d::kIdentity;
mat1 = AcGeMatrix3d::alignCoordSys(	fromOrigin,
									fromXAxis,
									fromYAxis,
									fromZAxis,
									AcGePoint3d::kOrigin,
									AcGeVector3d::kXAxis,
									AcGeVector3d::kYAxis,
									AcGeVector3d::kZAxis
								 );
mat1 = mat1.inverse();

// Verify the matrix
AcGeMatrix3d mat2 = AcGeMatrix3d::kIdentity;
mat2 = AcGeMatrix3d::planeToWorld( testPlane );

if(mat1.isEqualTo(mat2))
	acutPrintf(ACRX_T("Results are the same !!"));
else
	acutPrintf(ACRX_T("Results differ !!"));

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes