OpenWalnut  1.5.0dev
Public Member Functions | Protected Attributes | List of all members
WPlane Class Reference

Represents a plane with a normal vector and a position in space. More...

#include <WPlane.h>

+ Collaboration diagram for WPlane:

Public Member Functions

 WPlane (const WVector3d &normal, const WPosition &pos)
 Constructs a plane with its normal and containing the point. More...
 
 WPlane (const WVector3d &normal, const WPosition &pos, const WVector3d &first, const WVector3d &second)
 Constructs a plane with its normal and its base point/origin as well as explicitly specifying its vectors in the plane. More...
 
virtual ~WPlane ()
 Destructor. More...
 
bool isInPlane (WPosition point) const
 Determines whether a given point is in this plane or not. More...
 
void resetPosition (WPosition newPos)
 Reset the position of the plane, normal remains the same. More...
 
std::shared_ptr< std::set< WPosition > > samplePoints (const WGridRegular3D &grid, double stepWidth)
 Computes sample points on that plane. More...
 
WPosition getPointInPlane (double x, double y) const
 Computes with relative coordinates a point in this plane. More...
 
const WPositiongetPosition () const
 Returns a point in that plane. More...
 
const WVector3dgetNormal () const
 Returns the normal of the plane. More...
 
void setPlaneVectors (const WVector3d &first, const WVector3d &second)
 Resets the vector spanning the plane. More...
 
void setNormal (const WVector3d &normal)
 Resets the normal of this plane. More...
 
std::shared_ptr< std::set< WPosition > > samplePoints (double stepWidth, size_t numX, size_t numY) const
 Computes a fixed number of sample points on that plane. More...
 

Protected Attributes

WVector3d m_normal
 Direction of the plane. More...
 
WPosition m_pos
 Position of the plane specifying the center. More...
 
WVector3d m_first
 First vector in the plane. More...
 
WVector3d m_second
 Second vector in the plane. More...
 

Detailed Description

Represents a plane with a normal vector and a position in space.

Definition at line 38 of file WPlane.h.

Constructor & Destructor Documentation

◆ WPlane() [1/2]

WPlane::WPlane ( const WVector3d normal,
const WPosition pos 
)

Constructs a plane with its normal and containing the point.

Parameters
normalDirection of the plane
posPosition of the plane

Definition at line 35 of file WPlane.cpp.

References setNormal().

+ Here is the call graph for this function:

◆ WPlane() [2/2]

WPlane::WPlane ( const WVector3d normal,
const WPosition pos,
const WVector3d first,
const WVector3d second 
)

Constructs a plane with its normal and its base point/origin as well as explicitly specifying its vectors in the plane.

Parameters
normalNormal vector for the direction
posBase point of the plane, aka origin.
firstFirst vector perpendicular to the normal
secondSecond vector perpendicular to the normal and linearly independent from first.
Note
Due to numerical stability a comparison to 0.0 is not performed. Instead the absolute value of the dot product is checked to be smaller than the FLT_EPS. FLT_EPS is used instead of DBL_EPS just numerical errors may sum up above DBL_EPS.

Definition at line 42 of file WPlane.cpp.

References m_first, m_second, and setPlaneVectors().

+ Here is the call graph for this function:

◆ ~WPlane()

WPlane::~WPlane ( )
virtual

Destructor.

Definition at line 51 of file WPlane.cpp.

Member Function Documentation

◆ getNormal()

const WVector3d & WPlane::getNormal ( ) const
inline

Returns the normal of the plane.

Returns
Normalized normal vector.

Definition at line 171 of file WPlane.h.

References m_normal.

◆ getPointInPlane()

WPosition WPlane::getPointInPlane ( double  x,
double  y 
) const

Computes with relative coordinates a point in this plane.

(0,0) means its position is returned.

Parameters
xhow far along the direction of the first vector which spans the plane
yhow far along the direction of the second vector which spans the plane too
Returns
the new calculated position

Definition at line 94 of file WPlane.cpp.

References m_first, m_pos, and m_second.

Referenced by wge::genFinitePlane().

+ Here is the caller graph for this function:

◆ getPosition()

const WPosition & WPlane::getPosition ( ) const
inline

Returns a point in that plane.

Returns
The point in that plane describing its position

Definition at line 166 of file WPlane.h.

References m_pos.

Referenced by WFiberCluster::elongateCenterLine().

+ Here is the caller graph for this function:

◆ isInPlane()

bool WPlane::isInPlane ( WPosition  point) const

Determines whether a given point is in this plane or not.

Parameters
pointPosition to query
Returns
True if and only if the point is in this plane.

Definition at line 55 of file WPlane.cpp.

◆ resetPosition()

void WPlane::resetPosition ( WPosition  newPos)

Reset the position of the plane, normal remains the same.

Parameters
newPosNew Position (point in plane).

Definition at line 61 of file WPlane.cpp.

References m_pos.

Referenced by WFiberCluster::elongateCenterLine().

+ Here is the caller graph for this function:

◆ samplePoints() [1/2]

std::shared_ptr< std::set< WPosition > > WPlane::samplePoints ( const WGridRegular3D grid,
double  stepWidth 
)

Computes sample points on that plane.

Parameters
grid
stepWidth
Returns
Set of positions on the plane

Referenced by WPlaneTest::testFixedSampling().

+ Here is the caller graph for this function:

◆ samplePoints() [2/2]

std::shared_ptr< std::set< WPosition > > WPlane::samplePoints ( double  stepWidth,
size_t  numX,
size_t  numY 
) const

Computes a fixed number of sample points on that plane.

Parameters
stepWidth
numX
numY
Returns
Set of positions on the plane

Definition at line 68 of file WPlane.cpp.

References m_first, m_pos, and m_second.

◆ setNormal()

void WPlane::setNormal ( const WVector3d normal)
inline

Resets the normal of this plane.

Parameters
normalNew normal for this plane.

Definition at line 132 of file WPlane.h.

References m_first, m_normal, and m_second.

Referenced by WPlane().

+ Here is the caller graph for this function:

◆ setPlaneVectors()

void WPlane::setPlaneVectors ( const WVector3d first,
const WVector3d second 
)

Resets the vector spanning the plane.

Both must be linear independent and perpendicular to the already existing normal vector. After setting the vectors they are normalized.

Parameters
firstFirst vector spanning the plane
secondSecond vector spanning the plane

Definition at line 103 of file WPlane.cpp.

References wlimits::FLT_EPS, m_first, m_normal, and m_second.

Referenced by WPlane().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_first

WVector3d WPlane::m_first
protected

First vector in the plane.

Definition at line 160 of file WPlane.h.

Referenced by getPointInPlane(), samplePoints(), setNormal(), setPlaneVectors(), and WPlane().

◆ m_normal

WVector3d WPlane::m_normal
protected

Direction of the plane.

Definition at line 158 of file WPlane.h.

Referenced by getNormal(), setNormal(), and setPlaneVectors().

◆ m_pos

WPosition WPlane::m_pos
protected

Position of the plane specifying the center.

Definition at line 159 of file WPlane.h.

Referenced by getPointInPlane(), getPosition(), resetPosition(), and samplePoints().

◆ m_second

WVector3d WPlane::m_second
protected

Second vector in the plane.

Definition at line 161 of file WPlane.h.

Referenced by getPointInPlane(), samplePoints(), setNormal(), setPlaneVectors(), and WPlane().


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