AURobotServers
4
|
#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 |
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.
UPlane::UPlane | ( | ) |
Constrctor
References clear().
UPlane::~UPlane | ( | ) |
Destructor
|
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().
|
inline |
Get distance from point to plane.
p1 | is the 3d point |
References distSigned(), getLineCrossing(), getOnPlane(), and getPlaneCrossing().
Referenced by UResObj3d::doGndPlaneMask(), and UImg3Dpoints::getRansacPlane().
|
inline |
Get signed distance from point to plane. The distance is positive if the position is at the origin-side of the plane.
p1 | is the 3d point |
References a, b, c, d, UPosition::x, UPosition::y, and UPosition::z.
Referenced by dist(), getOnPlane(), UGroundPatches::heightAnalysis(), UGrid3D::setVoxel(), and testPlane().
Get position on plane, where the line is crossing the plane.
crossingLine | is the line that is assumed to cross the line |
notParallel | is 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. |
References a, absd(), b, c, d, ULine::getPositionOnLine(), ULine::pos, ULine::vec, UPosition::x, UPosition::y, and UPosition::z.
Referenced by dist().
|
inline |
Get normal vector
Referenced by getPlaneCrossing(), and UImg3Dpoints::getRansacPlane().
Get point on plane nearest to a point off the plane.
p1 | is the position off the plane. |
References a, b, c, and distSigned().
Referenced by dist(), UPosRot::getCamToRobPlane(), UPosRot::getRobToCamPlane(), and testPlane().
Get the line from intersection of two planes.
plane2 | is the second plane. |
notParallel | is true if the result is OK. |
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().
|
inline |
void UPlane::normalize | ( | ) |
const char * UPlane::print | ( | const char * | preStr, |
char * | buff, | ||
const int | buffCnt | ||
) |
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.
p1 | is a 3d position on plane |
p2 | is a 3d position on plane |
p3 | is 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().
Set plane from a position and a normal vector.
p1 | is a 3d position on the plane |
n1 | is 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.
p1 | is 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.
|
inline |
Set plane from the position on the plane closest to the origin.
p1 | is 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().
|
inline |
Set plane values direct, the a,b,c must not form a null vector.
a,b,c,d | is 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().
double UPlane::a |
parameter values for a general plane
Referenced by clear(), distSigned(), getLineCrossing(), getNormal(), getOnPlane(), getPlaneCrossing(), UFuncObj3d::handleCloud(), isValid(), normalize(), print(), and set().
double UPlane::b |
Referenced by clear(), distSigned(), getLineCrossing(), getNormal(), getOnPlane(), getPlaneCrossing(), UFuncObj3d::handleCloud(), isValid(), normalize(), print(), and set().
double UPlane::c |
Referenced by clear(), distSigned(), getLineCrossing(), getNormal(), getOnPlane(), getPlaneCrossing(), UFuncObj3d::handleCloud(), isValid(), normalize(), print(), and set().
double UPlane::d |
Referenced by clear(), distSigned(), getLineCrossing(), getPlaneCrossing(), UFuncObj3d::handleCloud(), normalize(), print(), and set().