0024927: Getting rid of "Persistent" functionality -- Storable
[occt.git] / src / gp / gp_Ax22d.lxx
CommitLineData
b311480e 1// Copyright (c) 1996-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
15inline gp_Ax22d::gp_Ax22d() : vydir(0.,1.), vxdir(1.,0.)
16{}
17
18inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P ,
19 const gp_Dir2d& Vx,
20 const gp_Dir2d& Vy) :
21 point(P),
22 vydir(Vy),
23 vxdir(Vx)
24{
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());
28}
29
30inline gp_Ax22d::gp_Ax22d(const gp_Pnt2d& P ,
31 const gp_Dir2d& Vx ,
32 const Standard_Boolean Sense) :
33 point(P),
34 vxdir(Vx)
35{
36 if (Sense) vydir.SetCoord(-Vx.Y(), Vx.X());
37 else vydir.SetCoord( Vx.Y(),-Vx.X());
38}
39
40inline gp_Ax22d::gp_Ax22d(const gp_Ax2d& A ,
41 const Standard_Boolean Sense) :
42 point(A.Location()),
43 vxdir(A.Direction())
44{
45 if (Sense) vydir.SetCoord(-vxdir.Y(), vxdir.X());
46 else vydir.SetCoord( vxdir.Y(),-vxdir.X());
47}
48
49inline void gp_Ax22d::SetAxis(const gp_Ax22d& A1)
50{
51 point = A1.Location();
52 vxdir = A1.XDirection();
53 vydir = A1.YDirection();
54}
55
56inline void gp_Ax22d::SetXAxis (const gp_Ax2d& A1)
57{
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());
63}
64
65inline void gp_Ax22d::SetYAxis (const gp_Ax2d& A1)
66{
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());
72}
73
74inline void gp_Ax22d::SetLocation (const gp_Pnt2d& P)
75{ point = P; }
76
77inline void gp_Ax22d::SetXDirection (const gp_Dir2d& Vx)
78{
79 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
80 vxdir = Vx;
81 if (sign) vydir.SetCoord(-Vx.Y(), Vx.X());
82 else vydir.SetCoord( Vx.Y(),-Vx.X());
83}
84
85inline void gp_Ax22d::SetYDirection (const gp_Dir2d& Vy)
86{
87 Standard_Boolean sign = (vxdir.Crossed(vydir)) >= 0.0;
88 vydir = Vy;
89 if (sign) vxdir.SetCoord( Vy.Y(),-Vy.X());
90 else vxdir.SetCoord(-Vy.Y(), Vy.X());
91}
92
93inline gp_Ax2d gp_Ax22d::XAxis () const
94{ return gp_Ax2d(point, vxdir); }
95
96inline gp_Ax2d gp_Ax22d::YAxis () const
97{ return gp_Ax2d(point, vydir); }
98
99inline const gp_Pnt2d& gp_Ax22d::Location () const
100{ return point; }
101
102inline const gp_Dir2d& gp_Ax22d::XDirection () const
103{ return vxdir; }
104
105inline const gp_Dir2d& gp_Ax22d::YDirection () const
106{ return vydir; }
107
108inline void gp_Ax22d::Rotate (const gp_Pnt2d& P,
109 const Standard_Real Ang)
110{
111 gp_Pnt2d Temp = point;
112 Temp.Rotate (P,Ang);
113 point = Temp;
114 vxdir.Rotate (Ang);
115 vydir.Rotate (Ang);
116}
117
118inline gp_Ax22d gp_Ax22d::Rotated(const gp_Pnt2d& P,
119 const Standard_Real Ang) const
120{
121 gp_Ax22d Temp = *this;
122 Temp.Rotate (P,Ang);
123 return Temp;
124}
125
126inline void gp_Ax22d::Scale (const gp_Pnt2d& P,
127 const Standard_Real S)
128{
129 gp_Pnt2d Temp = point;
130 Temp.Scale (P, S);
131 point = Temp;
132 if (S < 0.0) {
133 vxdir.Reverse ();
134 vydir.Reverse ();
135 }
136}
137
138inline gp_Ax22d gp_Ax22d::Scaled(const gp_Pnt2d& P,
139 const Standard_Real S) const
140{
141 gp_Ax22d Temp = *this;
142 Temp.Scale (P, S);
143 return Temp;
144}
145
146inline void gp_Ax22d::Transform (const gp_Trsf2d& T)
147{
148 gp_Pnt2d Temp = point;
149 Temp.Transform (T);
150 point = Temp;
151 vxdir.Transform (T);
152 vydir.Transform (T);
153}
154
155inline gp_Ax22d gp_Ax22d::Transformed(const gp_Trsf2d& T) const
156{
157 gp_Ax22d Temp = *this;
158 Temp.Transform (T);
159 return Temp;
160}
161
162inline void gp_Ax22d::Translate (const gp_Vec2d& V)
163{ point.Translate (V); }
164
165inline gp_Ax22d gp_Ax22d::Translated(const gp_Vec2d& V) const
166{
167 gp_Ax22d Temp = *this;
168 Temp.Translate (V);
169 return Temp;
170}
171inline void gp_Ax22d::Translate (const gp_Pnt2d& P1,const gp_Pnt2d& P2)
172{ point.Translate (P1, P2); }
173
174inline gp_Ax22d gp_Ax22d::Translated (const gp_Pnt2d& P1,
175 const gp_Pnt2d& P2) const
176{
177 gp_Ax22d Temp = *this;
178 Temp.Translate (P1, P2);
179 return Temp;
180}
181