AURobotServers  4
Public Member Functions | Public Attributes | List of all members
UPlane Class Reference

#include <uplane.h>

Public Member Functions

void clear ()
 
double dist (UPosition p1)
 Get distance from point to plane. More...
 
double distSigned (UPosition p1)
 Get signed distance from point to plane. The distance is positive if the position is at the origin-side of the plane. More...
 
UPosition getLineCrossing (ULine crossingLine, bool *notParallel)
 
UPosition getNormal ()
 
UPosition getOnPlane (UPosition p1)
 
ULine getPlaneCrossing (UPlane plane2, bool *notParallel)
 
bool isValid ()
 
void normalize ()
 
const char * print (const char *preStr, char *buff, const int buffCnt)
 
void set (UPosition p1, UPosition p2, UPosition p3)
 
void set (UPosition p1, UPosition n1)
 
void set (UPosition p1)
 
void set (double x, double y, double z)
 
void set (double ia, double ib, double ic, double id)
 
 UPlane ()
 
 ~UPlane ()
 

Public Attributes

double a
 
double b
 
double c
 
double d
 

Detailed Description

General definition of a 3D plane, defined bu ax + by +cz + d = 0. The normal vector (a,b,c) is assumed (and set) to be a unit vector, and d will be positive or zero (The distance to the plane (from origo) is then d) to ease distance calculations.

Author
Christian Andersen jca@o.nosp@m.erst.nosp@m.ed.dt.nosp@m.u.dk

Constructor & Destructor Documentation

UPlane::UPlane ( )

Constrctor

References clear().

UPlane::~UPlane ( )

Destructor

Member Function Documentation

void UPlane::clear ( void  )
inline

clear sets the plane to span the x-y axis zeros.

References a, b, c, d, and print().

Referenced by UFuncGndAna::do3dGroundPlane(), UResObj3d::do3dGroundPlane(), and UPlane().

double UPlane::dist ( UPosition  p1)
inline

Get distance from point to plane.

Parameters
p1is the 3d point
Returns
distance to point

References distSigned(), getLineCrossing(), getOnPlane(), and getPlaneCrossing().

Referenced by UResObj3d::doGndPlaneMask(), and UImg3Dpoints::getRansacPlane().

double UPlane::distSigned ( UPosition  p1)
inline

Get signed distance from point to plane. The distance is positive if the position is at the origin-side of the plane.

Parameters
p1is the 3d point
Returns
distance to point

References a, b, c, d, UPosition::x, UPosition::y, and UPosition::z.

Referenced by dist(), getOnPlane(), UGroundPatches::heightAnalysis(), UGrid3D::setVoxel(), and testPlane().

UPosition UPlane::getLineCrossing ( ULine  crossingLine,
bool *  notParallel 
)

Get position on plane, where the line is crossing the plane.

Parameters
crossingLineis the line that is assumed to cross the line
notParallelis true if the crossing is OK, otherwise the point is far away, in the right direction and on the line, but not on the plane.
Returns
the common point on the line and plane.

References a, absd(), b, c, d, ULine::getPositionOnLine(), ULine::pos, ULine::vec, UPosition::x, UPosition::y, and UPosition::z.

Referenced by dist().

UPosition UPlane::getNormal ( )
inline

Get normal vector

References a, b, and c.

Referenced by getPlaneCrossing(), and UImg3Dpoints::getRansacPlane().

UPosition UPlane::getOnPlane ( UPosition  p1)

Get point on plane nearest to a point off the plane.

Parameters
p1is the position off the plane.

References a, b, c, and distSigned().

Referenced by dist(), UPosRot::getCamToRobPlane(), UPosRot::getRobToCamPlane(), and testPlane().

ULine UPlane::getPlaneCrossing ( UPlane  plane2,
bool *  notParallel 
)

Get the line from intersection of two planes.

Parameters
plane2is the second plane.
notParallelis true if the result is OK.
Returns
the intersection line.

References a, b, c, UPosition::clear(), UPosition::cross(), d, UMatrix::get(), UPosition::get(), getNormal(), ULine::normalize(), ULine::pos, UMatrix::set(), UPosition::set(), UMatrix::setRC(), UMatrix::solve(), ULine::vec, UPosition::x, UPosition::y, and UPosition::z.

Referenced by dist(), and testPlane().

bool UPlane::isValid ( )
inline

The plane is defined valid, if the normal vector defined as (a,b,c) has length 1.

Returns
true if valid plane.

References a, b, c, and sqr().

void UPlane::normalize ( )

Adjust plane parameters to make (a,b,c) a unit vector and 'd' a positive value.

References a, b, c, d, and sqr().

Referenced by set().

const char * UPlane::print ( const char *  preStr,
char *  buff,
const int  buffCnt 
)

Print result to a string

References a, b, c, and d.

Referenced by clear(), and testPlane().

void UPlane::set ( UPosition  p1,
UPosition  p2,
UPosition  p3 
)

Set the plane from three 3D positions. Using a = A1, b=A2, c = A3, d = A, and Ai = det(x1, x2, x3), where x1 is p1 coulumn, x2 is x2 column x3 is p3 column, except for column i wich is set to [1 1 1]'. A uses the full matrix.

Parameters
p1is a 3d position on plane
p2is a 3d position on plane
p3is a 3d position on plane All positions must be different, else the result will be unpredicted, and isValid() will return false.

References a, b, c, UPosition::cross(), d, UPosition::toUnitVector(), UPosition::x, UPosition::y, and UPosition::z.

Referenced by UPosRot::getCamToRobPlane(), UImg3Dpoints::getRansacPlane(), UPosRot::getRobToCamPlane(), and testPlane().

void UPlane::set ( UPosition  p1,
UPosition  n1 
)

Set plane from a position and a normal vector.

Parameters
p1is a 3d position on the plane
n1is a 3d normal vector (need not be a unit vector) normal vector must not be a null vector (else unpredicted result).

References a, b, c, d, UPosition::toUnitVector(), UPosition::x, UPosition::y, and UPosition::z.

void UPlane::set ( UPosition  p1)

Set plane from the position on the plane closest to origin.

Parameters
p1is a the closest 3d position on the plane that is closest to the origin the position must not be a null vector (else unpredicted result).

References a, b, c, d, UPosition::dist(), UPosition::toUnitVector(), UPosition::x, UPosition::y, and UPosition::z.

void UPlane::set ( double  x,
double  y,
double  z 
)
inline

Set plane from the position on the plane closest to the origin.

Parameters
p1is the 3d position on the plane that is closest to the origin the position must not be a null vector (else unpredicted result).

References normalize().

void UPlane::set ( double  ia,
double  ib,
double  ic,
double  id 
)
inline

Set plane values direct, the a,b,c must not form a null vector.

Parameters
a,b,c,dis the plane parameters (will be normalixed to have a,b,c as a unit vector) normal vector must not be a null vector (else unpredicted result).

References a, b, c, d, and normalize().

Member Data Documentation

double UPlane::a
double UPlane::b
double UPlane::c
double UPlane::d

The documentation for this class was generated from the following files: