1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031673: Draw Harness, ViewerTest - command vlocation applies transformation in opposite order

gp_Trsf::SetRotationPart() - added method replacing rotation matrix without reseting other components,
similar to existing SetTraslationPart() and SetScaleFactor().

Transformation multiplication order has been fixed
for vlocation arguments -rotate, -translate, -mirror and -scale.
Added -prerotate, -pretranslate, -premirror and -prescale options following previous behavior.

vlocation -setRotation now uses new method gp_Trsf::SetRotationPart()
for consistency with methods -setLocation and -setScale.
This commit is contained in:
kgv
2020-07-19 00:36:04 +03:00
committed by bugmaster
parent 99ee8f1a83
commit dbc8becff4
8 changed files with 144 additions and 46 deletions

View File

@@ -129,6 +129,57 @@ void gp_Trsf::SetRotation (const gp_Quaternion& R)
matrix = R.GetMatrix();
}
//=======================================================================
//function : SetRotationPart
//purpose :
//=======================================================================
void gp_Trsf::SetRotationPart (const gp_Quaternion& theR)
{
const bool hasRotation = !theR.IsEqual (gp_Quaternion());
if (hasRotation)
{
matrix = theR.GetMatrix();
}
else
{
matrix.SetIdentity();
}
switch (shape)
{
case gp_Identity:
{
if (hasRotation)
{
shape = gp_Rotation;
}
break;
}
case gp_Rotation:
{
if (!hasRotation)
{
shape = gp_Identity;
}
break;
}
case gp_Translation:
case gp_PntMirror:
case gp_Ax1Mirror:
case gp_Ax2Mirror:
case gp_Scale:
case gp_CompoundTrsf:
case gp_Other:
{
if (hasRotation)
{
shape = gp_CompoundTrsf;
}
break;
}
}
}
//=======================================================================
//function : SetScale
//purpose :

View File

@@ -110,13 +110,14 @@ public:
//! A1 is the rotation axis and Ang is the angular value of the
//! rotation in radians.
Standard_EXPORT void SetRotation (const gp_Ax1& A1, const Standard_Real Ang);
//! Changes the transformation into a rotation defined by quaternion.
//! Note that rotation is performed around origin, i.e.
//! no translation is involved.
Standard_EXPORT void SetRotation (const gp_Quaternion& R);
//! Replaces the rotation part with specified quaternion.
Standard_EXPORT void SetRotationPart (const gp_Quaternion& R);
//! Changes the transformation into a scale.
//! P is the center of the scale and S is the scaling value.