0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / gp / gp_Ax1.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 // JCV, LPA 07/92
16
17 inline gp_Ax1::gp_Ax1() : loc(0.,0.,0.), vdir(0.,0.,1.)
18 { }
19
20 inline gp_Ax1::gp_Ax1 (const gp_Pnt& P,
21                        const gp_Dir& V) :  loc(P), vdir(V)
22 { }
23
24 inline void gp_Ax1::SetDirection (const gp_Dir& V)
25 { vdir = V; }
26
27 inline void gp_Ax1::SetLocation (const gp_Pnt& P)
28 { loc = P; }
29
30 inline const gp_Dir& gp_Ax1::Direction () const
31 { return vdir; }
32
33 inline const gp_Pnt& gp_Ax1::Location () const
34 { return loc; }
35
36 inline Standard_Boolean gp_Ax1::IsNormal
37 (const gp_Ax1& Other,
38  const Standard_Real AngularTolerance) const
39 { return vdir.IsNormal(Other.vdir, AngularTolerance); }
40
41 inline Standard_Boolean gp_Ax1::IsOpposite
42 (const gp_Ax1& Other,
43  const Standard_Real AngularTolerance) const
44 { return vdir.IsOpposite(Other.vdir, AngularTolerance); }
45
46 inline Standard_Boolean gp_Ax1::IsParallel
47 (const gp_Ax1& Other,
48  const Standard_Real AngularTolerance) const
49 { return vdir.IsParallel(Other.vdir, AngularTolerance); }
50
51 inline Standard_Real gp_Ax1::Angle (const gp_Ax1& Other) const
52 { return vdir.Angle (Other.vdir); }
53
54 inline void gp_Ax1::Reverse ()
55 { vdir.Reverse(); }
56
57 inline gp_Ax1 gp_Ax1::Reversed () const
58
59   gp_Dir D = vdir.Reversed();   
60   return gp_Ax1(loc, D);
61 }
62
63 inline void gp_Ax1::Rotate (const gp_Ax1& A1, const Standard_Real Ang)
64 {
65   loc.Rotate(A1, Ang);
66   vdir.Rotate(A1 , Ang);
67 }
68  
69 inline gp_Ax1 gp_Ax1::Rotated (const gp_Ax1& A1,
70                         const Standard_Real Ang) const
71 {
72   gp_Ax1 A = *this;
73   A.Rotate (A1, Ang);
74   return A;
75 }
76
77 inline void gp_Ax1::Scale (const gp_Pnt& P,
78                     const Standard_Real S)
79 {
80   loc.Scale (P, S);
81   if (S < 0.0)  vdir.Reverse();
82 }
83
84 inline gp_Ax1 gp_Ax1::Scaled (const gp_Pnt& P,
85                        const Standard_Real S) const
86 {
87   gp_Ax1 A1 = *this;
88   A1.Scale (P, S);
89   return A1;
90 }
91
92 inline void gp_Ax1::Transform (const gp_Trsf& T)
93
94    loc.Transform(T); 
95    vdir.Transform(T);
96 }
97
98 inline gp_Ax1 gp_Ax1::Transformed (const gp_Trsf& T) const
99 {
100   gp_Ax1 A1 = *this;
101   A1.Transform (T);
102   return A1;
103 }
104
105 inline void gp_Ax1::Translate (const gp_Vec& V)
106 { loc.Translate (V); }
107
108 inline gp_Ax1 gp_Ax1::Translated (const gp_Vec& V) const
109 {
110   gp_Ax1 A1 = *this;
111   (A1.loc).Translate (V); 
112   return A1;
113 }
114
115 inline void gp_Ax1::Translate (const gp_Pnt& P1,
116                                const gp_Pnt& P2)
117 {
118   loc.Translate (P1, P2);
119 }
120
121 inline gp_Ax1 gp_Ax1::Translated (const gp_Pnt& P1,
122                            const gp_Pnt& P2) const
123 {
124   gp_Ax1 A1 = *this;
125   (A1.loc).Translate (P1, P2);
126   return A1;
127 }
128