RobWorkProject
23.9.11-
|
plane primitive represented in Hessian normal-form: a*nx+b*ny+c*nz+d=0 More...
#include <Plane.hpp>
Inherits Primitive.
Public Types | |
typedef rw::core::Ptr< Plane > | Ptr |
Smart pointer to Plane. | |
typedef double | value_type |
The value type for a plane (double precision). | |
Public Types inherited from Primitive | |
typedef rw::core::Ptr< Primitive > | Ptr |
Smart pointer to this type of class. | |
Public Types inherited from GeometryData | |
enum | GeometryType { PointCloud , LineMesh , PlainTriMesh , IdxTriMesh , SpherePrim , BoxPrim , OBBPrim , AABBPrim , LinePrim , PointPrim , PyramidPrim , ConePrim , TrianglePrim , CylinderPrim , TubePrim , PlanePrim , RayPrim , Implicit , Quadratic , UserType } |
geometry data types | |
typedef rw::core::Ptr< GeometryData > | Ptr |
smart pointer type to this class | |
typedef rw::core::Ptr< const GeometryData > | CPtr |
const smart pointer type to this class | |
Public Member Functions | |
Plane () | |
Constructor. More... | |
Plane (const rw::math::Q &q) | |
constructor More... | |
Plane (const rw::math::Vector3D< double > &n, const double d) | |
constructor More... | |
Plane (const rw::math::Vector3D< double > &p1, const rw::math::Vector3D< double > &p2, const rw::math::Vector3D< double > &p3) | |
constructor - calculates the plane from 3 vertices More... | |
virtual | ~Plane () |
destructor | |
rw::math::Vector3D< double > & | normal () |
get plane normal | |
const rw::math::Vector3D< double > & | normal () const |
get plane normal | |
double & | d () |
get distance to {0,0,0} from plane along normal. | |
double | d () const |
get distance to {0,0,0} from plane along normal. | |
double | distance (const rw::math::Vector3D< double > &point) const |
Calculates the shortest distance from point to plane. More... | |
double | distance (const Plane &plane) const |
Default metric for computing the difference between 2 planes. More... | |
double | refit (const std::vector< rw::math::Vector3D< double >> &data) |
Fit this plane to a set of points. More... | |
rw::math::Vector3D< double > | intersection (const rw::math::Vector3D< double > &p1, const rw::math::Vector3D< double > &p2) const |
Calculates the intersection between the line and plane. More... | |
TriMesh::Ptr | createMesh (int resolution) const |
make a trimesh from this primitive. Use granularity to specify minimum number of line segments a half circle is split into More... | |
TriMesh::Ptr | createMesh (int resolution, double size) const |
Create a triangle mesh representing the plane. More... | |
virtual rw::math::Q | getParameters () const |
get the parameters that define this primitive More... | |
virtual void | setParameters (const rw::math::Q &q) |
set the parameters that define this primitive More... | |
GeometryType | getType () const |
the type of this primitive More... | |
Public Member Functions inherited from Primitive | |
virtual | ~Primitive () |
destructor | |
TriMesh::Ptr | getTriMesh (bool forceCopy=true) |
gets a trimesh representation of this geometry data. More... | |
virtual bool | isConvex () |
test if this geometry data is convex More... | |
bool | isInside (const rw::math::Vector3D< double > &point) |
test if a point is on the border or inside this primitive | |
Public Member Functions inherited from GeometryData | |
virtual | ~GeometryData () |
Destructor. | |
Static Public Member Functions | |
static rw::math::Metric< Plane >::Ptr | makeMetric (double angToDistWeight=1.0) |
Create a metric that can be used to compare distance between two planes. The distance between two planes is computed as follows: More... | |
Static Public Member Functions inherited from GeometryData | |
static std::string | toString (GeometryType type) |
format GeometryType to string More... | |
Protected Member Functions | |
bool | doIsInside (const rw::math::Vector3D< double > &point) |
Check if point lies inside geometry. More... | |
Protected Member Functions inherited from Primitive | |
Primitive (int levels=20) | |
Constructor. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Plane &p) |
Streaming operator. | |
plane primitive represented in Hessian normal-form: a*nx+b*ny+c*nz+d=0
|
inline |
Constructor.
Makes a plane on X-Y surface.
|
inline |
constructor
q |
|
inline |
constructor
n | [in] normal of plane |
d | [in] distance from plane to (0,0,0) in direction of normal |
|
inline |
constructor - calculates the plane from 3 vertices
p1 | [in] vertice 1 |
p2 | [in] vertice 2 |
p3 | [in] vertice 3 |
|
virtual |
make a trimesh from this primitive. Use granularity to specify minimum number of line segments a half circle is split into
resolution | [in] |
Implements Primitive.
TriMesh::Ptr createMesh | ( | int | resolution, |
double | size | ||
) | const |
Create a triangle mesh representing the plane.
Provides the posibility to specify the size of the plan.
resolution | [in] Resolution of the mesh (not applicable for a plane) |
size | [in] Size of the plane. |
|
inline |
Default metric for computing the difference between 2 planes.
plane | [in] |
|
inline |
Calculates the shortest distance from point to plane.
The distance includes the sign s.t. a negative distance corresponds to point being behind the plane and a positive distance in front of the plane.
point |
|
inlineprotectedvirtual |
Check if point lies inside geometry.
point | [in] point to check. |
Reimplemented from Primitive.
|
virtual |
get the parameters that define this primitive
Implements Primitive.
|
inlinevirtual |
the type of this primitive
Implements GeometryData.
rw::math::Vector3D<double> intersection | ( | const rw::math::Vector3D< double > & | p1, |
const rw::math::Vector3D< double > & | p2 | ||
) | const |
Calculates the intersection between the line and plane.
The line defined by p1 and p2 is considered infinitely long. Throws a rw::core::Exception if the line is parallel to the plane.
p1 | [in] point 1 on the line |
p2 | [in] point 2 on the line |
|
static |
Create a metric that can be used to compare distance between two planes. The distance between two planes is computed as follows:
val = 0.5*angle(p1.normal, p2.normal)*angToDistWeight + 0.5*fabs(p1.d-p2.d);
double refit | ( | const std::vector< rw::math::Vector3D< double >> & | data | ) |
Fit this plane to a set of points.
A PCA analysis of the points are made and the two axes with largest extends are used for defining the plane. The error is the sum of the squared mean of the points to the plane.
The plane normal always points in the positive z-direction.
data | [in] a set of points |
|
virtual |
set the parameters that define this primitive
Implements Primitive.