1 // Copyright (C) 2015-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include <GEOMUtils_Trsf2d.hxx>
24 //=======================================================================
27 //=======================================================================
28 GEOMUtils::Trsf2d::Trsf2d(const Standard_Real a11,
29 const Standard_Real a12,
30 const Standard_Real a13,
31 const Standard_Real a21,
32 const Standard_Real a22,
33 const Standard_Real a23)
43 //=======================================================================
44 //function : TransformD0
46 //=======================================================================
47 void GEOMUtils::Trsf2d::TransformD0(gp_Pnt2d &thePnt) const
49 const Standard_Real aX = myA11*thePnt.X() + myA12*thePnt.Y() + myA13;
50 const Standard_Real aY = myA21*thePnt.X() + myA22*thePnt.Y() + myA23;
52 thePnt.SetCoord(aX, aY);
55 //=======================================================================
56 //function : TransformD1
58 //=======================================================================
59 void GEOMUtils::Trsf2d::TransformD1(gp_Pnt2d &thePnt,
60 gp_Vec2d &theVec1) const
62 TransformVector(thePnt, theVec1);
66 //=======================================================================
67 //function : TransformD2
69 //=======================================================================
70 void GEOMUtils::Trsf2d::TransformD2(gp_Pnt2d &thePnt,
72 gp_Vec2d &theVec2) const
74 TransformVector(thePnt, theVec1);
75 TransformVector(thePnt, theVec2);
79 //=======================================================================
80 //function : TransformD3
82 //=======================================================================
83 void GEOMUtils::Trsf2d::TransformD3(gp_Pnt2d &thePnt,
86 gp_Vec2d &theVec3) const
88 TransformVector(thePnt, theVec1);
89 TransformVector(thePnt, theVec2);
90 TransformVector(thePnt, theVec3);
94 //=======================================================================
95 //function : TransformVector
97 //=======================================================================
98 void GEOMUtils::Trsf2d::TransformVector(const gp_Pnt2d &thePnt,
99 gp_Vec2d &theVec) const
101 gp_Pnt2d aP0(thePnt.XY());
102 gp_Pnt2d aP1(thePnt.XY().Added(theVec.XY()));
106 theVec.SetXY(aP1.XY().Subtracted(aP0.XY()));