Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
OPlan Class Reference

Plan defined by its equation : ax+by+cz+d=0. More...

#include <plan.h>

Collaboration diagram for OPlan:
Collaboration graph
[legend]

Public Member Functions

 OPlan ()
 Default constructor With a=b=c=d=0. More...
 
 OPlan (const OPlan &plan)
 Copy constructor. More...
 
 OPlan (double a, double b, double c, double d)
 Constructor with the a, b, c and d parameters. More...
 
 OPlan (const OPoint3D &pt1, const OPoint3D &pt2, const OPoint3D &pt3)
 Constructs a new plan from 3 points. More...
 
 OPlan (const OPoint3D &pt, const OVector3D &normale)
 Constructs a new plan from 1 point and a normal. More...
 
virtual ~OPlan ()
 Destructor. More...
 
OPlanoperator= (const OPlan &plan)
 Assignment operator. More...
 
bool operator== (const OPlan &plan) const
 The equality operator. More...
 
bool operator!= (const OPlan &plan) const
 The inequality operator. More...
 
void set (double a, double b, double c, double d)
 Sets a, b, c and d parameters directly. More...
 
void set (const OPoint3D &pt1, const OPoint3D &pt2, const OPoint3D &pt3)
 Sets with 3 points. More...
 
void set (const OPoint3D &pt, const OVector3D &normale)
 Sets with 1 point and a normal. More...
 
int intersectsSegment (const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec) const
 Calculate the intersection of this plane with a segment defined by two points. More...
 
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. More...
 
int intersectsPlan (const OPlan &plan, OVector3D &vectorIntersec)
 Calculate the intersection of this plane with another plane. More...
 
int intersectsSurface (const TabPoint3D &contour, OSegment3D &segment) const
 Compute intersection between a plan and a surface defined by his bounds. More...
 
bool isInPlan (const OPoint3D &pt)
 Check if a point belongs to a plane. More...
 
bool is_valid ()
 Check whether the plane is valid. More...
 
bool is_null ()
 
bool is_NaN ()
 
double angle (const OPlan &plan)
 Calculation of the angle between this plane and another plane. More...
 
double distance (const OPoint3D &pt)
 Calculation of the minimal distance between a point and this plane. More...
 
OPoint3D symPtPlan (const OPoint3D &pt)
 Calculate the symmetrical of a point relative to the plane. More...
 
OPoint3D projPtPlan (const OPoint3D &pt)
 Calculate the projection of a point on the plane. More...
 
bool distancePlanParallel (const OPlan &plan, double &distance)
 Calculate the distance between this plan and another parallel plane. More...
 
bool isParallel (const OPlan &plan)
 Check if this plane is parallel with another plane. More...
 
bool isOrthogonal (const OPlan &plan)
 Check if this plan is perpendicular to another plan. More...
 

Public Attributes

double _a
 The a parameter in the equation ax+by+cz+d=0. More...
 
double _b
 The b parameter in the equation ax+by+cz+d=0. More...
 
double _c
 The c parameter in the equation ax+by+cz+d=0. More...
 
double _d
 The d parameter in the equation ax+by+cz+d=0. More...
 
ORepere3D rframe
 

Protected Member Functions

void update_explicit_repr (OVector3D hint=OVector3D(1, 1, 1))
 updates the implicit representation of the plane More...
 

Detailed Description

Plan defined by its equation : ax+by+cz+d=0.

Definition at line 30 of file plan.h.

Constructor & Destructor Documentation

◆ OPlan() [1/5]

OPlan::OPlan ( )

Default constructor With a=b=c=d=0.

Definition at line 25 of file plan.cpp.

◆ OPlan() [2/5]

OPlan::OPlan ( const OPlan plan)

Copy constructor.

Parameters
planThe object to be copied.

Definition at line 30 of file plan.cpp.

Here is the call graph for this function:

◆ OPlan() [3/5]

OPlan::OPlan ( double  a,
double  b,
double  c,
double  d 
)

Constructor with the a, b, c and d parameters.

Parameters
aThe a parameter in the equation ax+by+cz+d=0.
bThe b parameter in the equation ax+by+cz+d=0.
cThe c parameter in the equation ax+by+cz+d=0.
dThe d parameter in the equation ax+by+cz+d=0.

Definition at line 36 of file plan.cpp.

Here is the call graph for this function:

◆ OPlan() [4/5]

OPlan::OPlan ( const OPoint3D pt1,
const OPoint3D pt2,
const OPoint3D pt3 
)

Constructs a new plan from 3 points.

  1. We calculate normal vector N to the plane.
  2. All plan vectors are normal to N ! => Scalar product P1P.N = 0 Nx*(Px-P1x) + Ny*(Py-P1y) + Nz*(Pz-P1z) = 0 Can be written as : a*Px + b*Py + c*Pz + d = 0 == Plane equation
Parameters
pt1Point 1.
pt2Point 2.
pt3Point 3.

Definition at line 41 of file plan.cpp.

Here is the call graph for this function:

◆ OPlan() [5/5]

OPlan::OPlan ( const OPoint3D pt,
const OVector3D normale 
)

Constructs a new plan from 1 point and a normal.

All plan vectors are normal to N ! => Scalar product P1P.N = 0 Nx*(Px-P1x) + Ny*(Py-P1y) + Nz*(Pz-P1z) = 0 Can be written as : a*Px + b*Py + c*Pz + d = 0 == Equation du plan

Parameters
ptThe point.
normaleThe normal.

Definition at line 46 of file plan.cpp.

Here is the call graph for this function:

◆ ~OPlan()

OPlan::~OPlan ( )
virtual

Destructor.

Definition at line 51 of file plan.cpp.

Member Function Documentation

◆ angle()

double OPlan::angle ( const OPlan plan)

Calculation of the angle between this plane and another plane.

Parameters
planAnother plane.
Returns
The angle between the 2 planes.

Definition at line 363 of file plan.cpp.

Here is the call graph for this function:

◆ distance()

double OPlan::distance ( const OPoint3D pt)

Calculation of the minimal distance between a point and this plane.

Parameters
ptA point.
Returns
The minimal distance between a point and this plane.

Definition at line 371 of file plan.cpp.

Here is the caller graph for this function:

◆ distancePlanParallel()

bool OPlan::distancePlanParallel ( const OPlan plan,
double &  distance 
)

Calculate the distance between this plan and another parallel plane.

Parameters
planAnother plane.
distanceThe distance between 2 planes if they are parallel.
Returns
true if the two planes are parallel; false if not.

Definition at line 410 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersectsDroite()

int OPlan::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.

Parameters
ptA point belonging to the line.
vectorA vector defining the line.
ptIntersecThe intersection point.
Returns
INTERS_OUI (1) if the intersection exists, INTERS_CONFONDU (2) if the elements are overlaid, INTERS_NULLE (0) if no intersection exists.

Definition at line 251 of file plan.cpp.

Here is the call graph for this function:

◆ intersectsPlan()

int OPlan::intersectsPlan ( const OPlan plan,
OVector3D vectorIntersec 
)

Calculate the intersection of this plane with another plane.

Parameters
planAn another plane.
vectorIntersecThe vector defining the intersection.
Returns
INTERS_OUI (1) if the intersection exists, INTERS_CONFONDU (2) if the elements are overlaid, INTERS_NULLE (0) if no intersection exists.

Definition at line 275 of file plan.cpp.

Here is the call graph for this function:

◆ intersectsSegment()

int OPlan::intersectsSegment ( const OPoint3D pt1,
const OPoint3D pt2,
OPoint3D ptIntersec 
) const

Calculate the intersection of this plane with a segment defined by two points.

Note : In case the segment belongs to the plane, the result is INTERS_CONFONDU, and the coordinates of the intersection are not updated.

Algorithm :

  • The plane is defined by : . a*x+b*y+c*z+d=0
  • The segment is defined by : . x=x1+t*(x2-x1) . y=y1+t*(y2-y1) . z=z1+t*(z2-z1) . with 0 <= t <= 1
  • We solve the system : . t = -(a*x1+b*y1+c*z1+d)/D . with D = a*(x2-x1)+b*(y2-y1)+c*(z2-z1) . and D = scalar product between the plane normal and . the segment vector, so if D is zero, then . the segment is parallel to the plane and we test . if a point of the segment belongs to the plane to . confirm that the segment belongs to the plane or not...
Parameters
pt1The segment first point.
pt2The segment second point.
ptIntersecThe intersection point.
Returns
INTERS_OUI (1) if the intersection exists, INTERS_CONFONDU (2) if the elements are overlaid, INTERS_NULLE (0) if no intersection exists.

Definition at line 141 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersectsSurface()

int OPlan::intersectsSurface ( const TabPoint3D contour,
OSegment3D segment 
) const

Compute intersection between a plan and a surface defined by his bounds.

Definition at line 323 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_NaN()

bool OPlan::is_NaN ( )

Definition at line 127 of file plan.cpp.

Here is the caller graph for this function:

◆ is_null()

bool OPlan::is_null ( )

Definition at line 122 of file plan.cpp.

Here is the caller graph for this function:

◆ is_valid()

bool OPlan::is_valid ( )

Check whether the plane is valid.

a OPlan object can be invalid, i.e. not actually represent a plane, in case two cases :

  • the normal vector (_a, _b, _c) is null. This is the case when a OPlan is default constructed.
  • the normal vector, the origin, ... has not component which is NaN This can happen when points with NaN component are used.

Definition at line 133 of file plan.cpp.

Here is the call graph for this function:

◆ isInPlan()

bool OPlan::isInPlan ( const OPoint3D pt)

Check if a point belongs to a plane.

Definition at line 235 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOrthogonal()

bool OPlan::isOrthogonal ( const OPlan plan)

Check if this plan is perpendicular to another plan.

Parameters
planAnother plane.
Returns
true if the 2 planes are perpendicular; false if not.

Definition at line 437 of file plan.cpp.

Here is the caller graph for this function:

◆ isParallel()

bool OPlan::isParallel ( const OPlan plan)

Check if this plane is parallel with another plane.

Parameters
planAnother plane.
Returns
true if two planes are parallel; false if not.

Definition at line 422 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool OPlan::operator!= ( const OPlan plan) const

The inequality operator.

Parameters
planThe object reference with which this object is compared.

Definition at line 89 of file plan.cpp.

Here is the call graph for this function:

◆ operator=()

OPlan & OPlan::operator= ( const OPlan plan)

Assignment operator.

Parameters
planThe source to be assigned.

Definition at line 53 of file plan.cpp.

◆ operator==()

bool OPlan::operator== ( const OPlan plan) const

The equality operator.

Parameters
planThe object reference with which this object is compared.

Definition at line 65 of file plan.cpp.

Here is the caller graph for this function:

◆ projPtPlan()

OPoint3D OPlan::projPtPlan ( const OPoint3D pt)

Calculate the projection of a point on the plane.

Definition at line 396 of file plan.cpp.

◆ set() [1/3]

void OPlan::set ( const OPoint3D pt,
const OVector3D normale 
)

Sets with 1 point and a normal.

  1. We calculate normal vector N to the plane.
  2. All plan vectors are normal to N ! => Scalar product P1P.N = 0 Nx*(Px-P1x) + Ny*(Py-P1y) + Nz*(Pz-P1z) = 0 Can be written as : a*Px + b*Py + c*Pz + d = 0 == Plane equation
Parameters
ptThe point.
normaleThe normal.

Definition at line 113 of file plan.cpp.

Here is the call graph for this function:

◆ set() [2/3]

void OPlan::set ( const OPoint3D pt1,
const OPoint3D pt2,
const OPoint3D pt3 
)

Sets with 3 points.

  1. We calculate normal vector N to the plane.
  2. All plan vectors are normal to N ! => Scalar product P1P.N = 0 Nx*(Px-P1x) + Ny*(Py-P1y) + Nz*(Pz-P1z) = 0 Can be written as : a*Px + b*Py + c*Pz + d = 0 == Plane equation
Parameters
pt1Point 1.
pt2Point 2.
pt3Point 3.

Definition at line 103 of file plan.cpp.

Here is the call graph for this function:

◆ set() [3/3]

void OPlan::set ( double  a,
double  b,
double  c,
double  d 
)

Sets a, b, c and d parameters directly.

Parameters
aThe a parameter in the equation ax+by+cz+d=0.
bThe b parameter in the equation ax+by+cz+d=0.
cThe c parameter in the equation ax+by+cz+d=0.
dThe d parameter in the equation ax+by+cz+d=0.

Definition at line 94 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ symPtPlan()

OPoint3D OPlan::symPtPlan ( const OPoint3D pt)

Calculate the symmetrical of a point relative to the plane.

Definition at line 376 of file plan.cpp.

◆ update_explicit_repr()

void OPlan::update_explicit_repr ( OVector3D  hint = OVector3D(1, 1, 1))
protected

updates the implicit representation of the plane

We derive a reference frame for the plane (vector u and v) from the implicit equation which is the primary representation of the plane.

Definition at line 446 of file plan.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _a

double OPlan::_a

The a parameter in the equation ax+by+cz+d=0.

Definition at line 325 of file plan.h.

◆ _b

double OPlan::_b

The b parameter in the equation ax+by+cz+d=0.

Definition at line 327 of file plan.h.

◆ _c

double OPlan::_c

The c parameter in the equation ax+by+cz+d=0.

Definition at line 329 of file plan.h.

◆ _d

double OPlan::_d

The d parameter in the equation ax+by+cz+d=0.

Definition at line 331 of file plan.h.

◆ rframe

ORepere3D OPlan::rframe

Definition at line 333 of file plan.h.


The documentation for this class was generated from the following files: