OpenWalnut
1.5.0dev
|
Represents a plane with a normal vector and a position in space. More...
#include <WPlane.h>
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 WPosition & | getPosition () const |
Returns a point in that plane. More... | |
const WVector3d & | getNormal () 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... | |
Represents a plane with a normal vector and a position in space.
Constructs a plane with its normal and containing the point.
normal | Direction of the plane |
pos | Position of the plane |
Definition at line 35 of file WPlane.cpp.
References setNormal().
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.
normal | Normal vector for the direction |
pos | Base point of the plane, aka origin. |
first | First vector perpendicular to the normal |
second | Second vector perpendicular to the normal and linearly independent from first. |
Definition at line 42 of file WPlane.cpp.
References m_first, m_second, and setPlaneVectors().
|
virtual |
Destructor.
Definition at line 51 of file WPlane.cpp.
|
inline |
WPosition WPlane::getPointInPlane | ( | double | x, |
double | y | ||
) | const |
Computes with relative coordinates a point in this plane.
(0,0) means its position is returned.
x | how far along the direction of the first vector which spans the plane |
y | how far along the direction of the second vector which spans the plane too |
Definition at line 94 of file WPlane.cpp.
References m_first, m_pos, and m_second.
Referenced by wge::genFinitePlane().
|
inline |
Returns a point in that plane.
Definition at line 166 of file WPlane.h.
References m_pos.
Referenced by WFiberCluster::elongateCenterLine().
bool WPlane::isInPlane | ( | WPosition | point | ) | const |
Determines whether a given point is in this plane or not.
point | Position to query |
Definition at line 55 of file WPlane.cpp.
void WPlane::resetPosition | ( | WPosition | newPos | ) |
Reset the position of the plane, normal remains the same.
newPos | New Position (point in plane). |
Definition at line 61 of file WPlane.cpp.
References m_pos.
Referenced by WFiberCluster::elongateCenterLine().
std::shared_ptr< std::set< WPosition > > WPlane::samplePoints | ( | const WGridRegular3D & | grid, |
double | stepWidth | ||
) |
Computes sample points on that plane.
grid | |
stepWidth |
Referenced by WPlaneTest::testFixedSampling().
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.
stepWidth | |
numX | |
numY |
Definition at line 68 of file WPlane.cpp.
|
inline |
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.
first | First vector spanning the plane |
second | Second 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().
|
protected |
First vector in the plane.
Definition at line 160 of file WPlane.h.
Referenced by getPointInPlane(), samplePoints(), setNormal(), setPlaneVectors(), and WPlane().
|
protected |
Direction of the plane.
Definition at line 158 of file WPlane.h.
Referenced by getNormal(), setNormal(), and setPlaneVectors().
|
protected |
Position of the plane specifying the center.
Definition at line 159 of file WPlane.h.
Referenced by getPointInPlane(), getPosition(), resetPosition(), and samplePoints().
|
protected |
Second vector in the plane.
Definition at line 161 of file WPlane.h.
Referenced by getPointInPlane(), samplePoints(), setNormal(), setPlaneVectors(), and WPlane().