From: gka Date: Tue, 7 Apr 2015 16:22:24 +0000 (+0300) Subject: Patch for Bug #73"Error of compilation of the OCCT products for 6.7.0. X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=00d461675534c0c23b9ba54cf043785e778c8890;p=occt-copy.git Patch for Bug #73"Error of compilation of the OCCT products for 6.7.0. Method SetValues() with previous list of arguments was added for compatibility --- diff --git a/src/gp/gp_Trsf.cdl b/src/gp/gp_Trsf.cdl index 55c2f5a816..ea0edd4d12 100644 --- a/src/gp/gp_Trsf.cdl +++ b/src/gp/gp_Trsf.cdl @@ -220,6 +220,33 @@ is raises ConstructionError from Standard + is static; + + SetValues(me : in out; + a11, a12, a13, a14, + a21, a22, a23, a24, + a31, a32, a33, a34 : Real; + Tolang, TolDist : Real) + + ---Purpose: Sets the coefficients of the transformation. The + -- transformation of the point x,y,z is the point + -- x',y',z' with : + -- + -- x' = a11 x + a12 y + a13 z + a14 + -- y' = a21 x + a22 y + a23 z + a24 + -- z' = a31 x + a32 y + a43 z + a34 + -- + -- Tolang and TolDist are used to test for null + -- angles and null distances to determine the form of + -- the transformation (identity, translation, etc..). + -- + -- The method Value(i,j) will return aij. + -- Raises ConstructionError if the determinant of the aij is null. Or if + -- the matrix as not a uniform scale. + + raises + ConstructionError from Standard + is static; diff --git a/src/gp/gp_Trsf.cxx b/src/gp/gp_Trsf.cxx index b9004e02c9..0b14fcea8f 100644 --- a/src/gp/gp_Trsf.cxx +++ b/src/gp/gp_Trsf.cxx @@ -356,6 +356,103 @@ void gp_Trsf::SetValues(const Standard_Real a11, loc = col4; } +//======================================================================= +//function : SetValues +//purpose : +// 06-01-1998 modified by PMN : On utilise TolDist pour evaluer si les coeffs +// sont nuls : c'est toujours mieux que gp::Resolution ! +//======================================================================= + +void gp_Trsf::SetValues(const Standard_Real a11, + const Standard_Real a12, + const Standard_Real a13, + const Standard_Real a14, + const Standard_Real a21, + const Standard_Real a22, + const Standard_Real a23, + const Standard_Real a24, + const Standard_Real a31, + const Standard_Real a32, + const Standard_Real a33, + const Standard_Real a34, +// const Standard_Real Tolang, + const Standard_Real , + const Standard_Real +#ifndef No_Exception + TolDist +#endif + ) +{ + gp_XYZ col1(a11,a21,a31); + gp_XYZ col2(a12,a22,a32); + gp_XYZ col3(a13,a23,a33); + gp_XYZ col4(a14,a24,a34); + // compute the determinant + gp_Mat M(col1,col2,col3); + Standard_Real s = M.Determinant(); + Standard_Real As = s; + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As < gp::Resolution(),"gp_Trsf::SeValues, null determinant"); + if (s > 0) + s = Pow(s,1./3.); + else + s = -Pow(-s,1./3.); + M.Divide(s); + + // check if the matrix is a rotation matrix + // the transposition should be the invert. + gp_Mat TM(M); + TM.Transpose(); + TM.Multiply(M); + // + // don t trust the initial values ! + // + gp_Mat anIdentity ; + anIdentity.SetIdentity() ; + TM.Subtract(anIdentity); + As = TM.Value(1,1); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(1,2); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(1,3); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(2,1); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(2,2); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(2,3); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(3,1); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(3,2); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + As = TM.Value(3,3); + if (As < 0) As = - As; + Standard_ConstructionError_Raise_if + (As > TolDist,"gp_Trsf::SeValues, non uniform"); + scale = s; + shape = gp_CompoundTrsf; + matrix = M; + loc = col4; +} + //======================================================================= //function : GetRotation //purpose :