INET Framework for OMNeT++/OMNEST
inet::Plane Class Reference

This class represents a 2 dimensional plane in the 3 dimensional space. More...

#include <Plane.h>

Inheritance diagram for inet::Plane:
inet::GeometricObjectBase

Public Member Functions

 Plane ()
 
 Plane (const Coord &basePoint, const Coord &normalVector)
 
const CoordgetBasePoint ()
 
void setBasePoint (const Coord &basePoint)
 
const CoordgetNormalVector ()
 
void setNormalVector (const Coord &normalVector)
 
virtual bool isNil () const override
 Returns true if this geometric object is the same as the unspecified singleton instance of this type. More...
 
virtual bool isUnspecified () const override
 Returns true if this geometric object is not completely specified. More...
 
Coord computeIntersection (const LineSegment &lineSegment)
 
- Public Member Functions inherited from inet::GeometricObjectBase
 GeometricObjectBase ()
 
virtual ~GeometricObjectBase ()
 

Static Public Attributes

static const Plane NIL
 

Protected Attributes

Coord basePoint
 
Coord normalVector
 

Detailed Description

This class represents a 2 dimensional plane in the 3 dimensional space.

Constructor & Destructor Documentation

◆ Plane() [1/2]

inet::Plane::Plane ( )
14  :
17 {
18 }

◆ Plane() [2/2]

inet::Plane::Plane ( const Coord basePoint,
const Coord normalVector 
)
20  :
23 {
24 }

Member Function Documentation

◆ computeIntersection()

Coord inet::Plane::computeIntersection ( const LineSegment lineSegment)
27 {
28  // NOTE: based on http://paulbourke.net/geometry/pointlineplane/
29  const Coord& point1 = lineSegment.getPoint1();
30  const Coord& point2 = lineSegment.getPoint2();
31  double denominator = normalVector * (point2 - point1);
32  if (denominator == 0)
33  return Coord::NIL;
34  else {
35  double numerator = normalVector * (basePoint - point1);
36  double q = numerator / denominator;
37  if (q < 0 || q > 1)
38  return Coord::NIL;
39  else
40  return point1 * (1 - q) + point2 * q;
41  }
42 }

◆ getBasePoint()

const Coord& inet::Plane::getBasePoint ( )
inline
32 { return basePoint; }

◆ getNormalVector()

const Coord& inet::Plane::getNormalVector ( )
inline
34 { return normalVector; }

◆ isNil()

virtual bool inet::Plane::isNil ( ) const
inlineoverridevirtual

Returns true if this geometric object is the same as the unspecified singleton instance of this type.

Implements inet::GeometricObjectBase.

37 { return this == &NIL; }

◆ isUnspecified()

virtual bool inet::Plane::isUnspecified ( ) const
inlineoverridevirtual

Returns true if this geometric object is not completely specified.

Implements inet::GeometricObjectBase.

◆ setBasePoint()

void inet::Plane::setBasePoint ( const Coord basePoint)
inline
33 { this->basePoint = basePoint; }

◆ setNormalVector()

void inet::Plane::setNormalVector ( const Coord normalVector)
inline
35 { this->normalVector = normalVector; }

Member Data Documentation

◆ basePoint

Coord inet::Plane::basePoint
protected

Referenced by computeIntersection().

◆ NIL

const Plane inet::Plane::NIL
static

◆ normalVector

Coord inet::Plane::normalVector
protected

Referenced by computeIntersection().


The documentation for this class was generated from the following files:
inet::Plane::normalVector
Coord normalVector
Definition: Plane.h:26
inet::Plane::basePoint
Coord basePoint
Definition: Plane.h:25
inet::Coord::isUnspecified
bool isUnspecified() const
Returns true if this coordinate is unspecified.
Definition: Coord.h:303
inet::Coord::NIL
static const Coord NIL
Constant with all values set to 0.
Definition: Coord.h:26
inet::Plane::NIL
static const Plane NIL
Definition: Plane.h:22