Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpPlane Class Reference

#include <vpPlane.h>

Public Types

enum  vpPlaneFrame { object_frame , camera_frame }

Public Member Functions

 vpPlane ()
 vpPlane (const vpPlane &P)
 vpPlane (double A, double B, double C, double D)
 vpPlane (const vpPoint &P, const vpColVector &normal, const vpPlaneFrame &frame=camera_frame)
 vpPlane (const vpPoint &P, const vpPoint &Q, const vpPoint &R, const vpPlaneFrame &frame=camera_frame)
double computeZ (double x, double y) const
vpPlaneinit (const vpPoint &P, const vpColVector &normal, const vpPlaneFrame &frame=camera_frame)
vpPlaneinit (const vpPoint &P, const vpPoint &Q, const vpPoint &R, const vpPlaneFrame &frame=camera_frame)
vpPlaneinit (const vpColVector &P, const vpColVector &n)
vpPlaneinit (const vpPlane &P)
void setA (double a)
void setB (double b)
void setC (double c)
void setD (double d)
void setABCD (double a, double b, double c, double d)
vpPlaneoperator= (const vpPlane &f)
double getA () const
double getB () const
double getC () const
double getD () const
vpColVector getABCD () const
vpColVector abcd () const
vpColVector getNormal () const
void getNormal (vpColVector &n) const
void projectionPointOnPlan (const vpPoint &P, vpPoint &Pproj, const vpPlaneFrame &frame=camera_frame) const
double rayIntersection (const vpPoint &M0, const vpPoint &M1, vpColVector &H) const
double getIntersection (const vpColVector &M1, vpColVector &H) const
void changeFrame (const vpHomogeneousMatrix &cMo)

Public Attributes

double A
double B
double C
double D

Friends

VISP_EXPORT std::ostream & operator<< (std::ostream &os, const vpPlane &p)

Detailed Description

This class defines the container for a plane geometrical structure.

A plane is given by the equation $A*X + B*Y + C*Z + D = 0$ where (X,Y,Z) are the coordinates of a point and where $[A,B,C]^T$ is the normal vector of the plane.

Examples
homographyHLM2DObject.cpp, homographyHLM3DObject.cpp, homographyHartleyDLT2DObject.cpp, homographyRansac2DObject.cpp, manServoMomentsSimple.cpp, testDisplacement.cpp, and testFeatureMoment.cpp.

Definition at line 55 of file vpPlane.h.

Member Enumeration Documentation

◆ vpPlaneFrame

Enumerator
object_frame 
camera_frame 

Definition at line 64 of file vpPlane.h.

Constructor & Destructor Documentation

◆ vpPlane() [1/5]

vpPlane::vpPlane ( )

Basic constructor that set the plane parameters A, B, C, D to zero.

Definition at line 61 of file vpPlane.cpp.

References A, B, C, and D.

Referenced by init(), init(), init(), init(), operator<<, operator=(), and vpPlane().

◆ vpPlane() [2/5]

vpPlane::vpPlane ( const vpPlane & P)

Copy constructor.

Definition at line 80 of file vpPlane.cpp.

References A, B, C, D, getA(), getB(), getC(), getD(), setA(), setB(), setC(), setD(), and vpPlane().

◆ vpPlane() [3/5]

vpPlane::vpPlane ( double a,
double b,
double c,
double d )

Plane constructor from A, B, C, D parameters.

A plane is given by the equation $ A*X + B*Y + C*Z + D = 0 $ where (X,Y,Z) are the coordinates of a point and $[A,B,C]^T$ is the normal vector of the plane.

Parameters
[in]a: Plane $ A $ parameter.
[in]b: Plane $ B $ parameter.
[in]c: Plane $ C $ parameter.
[in]d: Plane $ D $ parameter.

Definition at line 75 of file vpPlane.cpp.

References A, B, C, and D.

◆ vpPlane() [4/5]

vpPlane::vpPlane ( const vpPoint & P,
const vpColVector & normal,
const vpPlaneFrame & frame = camera_frame )

Plane constructor from a point P on the plane and the normal to the plane.

A plane is given by the equation $A*X + B*Y + C*Z + D = 0$ where (X,Y,Z) are the coordinates of a point and $[A,B,C]^T$ is the normal vector of the plane.

Parameters
P: A point with coordinates (X,Y,Z) on the plane. The frame parameter indicates if the coordinates of this point are expressed in the camera or object frame.
normal: The normal to the plane.
frame: Indicates if the plane should be initialized from the point P coordinates expressed in the camera or object frame.
  • When expressed in the camera frame we get the coordinates of the point using (P.get_X(), P.get_Y(), P.get_Z()).
  • When expressed in the object frame we get the coordinates of the point using (P.get_oX(), P.get_oY(), P.get_oZ()).

Definition at line 108 of file vpPlane.cpp.

References A, B, C, camera_frame, D, vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPoint::get_X(), vpPoint::get_Y(), and vpPoint::get_Z().

◆ vpPlane() [5/5]

vpPlane::vpPlane ( const vpPoint & P,
const vpPoint & Q,
const vpPoint & R,
const vpPlaneFrame & frame = camera_frame )

Compute the equation of a plane given three point P, Q, R.

The normal to the plane is given by: n = PQ x PR

Parameters
[in]P: First points on the plane.
[in]Q: Second points on the plane.
[in]R: Third points on the plane.
[in]frame: Indicates if the plane should be initialized from the points coordinates expressed in the camera or object frame.
See also
init(const vpPoint &, const vpPoint &, const vpPoint &)

Definition at line 285 of file vpPlane.cpp.

References A, B, C, D, and init().

Member Function Documentation

◆ abcd()

vpColVector vpPlane::abcd ( ) const
inline
Warning
This method is provided for compatibility with the previous versions. Users should now use getABCD().
Returns
Return the four dimension vector $[A,B,C,D]^T$ corresponding to the plane parameters.
See also
getABCD()

Definition at line 139 of file vpPlane.h.

References A, B, C, and D.

◆ changeFrame()

void vpPlane::changeFrame ( const vpHomogeneousMatrix & cMo)

Considering the plane in the Ro frame computes the equation of the plane in the Rc frame.

Parameters
cMo: Homogeneous transformation from Rc to Ro frames.
Examples
manServoMomentsSimple.cpp, servoMomentImage.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, and testFeatureMoment.cpp.

Definition at line 465 of file vpPlane.cpp.

References A, B, C, and D.

Referenced by vpMbKltTracker::setPose().

◆ computeZ()

double vpPlane::computeZ ( double x,
double y ) const

Compute Z value of a 3D point located on the plane from its perspective projection coordinates.

Parameters
[in]x: Coordinate of a point in the image plane along x-axis. This coordinate is the one obtained by perspective projection of a 3D point.
[in]y: Coordinate of a point in the image plane along y-axis. This coordinate is the one obtained by perspective projection of a 3D point.
Returns
Z coordinate in [m] of the corresponding 3D point.

Definition at line 298 of file vpPlane.cpp.

References getA(), getB(), getC(), and getD().

Referenced by vpPose::computePlanarObjectPoseFromRGBD(), vpPose::computePlanarObjectPoseFromRGBD(), and vpPose::computePlanarObjectPoseWithAtLeast3Points().

◆ getA()

◆ getABCD()

vpColVector vpPlane::getABCD ( ) const
inline
Returns
Return the four dimension vector $[A,B,C,D]^T$ corresponding to the plane parameters.

Definition at line 114 of file vpPlane.h.

References A, B, C, and D.

◆ getB()

◆ getC()

◆ getD()

◆ getIntersection()

double vpPlane::getIntersection ( const vpColVector & M1,
vpColVector & H ) const

Definition at line 435 of file vpPlane.cpp.

References A, B, C, and getD().

◆ getNormal() [1/2]

vpColVector vpPlane::getNormal ( ) const

Return the normal to the plane.

A plane is given by the equation $A*X + B*Y + C*Z + D = 0$ where (x,y,z) is a point of R^3 and (A,B,C) are the coordinates of the normal.

See also
getNormal(vpColVector &n)

Definition at line 311 of file vpPlane.cpp.

References A, B, and C.

Referenced by vpMbtDistanceKltPoints::init(), and vpMbKltTracker::setPose().

◆ getNormal() [2/2]

void vpPlane::getNormal ( vpColVector & n) const

Return the normal to the plane.

A plane is given by the equation $A*X + B*Y + C*Z + D = 0$ where (X,Y,Z) are the coordinates of a point and $[A,B,C]^T$ is the normal vector of the plane.

See also
getNormal()

Definition at line 335 of file vpPlane.cpp.

References A, B, C, and vpColVector::resize().

◆ init() [1/4]

vpPlane & vpPlane::init ( const vpColVector & P,
const vpColVector & normal )

Initialize the plane from a point P on the plane and the normal n to the plane.

Parameters
P: A point with coordinates (x,y,z) on the plane. The size of the vector should be 3, with P[0]=x, with P[1]=y, with P[2]=z.
normal: The normal to the plane.
See also
vpPlane(const vpPoint&, const vpColVector &)

Definition at line 190 of file vpPlane.cpp.

References A, B, C, D, and vpPlane().

◆ init() [2/4]

vpPlane & vpPlane::init ( const vpPlane & P)

Initialize the plane with the parameters of an other plane P.

Parameters
P: Plane used as initializer.

Definition at line 131 of file vpPlane.cpp.

References getA(), getB(), getC(), getD(), setA(), setB(), setC(), setD(), and vpPlane().

◆ init() [3/4]

vpPlane & vpPlane::init ( const vpPoint & P,
const vpColVector & normal,
const vpPlaneFrame & frame = camera_frame )

Initialize the plane from a point P on the plane and the normal to the plane.

Parameters
P: A point with coordinates (X,Y,Z) on the plane. The frame parameter indicates if the coordinates of this point are expressed in the camera or object frame.
normal: The normal to the plane.
frame: Indicates if the plane should be initialized from the point P coordinates expressed in the camera (X, Y, Z) or object frame (oX, oY, oZ).
  • When expressed in the camera frame we get the coordinates of the point using (P.get_X(), P.get_Y(), P.get_Z()).
  • When expressed in the object frame we get the coordinates of the point using (P.get_oX(), P.get_oY(), P.get_oZ()).
See also
vpPlane(const vpPoint&, const vpColVector &)

Definition at line 159 of file vpPlane.cpp.

References A, B, C, camera_frame, D, vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), and vpPlane().

Referenced by vpPlane().

◆ init() [4/4]

vpPlane & vpPlane::init ( const vpPoint & P,
const vpPoint & Q,
const vpPoint & R,
const vpPlaneFrame & frame = camera_frame )

Compute the equation of a plane given three point P, Q, R.

The normal to the plane is given by: n = PQ x PR

Parameters
[in]P: First points on the plane.
[in]Q: Second points on the plane.
[in]R: Third points on the plane.
[in]frame: Indicates if the plane should be initialized from the points coordinates expressed in the camera or object frame.

Definition at line 218 of file vpPlane.cpp.

References A, B, C, camera_frame, vpColVector::cross(), D, vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), and vpPlane().

◆ operator=()

BEGIN_VISP_NAMESPACE vpPlane & vpPlane::operator= ( const vpPlane & p)

Copy operator.

Definition at line 48 of file vpPlane.cpp.

References A, B, C, D, and vpPlane().

◆ projectionPointOnPlan()

void vpPlane::projectionPointOnPlan ( const vpPoint & P,
vpPoint & Pproj,
const vpPlaneFrame & frame = camera_frame ) const

Compute the coordinates of the projection of a point on the plane.

Parameters
[in]P: Point to be projected on the plane.
[out]Pproj: Projected point.
[in]frame: Indicates if the point P coordinates are expressed in the camera or object frame.
  • When expressed in the camera frame we get the coordinates of the point using (P.get_X(), P.get_Y(), P.get_Z()).
  • When expressed in the object frame we get the coordinates of the point using (P.get_oX(), P.get_oY(), P.get_oZ()).

Definition at line 358 of file vpPlane.cpp.

References A, B, C, camera_frame, D, vpPoint::get_oW(), vpPoint::get_oX(), vpPoint::get_oY(), vpPoint::get_oZ(), vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), vpPoint::set_oW(), vpPoint::set_oX(), vpPoint::set_oY(), vpPoint::set_oZ(), vpPoint::set_W(), vpPoint::set_X(), vpPoint::set_Y(), and vpPoint::set_Z().

◆ rayIntersection()

double vpPlane::rayIntersection ( const vpPoint & M0,
const vpPoint & M1,
vpColVector & H ) const

Definition at line 389 of file vpPlane.cpp.

References vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), getA(), getB(), getC(), and getD().

◆ setA()

void vpPlane::setA ( double a)
inline

Set plane parameter A.

Definition at line 80 of file vpPlane.h.

Referenced by init(), and vpPlane().

◆ setABCD()

void vpPlane::setABCD ( double a,
double b,
double c,
double d )
inline

Set plane parameters A, B, C, D.

Examples
manServoMomentsSimple.cpp, servoMomentImage.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, and testFeatureMoment.cpp.

Definition at line 88 of file vpPlane.h.

◆ setB()

void vpPlane::setB ( double b)
inline

Set plane parameter B.

Definition at line 82 of file vpPlane.h.

Referenced by init(), and vpPlane().

◆ setC()

void vpPlane::setC ( double c)
inline

Set plane parameter C.

Definition at line 84 of file vpPlane.h.

Referenced by init(), and vpPlane().

◆ setD()

void vpPlane::setD ( double d)
inline

Set plane parameter D.

Definition at line 86 of file vpPlane.h.

Referenced by init(), and vpPlane().

◆ operator<<

VISP_EXPORT std::ostream & operator<< ( std::ostream & os,
const vpPlane & p )
friend

Print the plane parameters as a stream like "(A,B,C,D) " where A,B,C and D correspond to the parameters of the plane.

Definition at line 488 of file vpPlane.cpp.

References operator<<, and vpPlane().

Referenced by operator<<.

Member Data Documentation

◆ A

◆ B

◆ C

◆ D

double vpPlane::D