27 #include <boost/shared_ptr.hpp>
29 #include "../../common/math/WLinearAlgebraFunctions.h"
30 #include "../../common/math/linearAlgebra/WVectorFixed.h"
31 #include "../../common/WAssert.h"
32 #include "../../common/WLimits.h"
69 boost::shared_ptr< std::set< WPosition > >
WPlane::samplePoints(
double stepWidth,
size_t numX,
size_t numY )
const
72 boost::shared_ptr< std::set< WPosition > > result(
new std::set< WPosition >() );
77 result->insert(
m_pos );
78 for(
size_t i = 0; i < numY; ++i )
80 for(
size_t j = 0; j < numX; ++j )
86 result->insert(
m_pos -
id * ycrement - jd * xcrement );
87 result->insert(
m_pos +
id * ycrement - jd * xcrement );
88 result->insert(
m_pos -
id * ycrement + jd * xcrement );
89 result->insert(
m_pos +
id * ycrement + jd * xcrement );
164 std::stringstream msg;
165 msg <<
"The give two vectors are not perpendicular to plane. First: " << first <<
" second: " << second <<
" for plane normal: " <<
m_normal;
168 std::stringstream msg2;
169 msg2 <<
"The given two vectors are not linear independent!: " << first <<
" and " << second;
170 WAssert( linearIndependent( first, second ), msg2.str() );
bool isInPlane(WPosition point) const
Determines whether a given point is in this plane or not.
WPosition m_pos
Position of the plane specifying the center.
WPlane(const WVector3d &normal, const WPosition &pos)
Constructs a plane with its normal and containing the point.
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.
WVector3d m_first
First vector in the plane.
This only is a 3d double vector.
void resetPosition(WPosition newPos)
Reset the position of the plane, normal remains the same.
virtual ~WPlane()
Destructor.
const float FLT_EPS
Smallest float such: 1.0 + FLT_EPS == 1.0 is still true.
WPosition getPointInPlane(double x, double y) const
Computes with relative coordinates a point in this plane.
WVector3d m_second
Second vector in the plane.
WVector3d m_normal
Direction of the plane.
boost::shared_ptr< std::set< WPosition > > samplePoints(const WGridRegular3D &grid, double stepWidth)
Computes sample points on that plane.