Advertisement Jump to content
Sign in to follow this  

Extrusion , 2d profile and 2d matrix reduction?

This topic is 2506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have this problem:
I have a 2d profile, an extrusion direction a depth and a 3d transformation.
The 2d profile is extruded along the extrusion direction ,for a depth .
The 3d transformation rotates the 2d profile in the profile plane.
I would like to extract the angle of rotation of the 2d profile in the profile plane after the apply of the rotation matrix.
I trying this method:
1)save a point of the profile
2)apply the trasformation matrix on the point
3)get the transformed point
4)use a dot product for get with the acos function the angle after the transformation.

C3DVectorIfc pPoint = *(pProfile)[0];
double d = DEG_RAD(90.0);
pmxRes->m_X = C3DVectorIfc(1.0, 0.0, 0.0);
pmxRes->m_Y = C3DVectorIfc(0.0, cos(d), -sin(d));
pmxRes->m_Z = C3DVectorIfc(0.0, sin(d), cos(d));

C3DMatrixIfc pm = *pmxRes;
C3DVectorIfc pPointNew = (pm * pPoint);

double dot=pPoint * pPointNew;
double dAngle = ACos(dot);

the problem is that this don't works.
for example:
1)pPoint = -162;-63.5;0.0
2)pPointNew= -162;0.0;-63.5
after the normalization
3)pPoint = -0.92;-0.38;0
4)pPoint = -0.92;0.0;-0.38
5)dot product: 0.85
6)double dAngle = acos(dot);
dAngle = RAD_DEG(dAngle);
dAngle = 31°????? not 90°
I think that must be a problem of the 2d coord system.
may be that I must do a projection?
Because i read that the projection is an operation that involve coordinate system reduction.

i ask this to geometric tools programmers and they say:

"What you want is to keep
track of the "coordinate frame" vectors along the axis of the beam."

i think that this is the same solution that they say

but i'm not understand.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!