1 // Copyright (c) 1996-1999 Matra Datavision
2 // Copyright (c) 1999-2012 OPEN CASCADE SAS
4 // The content of this file is subject to the Open CASCADE Technology Public
5 // License Version 6.5 (the "License"). You may not use the content of this file
6 // except in compliance with the License. Please obtain a copy of the License
7 // at http://www.opencascade.org and read it completely before using this file.
9 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 // The Original Code and all software distributed under the License is
13 // distributed on an "AS IS" basis, without warranty of any kind, and the
14 // Initial Developer hereby disclaims all such warranties, including without
15 // limitation, any warranties of merchantability, fitness for a particular
16 // purpose or non-infringement. Please see the License for the specific terms
17 // and conditions governing the rights and limitations under the License.
21 inline gp_Ax22d::gp_Ax22d() : vydir(0.,1.), vxdir(1.,0.)
24 inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P ,
31 Standard_Real value = Vx.Crossed(Vy);
32 if (value >= 0.0) vydir.SetCoord(-vxdir.Y(), vxdir.X());
33 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
36 inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P ,
38 const Standard_Boolean Sense) :
42 if (Sense) vydir.SetCoord(-Vx.Y(), Vx.X());
43 else vydir.SetCoord( Vx.Y(),-Vx.X());
46 inline gp_Ax22d::gp_Ax22d(const gp_Ax2d& A ,
47 const Standard_Boolean Sense) :
51 if (Sense) vydir.SetCoord(-vxdir.Y(), vxdir.X());
52 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
55 inline void gp_Ax22d::SetAxis(const gp_Ax22d& A1)
57 point = A1.Location();
58 vxdir = A1.XDirection();
59 vydir = A1.YDirection();
62 inline void gp_Ax22d::SetXAxis (const gp_Ax2d& A1)
64 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
65 point = A1.Location ();
66 vxdir = A1.Direction();
67 if (sign) vydir.SetCoord(-vxdir.Y(), vxdir.X());
68 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
71 inline void gp_Ax22d::SetYAxis (const gp_Ax2d& A1)
73 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
74 point = A1.Location ();
75 vydir = A1.Direction();
76 if (sign) vxdir.SetCoord( vydir.Y(),-vydir.X());
77 else vxdir.SetCoord(-vydir.Y(), vydir.X());
80 inline void gp_Ax22d::SetLocation (const gp_Pnt2d& P)
83 inline void gp_Ax22d::SetXDirection (const gp_Dir2d& Vx)
85 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
87 if (sign) vydir.SetCoord(-Vx.Y(), Vx.X());
88 else vydir.SetCoord( Vx.Y(),-Vx.X());
91 inline void gp_Ax22d::SetYDirection (const gp_Dir2d& Vy)
93 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
95 if (sign) vxdir.SetCoord( Vy.Y(),-Vy.X());
96 else vxdir.SetCoord(-Vy.Y(), Vy.X());
99 inline gp_Ax2d gp_Ax22d::XAxis () const
100 { return gp_Ax2d(point, vxdir); }
102 inline gp_Ax2d gp_Ax22d::YAxis () const
103 { return gp_Ax2d(point, vydir); }
105 inline const gp_Pnt2d& gp_Ax22d::Location () const
108 inline const gp_Dir2d& gp_Ax22d::XDirection () const
111 inline const gp_Dir2d& gp_Ax22d::YDirection () const
114 inline void gp_Ax22d::Rotate (const gp_Pnt2d& P,
115 const Standard_Real Ang)
117 gp_Pnt2d Temp = point;
124 inline gp_Ax22d gp_Ax22d::Rotated(const gp_Pnt2d& P,
125 const Standard_Real Ang) const
127 gp_Ax22d Temp = *this;
132 inline void gp_Ax22d::Scale (const gp_Pnt2d& P,
133 const Standard_Real S)
135 gp_Pnt2d Temp = point;
144 inline gp_Ax22d gp_Ax22d::Scaled(const gp_Pnt2d& P,
145 const Standard_Real S) const
147 gp_Ax22d Temp = *this;
152 inline void gp_Ax22d::Transform (const gp_Trsf2d& T)
154 gp_Pnt2d Temp = point;
161 inline gp_Ax22d gp_Ax22d::Transformed(const gp_Trsf2d& T) const
163 gp_Ax22d Temp = *this;
168 inline void gp_Ax22d::Translate (const gp_Vec2d& V)
169 { point.Translate (V); }
171 inline gp_Ax22d gp_Ax22d::Translated(const gp_Vec2d& V) const
173 gp_Ax22d Temp = *this;
177 inline void gp_Ax22d::Translate (const gp_Pnt2d& P1,const gp_Pnt2d& P2)
178 { point.Translate (P1, P2); }
180 inline gp_Ax22d gp_Ax22d::Translated (const gp_Pnt2d& P1,
181 const gp_Pnt2d& P2) const
183 gp_Ax22d Temp = *this;
184 Temp.Translate (P1, P2);