profile and extrusion

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.”
but i’m not understand.