1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include <GEOMUtils_Trsf2d.hxx>
27 //=======================================================================
30 //=======================================================================
31 GEOMUtils::Trsf2d::Trsf2d(const Standard_Real a11,
32 const Standard_Real a12,
33 const Standard_Real a13,
34 const Standard_Real a21,
35 const Standard_Real a22,
36 const Standard_Real a23)
46 //=======================================================================
47 //function : TransformD0
49 //=======================================================================
50 void GEOMUtils::Trsf2d::TransformD0(gp_Pnt2d &thePnt) const
52 const Standard_Real aX = myA11*thePnt.X() + myA12*thePnt.Y() + myA13;
53 const Standard_Real aY = myA21*thePnt.X() + myA22*thePnt.Y() + myA23;
55 thePnt.SetCoord(aX, aY);
58 //=======================================================================
59 //function : TransformD1
61 //=======================================================================
62 void GEOMUtils::Trsf2d::TransformD1(gp_Pnt2d &thePnt,
63 gp_Vec2d &theVec1) const
65 TransformVector(thePnt, theVec1);
69 //=======================================================================
70 //function : TransformD2
72 //=======================================================================
73 void GEOMUtils::Trsf2d::TransformD2(gp_Pnt2d &thePnt,
75 gp_Vec2d &theVec2) const
77 TransformVector(thePnt, theVec1);
78 TransformVector(thePnt, theVec2);
82 //=======================================================================
83 //function : TransformD3
85 //=======================================================================
86 void GEOMUtils::Trsf2d::TransformD3(gp_Pnt2d &thePnt,
89 gp_Vec2d &theVec3) const
91 TransformVector(thePnt, theVec1);
92 TransformVector(thePnt, theVec2);
93 TransformVector(thePnt, theVec3);
97 //=======================================================================
98 //function : TransformVector
100 //=======================================================================
101 void GEOMUtils::Trsf2d::TransformVector(const gp_Pnt2d &thePnt,
102 gp_Vec2d &theVec) const
104 gp_Pnt2d aP0(thePnt.XY());
105 gp_Pnt2d aP1(thePnt.XY().Added(theVec.XY()));
109 theVec.SetXY(aP1.XY().Subtracted(aP0.XY()));