1 // Copyright (c) 1996-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 inline gp_Ax22d::gp_Ax22d() : vydir(0.,1.), vxdir(1.,0.)
18 inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P ,
25 Standard_Real value = Vx.Crossed(Vy);
26 if (value >= 0.0) vydir.SetCoord(-vxdir.Y(), vxdir.X());
27 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
30 inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P ,
32 const Standard_Boolean Sense) :
36 if (Sense) vydir.SetCoord(-Vx.Y(), Vx.X());
37 else vydir.SetCoord( Vx.Y(),-Vx.X());
40 inline gp_Ax22d::gp_Ax22d(const gp_Ax2d& A ,
41 const Standard_Boolean Sense) :
45 if (Sense) vydir.SetCoord(-vxdir.Y(), vxdir.X());
46 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
49 inline void gp_Ax22d::SetAxis(const gp_Ax22d& A1)
51 point = A1.Location();
52 vxdir = A1.XDirection();
53 vydir = A1.YDirection();
56 inline void gp_Ax22d::SetXAxis (const gp_Ax2d& A1)
58 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
59 point = A1.Location ();
60 vxdir = A1.Direction();
61 if (sign) vydir.SetCoord(-vxdir.Y(), vxdir.X());
62 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
65 inline void gp_Ax22d::SetYAxis (const gp_Ax2d& A1)
67 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
68 point = A1.Location ();
69 vydir = A1.Direction();
70 if (sign) vxdir.SetCoord( vydir.Y(),-vydir.X());
71 else vxdir.SetCoord(-vydir.Y(), vydir.X());
74 inline void gp_Ax22d::SetLocation (const gp_Pnt2d& P)
77 inline void gp_Ax22d::SetXDirection (const gp_Dir2d& Vx)
79 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
81 if (sign) vydir.SetCoord(-Vx.Y(), Vx.X());
82 else vydir.SetCoord( Vx.Y(),-Vx.X());
85 inline void gp_Ax22d::SetYDirection (const gp_Dir2d& Vy)
87 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
89 if (sign) vxdir.SetCoord( Vy.Y(),-Vy.X());
90 else vxdir.SetCoord(-Vy.Y(), Vy.X());
93 inline gp_Ax2d gp_Ax22d::XAxis () const
94 { return gp_Ax2d(point, vxdir); }
96 inline gp_Ax2d gp_Ax22d::YAxis () const
97 { return gp_Ax2d(point, vydir); }
99 inline const gp_Pnt2d& gp_Ax22d::Location () const
102 inline const gp_Dir2d& gp_Ax22d::XDirection () const
105 inline const gp_Dir2d& gp_Ax22d::YDirection () const
108 inline void gp_Ax22d::Rotate (const gp_Pnt2d& P,
109 const Standard_Real Ang)
111 gp_Pnt2d Temp = point;
118 inline gp_Ax22d gp_Ax22d::Rotated(const gp_Pnt2d& P,
119 const Standard_Real Ang) const
121 gp_Ax22d Temp = *this;
126 inline void gp_Ax22d::Scale (const gp_Pnt2d& P,
127 const Standard_Real S)
129 gp_Pnt2d Temp = point;
138 inline gp_Ax22d gp_Ax22d::Scaled(const gp_Pnt2d& P,
139 const Standard_Real S) const
141 gp_Ax22d Temp = *this;
146 inline void gp_Ax22d::Transform (const gp_Trsf2d& T)
148 gp_Pnt2d Temp = point;
155 inline gp_Ax22d gp_Ax22d::Transformed(const gp_Trsf2d& T) const
157 gp_Ax22d Temp = *this;
162 inline void gp_Ax22d::Translate (const gp_Vec2d& V)
163 { point.Translate (V); }
165 inline gp_Ax22d gp_Ax22d::Translated(const gp_Vec2d& V) const
167 gp_Ax22d Temp = *this;
171 inline void gp_Ax22d::Translate (const gp_Pnt2d& P1,const gp_Pnt2d& P2)
172 { point.Translate (P1, P2); }
174 inline gp_Ax22d gp_Ax22d::Translated (const gp_Pnt2d& P1,
175 const gp_Pnt2d& P2) const
177 gp_Ax22d Temp = *this;
178 Temp.Translate (P1, P2);