37048626a237681a6ae59d3fbccfd377f8eb1e25
[occt.git] / src / gp / gp_Ax2d.lxx
1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 // Modif jcv 08/01/1991
16 // JCV, LPA 07/92
17
18 #include <gp_Ax2d.hxx>
19
20 inline gp_Ax2d::gp_Ax2d()
21   :
22   loc(0.,0.)
23   //vdir(1.,0.) use default ctor of gp_Dir2d, as it creates the same dir (1,0)
24 { }
25
26 inline gp_Ax2d::gp_Ax2d (const gp_Pnt2d& P,
27                          const gp_Dir2d& V) : loc(P), vdir(V)
28 { }
29
30 inline void gp_Ax2d::SetLocation(const gp_Pnt2d& P)
31 { loc = P; }
32
33 inline void gp_Ax2d::SetDirection(const gp_Dir2d& V)
34 { vdir = V; }
35
36 inline const gp_Pnt2d& gp_Ax2d::Location () const
37 { return loc; }
38
39 inline const gp_Dir2d& gp_Ax2d::Direction () const
40 { return vdir; }
41
42 inline Standard_Boolean gp_Ax2d::IsNormal
43 (const gp_Ax2d& Other,
44  const Standard_Real AngularTolerance) const
45 { return vdir.IsNormal(Other.vdir, AngularTolerance); }
46
47 inline Standard_Boolean gp_Ax2d::IsOpposite
48 (const gp_Ax2d& Other,
49  const Standard_Real AngularTolerance) const
50 { return vdir.IsOpposite (Other.vdir, AngularTolerance); }
51
52 inline Standard_Boolean gp_Ax2d::IsParallel
53 (const gp_Ax2d& Other,
54  const Standard_Real AngularTolerance) const
55 { return vdir.IsParallel(Other.vdir, AngularTolerance); }
56
57 inline   Standard_Real gp_Ax2d::Angle (const gp_Ax2d& Other) const
58 { return vdir.Angle (Other.vdir); }
59
60 inline void gp_Ax2d::Reverse()
61 { vdir.Reverse(); }
62
63 inline gp_Ax2d gp_Ax2d::Reversed() const
64
65   gp_Ax2d Temp = *this;
66   Temp.Reverse ();
67   return Temp;
68 }
69
70 inline void gp_Ax2d::Rotate (const gp_Pnt2d& P,
71                              const Standard_Real Ang)
72 {
73   loc.Rotate (P, Ang);
74   vdir.Rotate (Ang);
75 }
76
77 inline gp_Ax2d gp_Ax2d::Rotated (const gp_Pnt2d& P,
78                                  const Standard_Real Ang) const
79 {
80   gp_Ax2d A = *this;
81   A.Rotate (P, Ang);
82   return A;
83 }
84
85 inline gp_Ax2d gp_Ax2d::Scaled (const gp_Pnt2d& P,
86                                 const Standard_Real S) const
87 {
88   gp_Ax2d A = *this;
89   A.Scale (P, S);
90   return A;
91 }
92
93 inline void gp_Ax2d::Transform (const gp_Trsf2d& T)
94 {
95   loc.Transform  (T);
96   vdir.Transform (T);
97 }
98
99 inline gp_Ax2d gp_Ax2d::Transformed (const gp_Trsf2d& T) const
100 {
101   gp_Ax2d A = *this;
102   A.Transform (T);
103   return A;
104 }
105
106 inline void gp_Ax2d::Translate (const gp_Vec2d& V)
107 { loc.Translate (V); }
108
109 inline gp_Ax2d gp_Ax2d::Translated (const gp_Vec2d& V) const
110 {
111   gp_Ax2d A = *this;
112   (A.loc).Translate (V); 
113   return A;
114 }
115
116 inline void gp_Ax2d::Translate (const gp_Pnt2d& P1,
117                                 const gp_Pnt2d& P2)
118 { loc.Translate (P1,P2); }
119
120 inline gp_Ax2d gp_Ax2d::Translated (const gp_Pnt2d& P1,
121                                     const gp_Pnt2d& P2) const
122 {
123   gp_Ax2d A = *this;
124   (A.loc).Translate( gp_Vec2d (P1, P2));
125   return A;
126 }
127