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

inet::Plane::Plane ( )
24  :
27 {
28 }
static const Coord NIL
Constant with all values set to 0.
Definition: Coord.h:40
Coord basePoint
Definition: Plane.h:35
Coord normalVector
Definition: Plane.h:36
inet::Plane::Plane ( const Coord basePoint,
const Coord normalVector 
)
30  :
33 {
34 }
Coord basePoint
Definition: Plane.h:35
Coord normalVector
Definition: Plane.h:36

Member Function Documentation

Coord inet::Plane::computeIntersection ( const LineSegment lineSegment)

Referenced by inet::Cuboid::computeIntersection().

37 {
38  // NOTE: based on http://paulbourke.net/geometry/pointlineplane/
39  const Coord& point1 = lineSegment.getPoint1();
40  const Coord& point2 = lineSegment.getPoint2();
41  double denominator = normalVector * (point2 - point1);
42  if (denominator == 0)
43  return Coord::NIL;
44  else {
45  double numerator = normalVector * (basePoint - point1);
46  double q = numerator / denominator;
47  if (q < 0 || q > 1)
48  return Coord::NIL;
49  else
50  return point1 * (1 - q) + point2 * q;
51  }
52 }
static const Coord NIL
Constant with all values set to 0.
Definition: Coord.h:40
Coord basePoint
Definition: Plane.h:35
Coord normalVector
Definition: Plane.h:36
const Coord& inet::Plane::getBasePoint ( )
inline
42 { return basePoint; }
Coord basePoint
Definition: Plane.h:35
const Coord& inet::Plane::getNormalVector ( )
inline
44 { return normalVector; }
Coord normalVector
Definition: Plane.h:36
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.

47 { return this == &NIL; }
static const Plane NIL
Definition: Plane.h:32
virtual bool inet::Plane::isUnspecified ( ) const
inlineoverridevirtual

Returns true if this geometric object is not completely specified.

Implements inet::GeometricObjectBase.

bool isUnspecified() const
Returns true if this coordinate is unspecified.
Definition: Coord.h:257
Coord basePoint
Definition: Plane.h:35
Coord normalVector
Definition: Plane.h:36
void inet::Plane::setBasePoint ( const Coord basePoint)
inline
43 { this->basePoint = basePoint; }
Coord basePoint
Definition: Plane.h:35
void inet::Plane::setNormalVector ( const Coord normalVector)
inline
45 { this->normalVector = normalVector; }
Coord normalVector
Definition: Plane.h:36

Member Data Documentation

Coord inet::Plane::basePoint
protected

Referenced by computeIntersection().

const Plane inet::Plane::NIL
static
Coord inet::Plane::normalVector
protected

Referenced by computeIntersection().


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