Jump to content
• What is your GameDev Story?

• Advertisement

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

hello.
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.
like:
 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); pPointNew.Normalize(); pPoint.Normalize(); 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
http://stackoverflow...be-along-a-path

but i'm not understand.
thanks.

Share this post

Share on other sites
Advertisement

• Advertisement
• Advertisement
• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• Popular Now

• 28
• 16
• 10
• 10
• 11
• Advertisement
• Forum Statistics

• Total Topics
634111
• Total Posts
3015563
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!