OpenLexocad  28.0
Ax2.h
Go to the documentation of this file.
1 //
3 // Copyright(C) 2013-2016 OpenCascade [www.opencascade.org]
4 //
5 // This library is free software; you can redistribute it and / or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street,
18 // Fifth Floor, Boston, MA 02110 - 1301 USA
19 //
21 
22 #pragma once
23 
24 #include <Geom/Ax1.h>
25 
26 namespace Geom
27 {
28 class Pnt;
29 class Trsf;
30 class Vec;
31 
32 } // namespace Geom
33 
34 namespace Geom
35 {
64 
65 class LX_GEOM_EXPORT Ax2
66 {
67 public:
69  // //
70  // --------------------- BEGIN API --------------------- //
71  // //
72  // ATTENTION: DO NOT CHANGE ANY SIGNATURES IN THE API ! //
73  // //
75 
76  // Methods PUBLIC
77  //
79  Ax2() = default;
80 
87  Ax2(const Geom::Pnt& P, const Geom::Dir& N, const Geom::Dir& Vx);
88 
89 
93  Ax2(const Geom::Pnt& P, const Geom::Dir& V);
94 
95  Ax2(const Geom::Pnt& aP, const Geom::Dir& aZDir, const Geom::Dir& aYDir, const Geom::Dir& aXDir);
96 
105  void setAxis(const Geom::Ax1& A1);
106 
107 
115  void setDirection(const Geom::Dir& V);
116 
117 
119  void setLocation(const Geom::Pnt& P);
120 
121 
129  void setXDirection(const Geom::Dir& Vx);
130 
131 
140  void setYDirection(const Geom::Dir& Vy);
141 
142 
146  double angle(const Ax2& Other) const;
147 
150  const Geom::Ax1& axis() const;
151 
153  const Geom::Dir& direction() const;
154 
156  const Geom::Pnt& location() const;
157 
159  const Geom::Dir& xDirection() const;
160 
162  const Geom::Dir& yDirection() const;
163 
164 
165  bool isCoplanar(const Ax2& Other, const double LinearTolerance, const double AngularTolerance) const;
166 
172  bool isCoplanar(const Geom::Ax1& A1, const double LinearTolerance, const double AngularTolerance) const;
173 
174 
190  void mirror(const Geom::Pnt& P);
191 
192 
208  Ax2 mirrored(const Geom::Pnt& P) const;
209 
210 
226  void mirror(const Geom::Ax1& A1);
227 
228 
244  Ax2 mirrored(const Geom::Ax1& A1) const;
245 
246 
263  void mirror(const Ax2& A2);
264 
265 
282  Ax2 mirrored(const Ax2& A2) const;
283 
284  void rotate(const Geom::Ax1& A1, const double Ang);
285 
289  Ax2 rotated(const Geom::Ax1& A1, const double Ang) const;
290 
291  void scale(const Geom::Pnt& P, const double S);
292 
300  Ax2 scaled(const Geom::Pnt& P, const double S) const;
301 
302  void transform(const Geom::Trsf& T);
303 
309  Ax2 transformed(const Geom::Trsf& T) const;
310 
311  void translate(const Geom::Vec& V);
312 
315  Ax2 translated(const Geom::Vec& V) const;
316 
317  void translate(const Geom::Pnt& P1, const Geom::Pnt& P2);
318 
321  Ax2 translated(const Geom::Pnt& P1, const Geom::Pnt& P2) const;
322 
324  // //
325  // ---------------------- END API ---------------------- //
326  // //
328 
329 
330  bool isEqual(const Ax2& Other, const double tolerance) const;
331 
332 
333 private:
334  Ax1 myaxis = Ax1({0, 0, 0}, {0, 0, 1});
335  Dir vydir = Dir(XYZ{0, 1, 0});
336  Dir vxdir = Dir(XYZ{1, 0, 0});
337 };
338 
339 } // namespace Geom
Geom::Ax2::Ax2
Ax2(const Geom::Pnt &P, const Geom::Dir &N, const Geom::Dir &Vx)
Geom::Ax2::setXDirection
void setXDirection(const Geom::Dir &Vx)
Geom::Ax2::axis
const Geom::Ax1 & axis() const
Geom::Ax2::setLocation
void setLocation(const Geom::Pnt &P)
Changes the "Location" point (origin) of <me>.
Ax1.h
Geom::Vec
Defines a non-persistent vector in 3D space.
Definition: Vec.h:41
Geom::Ax2::location
const Geom::Pnt & location() const
Returns the "Location" point (origin) of <me>.
Geom::Ax2::translate
void translate(const Geom::Vec &V)
Geom::Ax2::Ax2
Ax2(const Geom::Pnt &P, const Geom::Dir &V)
Geom::Ax2::translated
Ax2 translated(const Geom::Pnt &P1, const Geom::Pnt &P2) const
Geom::Ax2::mirror
void mirror(const Geom::Ax1 &A1)
Geom::Ax2::setYDirection
void setYDirection(const Geom::Dir &Vy)
Geom::Ax2::isCoplanar
bool isCoplanar(const Ax2 &Other, const double LinearTolerance, const double AngularTolerance) const
Geom::Ax1
Definition: Ax1.h:50
Geom::Ax2::mirrored
Ax2 mirrored(const Geom::Ax1 &A1) const
Geom::Ax2::mirror
void mirror(const Geom::Pnt &P)
Geom::Ax2::mirrored
Ax2 mirrored(const Ax2 &A2) const
Geom::Ax2::transform
void transform(const Geom::Trsf &T)
Geom::Dir
Definition: Dir.h:45
Geom::Ax2::rotated
Ax2 rotated(const Geom::Ax1 &A1, const double Ang) const
Geom::Ax2::mirrored
Ax2 mirrored(const Geom::Pnt &P) const
Geom::Ax2::Ax2
Ax2()=default
Creates an indefinite coordinate system.
Geom::Ax2::yDirection
const Geom::Dir & yDirection() const
Returns the "YDirection" of <me>.
Geom::Ax2::angle
double angle(const Ax2 &Other) const
Geom::Ax2::direction
const Geom::Dir & direction() const
Returns the main direction of <me>.
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Geom::Ax2
Definition: Ax2.h:66
Geom::Ax2::xDirection
const Geom::Dir & xDirection() const
Returns the "XDirection" of <me>.
Geom::Ax2::isEqual
bool isEqual(const Ax2 &Other, const double tolerance) const
Geom::Ax2::isCoplanar
bool isCoplanar(const Geom::Ax1 &A1, const double LinearTolerance, const double AngularTolerance) const
Geom::Ax2::transformed
Ax2 transformed(const Geom::Trsf &T) const
Geom::Ax2::translate
void translate(const Geom::Pnt &P1, const Geom::Pnt &P2)
Geom::Ax2::Ax2
Ax2(const Geom::Pnt &aP, const Geom::Dir &aZDir, const Geom::Dir &aYDir, const Geom::Dir &aXDir)
Geom::Ax2::setDirection
void setDirection(const Geom::Dir &V)
Geom::Ax2::setAxis
void setAxis(const Geom::Ax1 &A1)
Geom::Trsf
Definition: Trsf.h:58
Geom::Ax2::scale
void scale(const Geom::Pnt &P, const double S)
Geom::Ax2::mirror
void mirror(const Ax2 &A2)
Geom::Ax2::translated
Ax2 translated(const Geom::Vec &V) const
Geom::Ax2::scaled
Ax2 scaled(const Geom::Pnt &P, const double S) const
Geom::Ax2::rotate
void rotate(const Geom::Ax1 &A1, const double Ang)
Geom
Definition: PropertyContainer.h:33