]> OCCT Git - occt-copy.git/commitdiff
0025374: [6.8.0beta regression] gp_Trsf2d::SetMirror() looses transformation form
authornbv <nbv@opencascade.com>
Thu, 23 Oct 2014 14:02:23 +0000 (18:02 +0400)
committerifv <ifv@opencascade.com>
Mon, 24 Nov 2014 14:00:56 +0000 (17:00 +0300)
1. Elements of gp_TrsfForm have been documented
2. gp_Trsf2d class has been reverted to non-regression case.

Update of test-cases

Conflicts:
src/gp/gp.cdl
tests/de/iges_1/K3
tests/de/iges_2/B8
tests/de/iges_2/E6
tests/de/iges_2/G1

src/gp/gp.cdl
src/gp/gp_Trsf.cxx
src/gp/gp_Trsf2d.cxx

index 9b5070e3e1310333b4188777b5489cbb05ca29ed..490cfc2dd841786a21c0b2b8104f3f425a10ed0e 100644 (file)
@@ -5,8 +5,8 @@
 --
 -- This file is part of Open CASCADE Technology software library.
 --
--- This library is free software; you can redistribute it and / or modify it
--- under the terms of the GNU Lesser General Public version 2.1 as published
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
 -- by the Free Software Foundation, with special exception defined in the file
 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 -- distribution for complete text of the license and disclaimer of any warranty.
@@ -33,10 +33,27 @@ is
 
   exception VectorWithNullMagnitude inherits DomainError;
 
-  ---Purpose: Identifies the type of a geometric transformation.
   enumeration TrsfForm is 
-  Identity, Rotation, Translation, PntMirror, Ax1Mirror, Ax2Mirror, Scale, 
-  CompoundTrsf, Other;
+  Identity,
+    -- Transformation matrix is identity.
+  Rotation,
+    -- "Rotation" transformation was applied
+  Translation,
+    -- "Translation" with given vector or "from point - to point" was applied
+  PntMirror,
+    -- central symmetry
+  Ax1Mirror,
+    -- rotational symmetry
+  Ax2Mirror,
+    -- bilateral symmetry
+  Scale, 
+    -- "Scale" transformation was applied
+  CompoundTrsf,
+    -- All cases which is not enumerated here 
+  Other
+    -- Transformation with not-orthogonal matrix
+  end TrsfForm;
+  ---Purpose: Identifies the type of a geometric transformation.
 
   ---Purpose: Enumerates all 24 possible variants of generalized
   --          Euler angles, defining general 3d rotation by three 
@@ -88,126 +105,74 @@ is
   ;
 
   class XYZ;
-        --- Purpose : 3D Cartesian Coordinates {X, Y, Z}
 
   class Mat;
-        --- Purpose : Matrix 3*3
 
   class Quaternion;
-        --- Purpose : Quaternion representing 3d rotation
 
   class Trsf;
-        --- Purpose :
-        --  Elementary geometric transformation. This transformation never 
-        --  change the nature of the objects.
 
   class GTrsf;
-        --- Purpose :
-        --  General transformation. A GTrsf can be used only to transform
-        --  a point or a triplet of coordinates.
 
   class Pnt;
-        --- Purpose : Cartesian Point.
 
   class Vec;
-        --- Purpose : Vector.
 
   class Dir;
-        --- Purpose : Direction, it is an unitary vector.
 
   class Ax1;
-        --- Purpose : axis placement (Coordinate system -one axis)
 
   class Ax2;
-        --- Purpose :  axis  placement (Direct  Coordinate  system two
-        --  axis)
 
   class Ax3;
-        --- Purpose : axis placement  (Coordinate system two axis, can
-        --  be direct  or indirect)
 
   class Lin;
-        --- Purpose : Line.
 
   class Circ;
-        --- Purpose : Circle.
 
   class Elips;
-        --- Purpose : Ellipse.
 
   class Hypr;
-        --- Purpose : Hyperbola.
   
   class Parab;
-        --- Purpose : Parabola.
   
   class Pln;
-        --- Purpose : Plane.
 
   class Cylinder;
-        --- Purpose : Infinite cylindrical surface  .
   
   class Sphere;
-        --- Purpose : Spherical surface.  
   
   class Torus;
-        --- Purpose : Toroidal surface.  
   
   class Cone;
-        --- Purpose : Conical surface.
-
-
-
-
-        --- Purpose : Geometric entities for 2D.
-
-
 
   class XY;
-        --- Purpose : 2D cartesian Coordinates {X, Y}
 
   class Mat2d;
-        --- Purpose : Matrix 2*2
 
   class Trsf2d;
-        --- Purpose :
-        --  Elementary geometric transformation. This transformation never 
-        --  change the nature of the objects.
 
   class GTrsf2d;
-        --- Purpose :
-        --  General transformation. A GTrsf can be used only to transform
-        --  a point or a triplet of coordinates.
 
   class Pnt2d;
-        --- Purpose : Cartesian point.
 
   class Vec2d;
-        --- Purpose : Vector.
 
   class Dir2d;
-        --- Purpose : Direction, it is an unitary vector.
 
   class Ax2d;
-        --- Purpose : axis placement (Coordinate system - one axis)
 
   class Ax22d;
-        --- Purpose : axis placement (Coordinate system - two axis)
 
   class Lin2d;
-        --- Purpose : Line.
 
   class Circ2d;
-        --- Purpose : Circle.
 
   class Elips2d;
-        --- Purpose : Ellipse.
 
   class Hypr2d;
-        --- Purpose : Hyperbola.
 
   class Parab2d;
-        --- Purpose : Parabola.
   
 
 
index e1db13c63d33ff8a3289fb7677781ea139563c0a..b9004e02c9377df9a356fa9446ddf79194363419 100644 (file)
@@ -279,10 +279,10 @@ void gp_Trsf::SetScaleFactor (const Standard_Real S)
   scale = S;
   As = scale - 1.;
   if (As < 0) As = - As;
-  Standard_Boolean unit  = As <= gp::Resolution();
+  Standard_Boolean unit  = As <= gp::Resolution(); // = (scale == 1)
   As = scale + 1.;
   if (As < 0) As = - As;
-  Standard_Boolean munit = As <= gp::Resolution();
+  Standard_Boolean munit = As <= gp::Resolution(); // = (scale == -1)
   
   switch (shape) {
   case gp_Identity :
index e3f0a36654623a5d4f20a3fa45e26bd1ba87045b..0e6c6503b63118f6364c56f72f765181154e2614 100644 (file)
 void gp_Trsf2d::SetMirror (const gp_Ax2d& A)
 {
   shape = gp_Ax1Mirror;
+  scale = - 1.0;
   const gp_Dir2d& V = A.Direction ();
   const gp_Pnt2d& P = A.Location ();
   Standard_Real VX = V.X();
   Standard_Real VY = V.Y();
   Standard_Real X0 = P.X();
   Standard_Real Y0 = P.Y();
+  matrix.SetCol (1, gp_XY (1.0 - 2.0 * VX * VX, -2.0 * VX * VY));
+  matrix.SetCol (2, gp_XY (-2.0 * VX * VY, 1.0 - 2.0 * VY * VY));
 
-  SetValues(1.0-2.0*VX*VX, -2.0*VX*VY, -2.0*((VX * VX - 1.0)*X0 + (VX*VY*Y0)), 
-            -2.0*VX*VY, 1.0-2.0*VY*VY, -2.0*((VX*VY*X0)+(VY*VY-1.0)*Y0));
-
-  scale = - 1.0;
+  loc.SetCoord  (-2.0 * ((VX * VX - 1.0) * X0 + (VX * VY * Y0)),
+                 -2.0 * ((VX * VY * X0) + (VY * VY - 1.0) * Y0));
 }
 
 void gp_Trsf2d::SetTransformation (const gp_Ax2d& FromA1,
                                   const gp_Ax2d& ToA2)
 {
   shape = gp_CompoundTrsf;
+  scale = 1.0;
   //matrix from XOY to A2 :
   const gp_XY& V1 = ToA2.Direction().XY();
   gp_XY V2 (-V1.Y(), V1.X());
-
-  SetValues(V1.X(), V2.X(), ToA2.Location().X(),
-            V1.Y(), V2.Y(), ToA2.Location().Y());
-
-  scale = 1.0;
-
+  matrix.SetCol (1, V1);
+  matrix.SetCol (2, V2);
+  loc = ToA2.Location().XY();
   matrix.Transpose();
   loc.Multiply (matrix);
   loc.Reverse();
@@ -66,14 +65,12 @@ void gp_Trsf2d::SetTransformation (const gp_Ax2d& FromA1,
 void gp_Trsf2d::SetTransformation (const gp_Ax2d& A)
 {
   shape = gp_CompoundTrsf;
+  scale = 1.0;
   const gp_XY& V1 = A.Direction().XY();
   gp_XY V2 (-V1.Y(), V1.X());
-
-  SetValues(V1.X(), V2.X(), A.Location().X(),
-            V1.Y(), V2.Y(), A.Location().Y());
-
-  scale = 1.0;
-
+  matrix.SetCol (1, V1);
+  matrix.SetCol (2, V2);
+  loc = A.Location().XY();
   matrix.Transpose();
   loc.Multiply (matrix);
   loc.Reverse();