Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
vpPlane Class Reference

#include <visp3/core/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 &n, vpPlaneFrame frame=camera_frame)
 
 vpPlane (const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame=camera_frame)
 
void init (const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame=camera_frame)
 
void init (const vpColVector &P, const vpColVector &n)
 
void init (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
 
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, vpPlane &p)
 

Detailed Description

This class defines the container for a plane geometrical structure.

A plane is given by the equation $Ax + By + Cz + D = 0$ where (x,y,z) are the coordinates of a point and where $[A,B,C]^T$ is a normal vector of the plane.

Examples:
homographyHartleyDLT2DObject.cpp, homographyHLM2DObject.cpp, homographyHLM3DObject.cpp, homographyRansac2DObject.cpp, manServoMomentsSimple.cpp, servoMomentImage.cpp, servoMomentPoints.cpp, servoMomentPolygon.cpp, and testDisplacement.cpp.

Definition at line 58 of file vpPlane.h.

Member Enumeration Documentation

◆ vpPlaneFrame

Enumerator
object_frame 
camera_frame 

Definition at line 70 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 66 of file vpPlane.cpp.

◆ vpPlane() [2/5]

vpPlane::vpPlane ( const vpPlane P)

Copy constructor.

Definition at line 83 of file vpPlane.cpp.

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

◆ 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 $Ax + By + Cz + 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
a,b,c,d: Parameters of the plane.

Definition at line 78 of file vpPlane.cpp.

◆ vpPlane() [4/5]

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

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

A plane is given by the equation $Ax + By + Cz + 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 points that are used are expressed in the camera of object frame.
n: The normal to the plane.
frameIndicates if the plane should be initialized from the point P coordinates expressed in the camera or object frame.

Definition at line 110 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,
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
P,Q,RThree points on the plane.
frameIndicates 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 225 of file vpPlane.cpp.

References 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 136 of file vpPlane.h.

◆ changeFrame()

void vpPlane::changeFrame ( const vpHomogeneousMatrix cMo)

◆ 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 116 of file vpPlane.h.

◆ getB()

◆ getC()

◆ getD()

◆ getIntersection()

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

Definition at line 328 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 $Ax + By + Cz + 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 238 of file vpPlane.cpp.

References A, B, and C.

Referenced by vpHomography::load(), 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 $Ax + By + Cz + D = 0$ where (x,y,z) are the coordinates of a point and $[A,B,C]^T$ is normal vector of the plane.

See also
getNormal()

Definition at line 258 of file vpPlane.cpp.

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

◆ init() [1/3]

void vpPlane::init ( const vpPoint P,
const vpPoint Q,
const vpPoint R,
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
P,Q,RThree points on the plane.
frameIndicates if the plane should be initialized from the points coordinates expressed in the camera or object frame.

Definition at line 168 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(), and vpPoint::get_Z().

Referenced by vpPlane().

◆ init() [2/3]

void vpPlane::init ( const vpColVector P,
const vpColVector n 
)

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.
n: The normal to the plane.
See also
vpPlane(const vpPoint&, const vpColVector &)

Definition at line 147 of file vpPlane.cpp.

References A, B, C, and D.

◆ init() [3/3]

void 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 128 of file vpPlane.cpp.

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

◆ operator=()

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

Copy operator.

Definition at line 53 of file vpPlane.cpp.

References A, B, C, and D.

◆ projectionPointOnPlan()

void vpPlane::projectionPointOnPlan ( const vpPoint P,
vpPoint Pproj 
) const

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

Parameters
P: point to be projected on the plane
Pproj: result of the projection (pproj belongs to the plane)

Definition at line 272 of file vpPlane.cpp.

References A, B, C, D, vpPoint::get_W(), vpPoint::get_X(), vpPoint::get_Y(), vpPoint::get_Z(), 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 289 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 82 of file vpPlane.h.

Referenced by init(), vpPlane(), and vpMbtDistanceLine::~vpMbtDistanceLine().

◆ 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, and servoMomentPolygon.cpp.

Definition at line 90 of file vpPlane.h.

◆ setB()

void vpPlane::setB ( double  b)
inline

Set plane parameter B.

Definition at line 84 of file vpPlane.h.

Referenced by init(), vpPlane(), and vpMbtDistanceLine::~vpMbtDistanceLine().

◆ setC()

void vpPlane::setC ( double  c)
inline

Set plane parameter C.

Definition at line 86 of file vpPlane.h.

Referenced by init(), vpPlane(), and vpMbtDistanceLine::~vpMbtDistanceLine().

◆ setD()

void vpPlane::setD ( double  d)
inline

Set plane parameter D.

Definition at line 88 of file vpPlane.h.

Referenced by init(), vpPlane(), and vpMbtDistanceLine::~vpMbtDistanceLine().

Friends And Related Function Documentation

◆ operator<<

VISP_EXPORT std::ostream& operator<< ( std::ostream &  os,
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 370 of file vpPlane.cpp.

Member Data Documentation

◆ A

double vpPlane::A

◆ B

double vpPlane::B

◆ C

double vpPlane::C

◆ D

double vpPlane::D

Definition at line 67 of file vpPlane.h.

Referenced by changeFrame(), init(), operator=(), projectionPointOnPlan(), and vpPlane().