mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0029978: Data Exchange, macOS - the result of reading some entity from STEP looks odd
On Apple with XCode 9.4.1 and onwards, the compiler optimization is disabled for method gp_Mat::Transpose() as optimizer generates invalid code when that method is used. Some refactoring of the code affected by this bug.
This commit is contained in:
parent
170175554f
commit
c16c60a402
@ -321,6 +321,14 @@ inline gp_Mat gp_Mat::Subtracted (const gp_Mat& Other) const
|
||||
return NewMat;
|
||||
}
|
||||
|
||||
// On macOS 10.13.6 with XCode 9.4.1 the compiler has a bug leading to
|
||||
// generation of invalid code when method gp_Mat::Transpose() is called
|
||||
// for a matrix which is when applied to vector; it looks like vector
|
||||
// is transformed before the matrix is actually transposed; see #29978.
|
||||
// To avoid this, we disable compiler optimization here.
|
||||
#if defined(__APPLE__) && (__apple_build_version__ > 9020000)
|
||||
__attribute__((optnone))
|
||||
#endif
|
||||
inline void gp_Mat::Transpose ()
|
||||
{
|
||||
Standard_Real Temp;
|
||||
|
@ -157,11 +157,10 @@ void gp_Trsf::SetTransformation (const gp_Ax3& FromA1,
|
||||
shape = gp_CompoundTrsf;
|
||||
scale = 1.0;
|
||||
// matrix from XOY ToA2 :
|
||||
matrix.SetCol (1, ToA2.XDirection().XYZ());
|
||||
matrix.SetCol (2, ToA2.YDirection().XYZ());
|
||||
matrix.SetCol (3, ToA2.Direction().XYZ());
|
||||
matrix.SetRows (ToA2.XDirection().XYZ(),
|
||||
ToA2.YDirection().XYZ(),
|
||||
ToA2. Direction().XYZ());
|
||||
loc = ToA2.Location().XYZ();
|
||||
matrix.Transpose();
|
||||
loc.Multiply (matrix);
|
||||
loc.Reverse ();
|
||||
|
||||
@ -183,11 +182,10 @@ void gp_Trsf::SetTransformation (const gp_Ax3& A3)
|
||||
{
|
||||
shape = gp_CompoundTrsf;
|
||||
scale = 1.0;
|
||||
loc = A3.Location().XYZ();
|
||||
matrix.SetCols (A3.XDirection().XYZ(),
|
||||
matrix.SetRows (A3.XDirection().XYZ(),
|
||||
A3.YDirection().XYZ(),
|
||||
A3. Direction().XYZ());
|
||||
matrix.Transpose();
|
||||
loc = A3.Location().XYZ();
|
||||
loc.Multiply (matrix);
|
||||
loc.Reverse ();
|
||||
}
|
||||
@ -403,16 +401,12 @@ void gp_Trsf::Invert()
|
||||
if (shape == gp_Identity) { }
|
||||
else if (shape == gp_Translation || shape == gp_PntMirror) loc.Reverse();
|
||||
else if (shape == gp_Scale) {
|
||||
Standard_Real As = scale;
|
||||
if (As < 0) As = - As;
|
||||
Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
scale = 1.0 / scale;
|
||||
loc.Multiply (-scale);
|
||||
}
|
||||
else {
|
||||
Standard_Real As = scale;
|
||||
if (As < 0) As = - As;
|
||||
Standard_ConstructionError_Raise_if (As <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
Standard_ConstructionError_Raise_if (Abs(scale) <= gp::Resolution(), "gp_Trsf::Invert() - transformation has zero scale");
|
||||
scale = 1.0 / scale;
|
||||
matrix.Transpose ();
|
||||
loc.Multiply (matrix);
|
||||
|
Loading…
x
Reference in New Issue
Block a user