//
gp_Mat M(matrix);
Standard_Real s = M.Determinant();
- Standard_Real As = s;
- if (As < 0) As = - As;
- Standard_ConstructionError_Raise_if
- (As < gp::Resolution(),"gp_GTrsf::SetForm, null determinant");
+
+ if ( Abs(s) < gp::Resolution() )
+ Standard_ConstructionError::Raise("gp_GTrsf::SetForm, null determinant");
+
if (s > 0)
s = Pow(s,1./3.);
else
TM.Subtract(anIdentity);
if (shape==gp_Other) shape = gp_CompoundTrsf;
- Standard_Integer i, j;
- for (i=1; i<=3; i++) {
- for (j=1; j<=3; j++) {
- As = TM.Value(i,j);
- if (As < 0) As = - As;
- if (As > tol) {
- shape = gp_Other;
- return;
+ for (Standard_Integer i = 1; i <= 3; i++)
+ for (Standard_Integer j = 1; j <= 3; j++)
+ if ( Abs( TM.Value(i, j) ) > tol )
+ {
+ shape = gp_Other;
+ return;
}
- }
- }
}
gp_Trsf2d gp_GTrsf2d::Trsf2d () const
{
- gp_Trsf2d T;
- Standard_Real value;
-#ifndef No_Exception
- Standard_Real tolerance = Precision::Angular() ;
- Standard_Real tol2 = 2. * tolerance;
-#endif
+ // Test of orthogonality
+ const Standard_Real aTolerance = Precision::Angular();
+ const Standard_Real aTolerance2 = 2.0 * aTolerance;
- Standard_ConstructionError_Raise_if
- (Form() == gp_Other," gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d (0)");
+ if ( Form() == gp_Other )
+ Standard_ConstructionError::Raise("gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d(0)");
+ Standard_Real value = (matrix.Value(1, 1) * matrix.Value(1, 1)
+ + matrix.Value(2, 1) * matrix.Value(2, 1));
+ if ( Abs(value - 1.) > aTolerance2 )
+ Standard_ConstructionError::Raise("gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d(1)");
-//Test of orthogonality
+ value = (matrix.Value(1, 2) * matrix.Value(1, 2)
+ + matrix.Value(2, 2) * matrix.Value(2, 2));
+ if ( Abs(value - 1.) > aTolerance2 )
+ Standard_ConstructionError::Raise("gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d(2)");
- value = (matrix.Value(1,1) * matrix.Value(1,1) +
- matrix.Value(2,1) * matrix.Value(2,1)) ;
- Standard_ConstructionError_Raise_if
- (Abs(value - 1.) > tol2," gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d (1)");
+ value = (matrix.Value(1, 1) * matrix.Value(1, 2)
+ + matrix.Value(2, 1) * matrix.Value(2, 2));
+ if ( Abs(value) > aTolerance )
+ Standard_ConstructionError::Raise("gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d(3)");
- value = (matrix.Value(1,2) * matrix.Value(1,2) +
- matrix.Value(2,2) * matrix.Value(2,2));
- Standard_ConstructionError_Raise_if
- (Abs(value - 1.) > tol2," gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d (2)");
- value = (matrix.Value(1,1) * matrix.Value(1,2) +
- matrix.Value(2,1) * matrix.Value(2,2));
- Standard_ConstructionError_Raise_if
- (Abs(value) > tolerance," gp_GTrsf2d::Trsf2d() - non-orthogonal GTrsf2d (3)");
-//
-
- T.matrix = matrix ;
- T.shape = shape;
- T.scale = scale ;
- T.loc = loc;
+ gp_Trsf2d aTransformation;
+ aTransformation.matrix = matrix;
+ aTransformation.shape = shape;
+ aTransformation.scale = scale;
+ aTransformation.loc = loc;
- return T;
+ return aTransformation;
}