--
-- 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.
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
;
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.
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();
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();