OpenWalnut
1.4.0
|
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. | |
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. | |
virtual | ~WPlane () |
Destructor. | |
bool | isInPlane (WPosition point) const |
Determines whether a given point is in this plane or not. | |
void | resetPosition (WPosition newPos) |
Reset the position of the plane, normal remains the same. | |
boost::shared_ptr< std::set < WPosition > > | samplePoints (const WGridRegular3D &grid, double stepWidth) |
Computes sample points on that plane. | |
WPosition | getPointInPlane (double x, double y) const |
Computes with relative coordinates a point in this plane. | |
const WPosition & | getPosition () const |
Returns a point in that plane. | |
const WVector3d & | getNormal () const |
Returns the normal of the plane. | |
void | setPlaneVectors (const WVector3d &first, const WVector3d &second) |
Resets the vector spanning the plane. | |
void | setNormal (const WVector3d &normal) |
Resets the normal of this plane. | |
boost::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. | |
Protected Attributes | |
WVector3d | m_normal |
Direction of the plane. | |
WPosition | m_pos |
Position of the plane specifying the center. | |
WVector3d | m_first |
First vector in the plane. | |
WVector3d | m_second |
Second vector in the plane. |
Represents a plane with a normal vector and a position in space.
WPlane::WPlane | ( | const WVector3d & | normal, |
const WPosition & | pos | ||
) |
Constructs a plane with its normal and containing the point.
normal | Direction of the plane |
pos | Position of the plane |
Definition at line 36 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 43 of file WPlane.cpp.
References m_first, m_second, and setPlaneVectors().
WPlane::~WPlane | ( | ) | [virtual] |
Destructor.
Definition at line 52 of file WPlane.cpp.
const WVector3d & WPlane::getNormal | ( | ) | const [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 153 of file WPlane.cpp.
References m_first, m_pos, and m_second.
Referenced by wge::genFinitePlane().
const WPosition & WPlane::getPosition | ( | ) | const [inline] |
Returns a point in that plane.
Definition at line 181 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 56 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 62 of file WPlane.cpp.
References m_pos.
Referenced by WFiberCluster::elongateCenterLine().
boost::shared_ptr< std::set< WPosition > > WPlane::samplePoints | ( | const WGridRegular3D & | grid, |
double | stepWidth | ||
) |
Computes sample points on that plane.
grid | |
stepWidth |
Referenced by WPlaneTest::testFixedSampling().
boost::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 69 of file WPlane.cpp.
void WPlane::setNormal | ( | const WVector3d & | normal | ) | [inline] |
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.
first | First vector spanning the plane |
second | Second vector spanning the plane |
Definition at line 162 of file WPlane.cpp.
References wlimits::FLT_EPS, m_first, m_normal, and m_second.
Referenced by WPlane().
WVector3d WPlane::m_first [protected] |
First vector in the plane.
Definition at line 175 of file WPlane.h.
Referenced by getPointInPlane(), samplePoints(), setNormal(), setPlaneVectors(), and WPlane().
WVector3d WPlane::m_normal [protected] |
Direction of the plane.
Definition at line 173 of file WPlane.h.
Referenced by getNormal(), setNormal(), and setPlaneVectors().
WPosition WPlane::m_pos [protected] |
Position of the plane specifying the center.
Definition at line 174 of file WPlane.h.
Referenced by getPointInPlane(), getPosition(), resetPosition(), and samplePoints().
WVector3d WPlane::m_second [protected] |
Second vector in the plane.
Definition at line 176 of file WPlane.h.
Referenced by getPointInPlane(), samplePoints(), setNormal(), setPlaneVectors(), and WPlane().