Code_TYMPAN  4.4.0
Industrial site acoustic simulation
plan.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2014> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #ifndef TY_MC_PLAN
17 #define TY_MC_PLAN
18 
19 #include <ostream>
20 #include <deque>
21 
23 
30 class OPlan
31 {
32  // Methods
33 public:
37  OPlan();
38 
44  OPlan(const OPlan& plan);
45 
54  OPlan(double a, double b, double c, double d);
55 
70  OPlan(const OPoint3D& pt1, const OPoint3D& pt2, const OPoint3D& pt3);
71 
84  OPlan(const OPoint3D& pt, const OVector3D& normale);
85 
89  virtual ~OPlan();
90 
96  OPlan& operator=(const OPlan& plan);
97 
103  bool operator==(const OPlan& plan) const;
104 
110  bool operator!=(const OPlan& plan) const;
111 
121  void set(double a, double b, double c, double d);
122 
138  void set(const OPoint3D& pt1, const OPoint3D& pt2, const OPoint3D& pt3);
139 
154  void set(const OPoint3D& pt, const OVector3D& normale);
155 
190  int intersectsSegment(const OPoint3D& pt1, const OPoint3D& pt2, OPoint3D& ptIntersec) const;
191 
204  int intersectsDroite(const OPoint3D& pt, const OVector3D& vector, OPoint3D& ptIntersec);
205 
217  int intersectsPlan(const OPlan& plan, OVector3D& vectorIntersec);
218 
223  int intersectsSurface(const TabPoint3D& contour, OSegment3D& segment) const;
224 
229  bool isInPlan(const OPoint3D& pt);
230 
241  bool is_valid();
242  bool is_null();
243  bool is_NaN();
244 
253  double angle(const OPlan& plan);
254 
263  double distance(const OPoint3D& pt);
264 
269  OPoint3D symPtPlan(const OPoint3D& pt);
270 
275  OPoint3D projPtPlan(const OPoint3D& pt);
276 
287  bool distancePlanParallel(const OPlan& plan, double& distance);
288 
298  bool isParallel(const OPlan& plan);
299 
309  bool isOrthogonal(const OPlan& plan);
310 
311 protected:
320  void update_explicit_repr(OVector3D hint = OVector3D(1, 1, 1));
321 
322  // Members
323 public:
325  double _a;
327  double _b;
329  double _c;
331  double _d;
332  // Redundant but explicit representation : the base vectors
334 };
335 
336 ::std::ostream& operator<<(::std::ostream& os, const OPlan& p);
337 
338 #endif // TY_MC_PLAN
All base classes related to 3D manipulation.
std::vector< OPoint3D > TabPoint3D
Definition: 3d.h:483
NxReal c
Definition: NxVec3.cpp:317
std::pair< unsigned int, unsigned int > segment
Plan defined by its equation : ax+by+cz+d=0.
Definition: plan.h:31
int intersectsSegment(const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec) const
Calculate the intersection of this plane with a segment defined by two points.
Definition: plan.cpp:141
double _a
The a parameter in the equation ax+by+cz+d=0.
Definition: plan.h:325
double distance(const OPoint3D &pt)
Calculation of the minimal distance between a point and this plane.
Definition: plan.cpp:371
double _c
The c parameter in the equation ax+by+cz+d=0.
Definition: plan.h:329
bool operator!=(const OPlan &plan) const
The inequality operator.
Definition: plan.cpp:89
double _d
The d parameter in the equation ax+by+cz+d=0.
Definition: plan.h:331
bool isInPlan(const OPoint3D &pt)
Check if a point belongs to a plane.
Definition: plan.cpp:235
virtual ~OPlan()
Destructor.
Definition: plan.cpp:51
bool is_NaN()
Definition: plan.cpp:127
bool operator==(const OPlan &plan) const
The equality operator.
Definition: plan.cpp:65
void update_explicit_repr(OVector3D hint=OVector3D(1, 1, 1))
updates the implicit representation of the plane
Definition: plan.cpp:446
bool isOrthogonal(const OPlan &plan)
Check if this plan is perpendicular to another plan.
Definition: plan.cpp:437
ORepere3D rframe
Definition: plan.h:333
OPlan()
Default constructor With a=b=c=d=0.
Definition: plan.cpp:25
double _b
The b parameter in the equation ax+by+cz+d=0.
Definition: plan.h:327
double angle(const OPlan &plan)
Calculation of the angle between this plane and another plane.
Definition: plan.cpp:363
OPoint3D projPtPlan(const OPoint3D &pt)
Calculate the projection of a point on the plane.
Definition: plan.cpp:396
bool isParallel(const OPlan &plan)
Check if this plane is parallel with another plane.
Definition: plan.cpp:422
void set(double a, double b, double c, double d)
Sets a, b, c and d parameters directly.
Definition: plan.cpp:94
bool distancePlanParallel(const OPlan &plan, double &distance)
Calculate the distance between this plan and another parallel plane.
Definition: plan.cpp:410
int intersectsSurface(const TabPoint3D &contour, OSegment3D &segment) const
Compute intersection between a plan and a surface defined by his bounds.
Definition: plan.cpp:323
int intersectsPlan(const OPlan &plan, OVector3D &vectorIntersec)
Calculate the intersection of this plane with another plane.
Definition: plan.cpp:275
int intersectsDroite(const OPoint3D &pt, const OVector3D &vector, OPoint3D &ptIntersec)
Calculate the intersection of this plane with a line defined by a point and a vector.
Definition: plan.cpp:251
bool is_valid()
Check whether the plane is valid.
Definition: plan.cpp:133
bool is_null()
Definition: plan.cpp:122
OPlan & operator=(const OPlan &plan)
Assignment operator.
Definition: plan.cpp:53
OPoint3D symPtPlan(const OPoint3D &pt)
Calculate the symmetrical of a point relative to the plane.
Definition: plan.cpp:376
The 3D point class.
Definition: 3d.h:487
3D frame with a point and 3 vectors.
Definition: 3d.h:1211
Class to define a segment.
Definition: 3d.h:1089
The 3D vector class.
Definition: 3d.h:298
::std::ostream & operator<<(::std::ostream &os, const OPlan &p)
Definition: plan.cpp:483