From b11453f54f093085ac05ad38ca72217c28556017 Mon Sep 17 00:00:00 2001 From: nbv Date: Thu, 23 Oct 2014 18:02:23 +0400 Subject: [PATCH] 0025374: [6.8.0beta regression] gp_Trsf2d::SetMirror() looses transformation form 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 | 79 ++++++++++++-------------------------------- src/gp/gp_Trsf.cxx | 4 +-- src/gp/gp_Trsf2d.cxx | 29 ++++++++-------- 3 files changed, 37 insertions(+), 75 deletions(-) diff --git a/src/gp/gp.cdl b/src/gp/gp.cdl index 9b5070e3e1..490cfc2dd8 100644 --- a/src/gp/gp.cdl +++ b/src/gp/gp.cdl @@ -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. diff --git a/src/gp/gp_Trsf.cxx b/src/gp/gp_Trsf.cxx index e1db13c63d..b9004e02c9 100644 --- a/src/gp/gp_Trsf.cxx +++ b/src/gp/gp_Trsf.cxx @@ -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 : diff --git a/src/gp/gp_Trsf2d.cxx b/src/gp/gp_Trsf2d.cxx index e3f0a36654..0e6c6503b6 100644 --- a/src/gp/gp_Trsf2d.cxx +++ b/src/gp/gp_Trsf2d.cxx @@ -23,32 +23,31 @@ 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(); -- 2.39.5