AURobotServers
4
|
#include <u2dline.h>
Public Member Functions | |
virtual void | clear () |
const char * | codeXml (const char *name, char *buff, const int buffCnt, const char *extraAtt) |
int | getCircleCrossings (double cx, double cy, double r, double *t1, double *t2) |
virtual const char * | getDataType () |
double | getDistanceSigned (double px, double py, int *where) |
U2Dpos | getFirstEnd () |
double | getHeading () |
U2Dpos | getOtherEnd () |
U2Dpos | getPositionOnLine (const double t) |
double | getPositionOnLine (U2Dpos *point) |
double | getPositionOnLine (U2Dpos point) |
double | getPositionOnLine (double px, double py) |
double | heading () |
bool | isCrossing (U2Dseg *other, U2Dpos *crossing) |
const char * | print (const char *prestring, char *buff, const int buffCnt) |
int | set2P (const double x1, const double y1, const double x2, const double y2) |
void | setFromPoints (const UPosition *pos1, const UPosition *pos2) |
void | setFromPoints (UPosition pos1, UPosition pos2) |
void | setFromPoints (U2Dpos pos1, U2Dpos pos2) |
void | setFromPoints (double x1, double y1, double x2, double y2) |
void | setFromPose (double x1, double y1, double h1, double len=1.0) |
virtual void | shiftLeft (double dist) |
virtual void | shiftRight (double dist) |
U2Dseg () | |
virtual | ~U2Dseg () |
Public Member Functions inherited from U2Dlined | |
double | A () |
double | B () |
double | C () |
double | distanceSigned (const double x, const double y) |
bool | fit (double fx[], double fy[], int count, double *V=NULL) |
bool | fitV (double fx[], double fy[], int count, double *V) |
void | getARLine (double *a, double *r) |
bool | getCrossing (U2Dlined L2, double *x, double *y) |
void | getOnLine (const double x, const double y, double *lx, double *ly) |
void | getPV (double *Px, double *Py, double *Vx, double *Vy) |
double | heading () |
void | print (const char *prestring) |
int | set (const double A, const double B, const double C) |
int | set (double fx[], double fy[], int count, double *V=NULL) |
int | set2P (const double x1, const double y1, const double x2, const double y2) |
void | setAR (const double a, const double r) |
int | setPH (const double Px, const double Py, const double h) |
int | setPV (const double Px, const double Py, const double Vx, const double Vy) |
bool | setXline (double sX, double sY, double sX2, double sXY, int count) |
bool | setYline (double sX, double sY, double sY2, double sXY, int count) |
U2Dlined () | |
U2Dlined (const double A, const double B, const double C) | |
U2Dlined (const double a, const double r) | |
U2Dlined (const double x1, const double y1, const double x2, const double y2) | |
double | variance (double fx[], double fy[], int count, double *E=NULL) |
double | vx () |
double | vy () |
virtual | ~U2Dlined () |
Public Member Functions inherited from U2Dpos | |
UMatrix4 | asCol2 () |
UMatrix4 | asCol3 () |
UMatrix4 | asRow2 () |
UMatrix4 | asRow3 () |
void | clear () |
double | dist () |
double | dist (UPosition b) |
double | dist (U2Dpos b) |
double | heading () |
double | length () |
U2Dpos | operator= (UPosition pos) |
U2Dpos | operator= (U2Dseg seg) |
void | set (double ix, double iy) |
U2Dpos (double ix, double iy) | |
U2Dpos () | |
Public Member Functions inherited from UDataBase | |
bool | isA (const char *typeString) |
virtual bool | isAlsoA (const char *typeString) |
virtual void | snprint (const char *preString, char *buff, const int buffCnt) |
UDataBase () | |
virtual | ~UDataBase () |
Public Attributes | |
double | length |
Public Attributes inherited from U2Dpos | |
double | x |
double | y |
Additional Inherited Members | |
Protected Attributes inherited from U2Dlined | |
double | lA |
double | lB |
double | lC |
This is a 2D line with parameters in double precition
|
inline |
Constructor
|
inlinevirtual |
destructor
|
virtual |
Clear
References U2Dline::lA, U2Dline::lB, and U2Dline::lC.
Referenced by UResLocater::makeRowPolygon().
const char * U2Dseg::codeXml | ( | const char * | name, |
char * | buff, | ||
const int | buffCnt, | ||
const char * | extraAtt | ||
) |
Code this line as an XML tag into this string buffer. like <line name="" x="" y="" th="" length="" [extraAtt]/>
name | is an optional value to a name attribute . |
buff | is the buffer to write into. |
buffCnt | is the length of the buffer. |
extraAtt | is an optional string with extra attributes to put into the tag. |
References U2Dline::heading().
Referenced by UResLobst::codeLines().
int U2Dseg::getCircleCrossings | ( | double | cx, |
double | cy, | ||
double | r, | ||
double * | t1, | ||
double * | t2 | ||
) |
Get crossings with a circle
cx,cy | is the center of the circle |
r | is the circle radius |
t1,t2 | is the distances from the line origin to the crossings, if no crossings, then these values are unchanged. |
References U2Dline::lA, U2Dline::lB, and sqr().
Referenced by UAvoidPath2::createMidPathPoints(), and test2Dseg().
|
inlinevirtual |
Get (end) type string for this structure
Reimplemented from UDataBase.
double U2Dseg::getDistanceSigned | ( | double | px, |
double | py, | ||
int * | where | ||
) |
Get distance from a 3D point to a line segemnt, i.e. distance to the closest end or if closer to a point on the line segment, then this distance. the distance is squared. The optional second parameter returns the closest point (if != NULL) where = 0 if on line segment, 1 if closest to 'pos', and 2 if closest to 'other end'
References dist, U2Dline::distanceSigned(), signofd(), U2Dpos::x, and U2Dpos::y.
Referenced by UAvoidPath2::getClosestObst2(), UResMapObst::getNearObstacles(), UPolygon::isInsideConvex(), UResLobst::makeObst(), and UResLocater::match_points().
|
inline |
Get position of first end of line segment as a 2D position
Referenced by UAvoidCellGraph::findCellPointPath(), UAvoidPath2::getClosestObst2(), UFuncRoseBot::handleCommand(), UFuncLoca2::markBestJointMatches(), ULineMatch::print(), and UAvoidPoint::tPointVisible().
|
inline |
Get heading along line
References dist, U2Dline::lA, and U2Dline::lB.
Referenced by UResRoseBot::findRows(), UResMapObst::getNearObstacles(), UFuncRoseBot::handleCommand(), and UFuncLobst::testMethodCall().
|
inline |
Get position of other end of line segment
Referenced by ULineMatch::addToPoly(), UFuncLoca2::correlateLines(), UAvoidCellGraph::findCellPointPath(), UResRoseBot::findRows(), UAvoidPath2::getClosestObst2(), UResMapObst::getNearObstacles(), UFuncRoseBot::handleCommand(), isCrossing(), UFuncLoca2::markBestJointMatches(), ULineMatch::print(), UFuncLobst::testMethodCall(), and UAvoidPoint::tPointVisible().
U2Dpos U2Dseg::getPositionOnLine | ( | const double | t | ) |
Get position on line this many meters from start position in direction of vector [A,B];
References U2Dline::lA, U2Dline::lB, U2Dpos::x, and U2Dpos::y.
Referenced by UAvoidPath2::createMidPathPoints(), UAvoidPath2::expandPolyToSegment(), UResRoseBot::findRows(), UPose2pose::get2line(), UPose2pose::get2lineStartLeft(), UAvoidPath2::getClosestObst2(), UFuncRoseBot::handleCommand(), UAvoidPath2::insertNewPointAfter(), UAvoidPath2::isAfterDestination(), UResLocater::makeRowPolygon(), test2Dseg(), and UAvoidPoint::tPointVisible().
double U2Dseg::getPositionOnLine | ( | U2Dpos * | point | ) |
Get position parameter on the line that is closest to this point
point | the point anywhere in space. |
References U2Dline::lA, U2Dline::lB, U2Dpos::x, and U2Dpos::y.
double U2Dseg::getPositionOnLine | ( | U2Dpos | point | ) |
Get position parameter on the line that is closest to this point
point | the point anywhere in space. |
References U2Dline::lA, U2Dline::lB, U2Dpos::x, and U2Dpos::y.
double U2Dseg::getPositionOnLine | ( | double | px, |
double | py | ||
) |
Get position parameter on the line that is closest to this point
px,py | the point anywhere in space. |
References U2Dline::lA, and U2Dline::lB.
|
inline |
get heading of the line segment
References U2Dlined::heading().
Is this line segment crossing the other segment, true if crossing (within ends), and The crossing is returned in 'crossing' If no crossing is found, 'crossing' may be changed.
References U2Dline::getCrossing(), getOtherEnd(), U2Dpos::x, and U2Dpos::y.
const char * U2Dseg::print | ( | const char * | prestring, |
char * | buff, | ||
const int | buffCnt | ||
) |
|
inline |
Set from two points. returns -1 if too close.
Set line from two points. Reference position is set from pos1, and other end is set to pos2 so that "pos1 + vec * length" ends at pos2.
References UPosition::x, and UPosition::y.
Referenced by UAvoidPath2::avoidToTheLeft(), UResLobst::codeLines(), UAvoidPath2::convertToManSeq(), UAvoidCellGraph::findCellPointPath(), UAvoidPath2::getClosestObst2(), UResMapObst::getNearObstacles(), UAvoidPath2::insertNewPointAfter(), UAvoidPath2::isAfterDestination(), UPolygon::isInsideConvex(), UResLobst::makeObst(), UResLocater::match_points(), UResLobst::methodCallV(), test2Dseg(), UAvoidPoint::tPointVisible(), and UAvoidPath2::turnCentreCrossing().
Set line from two points. Reference position is set from pos1, and other end is set to pos2 so that "pos1 + vec * length" ends at pos2.
References UPosition::x, and UPosition::y.
Set line from two points. Reference position is set from pos1, and other end is set to pos2 so that "pos1 + vec * length" ends at pos2.
References U2Dline::print(), U2Dpos::x, and U2Dpos::y.
void U2Dseg::setFromPoints | ( | double | x1, |
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Set line segment from points. a line segment is a start point, a direction vector and a length.
x1,y1,z1 | defines the first (start) point |
x2,y2,z2 | defines the end point |
void U2Dseg::setFromPose | ( | double | x1, |
double | y1, | ||
double | h1, | ||
double | len = 1.0 |
||
) |
Set 2D line segment from a pose (x1, y1, h1) with an optional length.
x,y,h | is the pose |
len | is the optiomal length (default is 1). |
Referenced by UAvoidPath2::createMidPathPoints(), UAvoidCellGraph::findCellPointPath(), UPose2pose::get2line(), UPose2pose::get2lineStartLeft(), and test2Dseg().
|
virtual |
Shift the line this distance to the left This moves the C parameter and the start position.
dist | is the distance shifted. |
Reimplemented from U2Dlined.
References U2Dline::lA, U2Dline::lB, and U2Dlined::shiftLeft().
|
virtual |
Shift the line this distance to the right This moves the C parameter and the start position.
dist | is the distance shifted. |
Reimplemented from U2Dlined.
References U2Dline::lA, U2Dline::lB, and U2Dlined::shiftRight().
double U2Dseg::length |
Length of line segment
Referenced by UAvoidPath2::expandPolyToSegment(), UResRoseBot::findRows(), UAvoidPath2::getClosestObst2(), UFuncRoseBot::handleCommand(), UAvoidPath2::insertNewPointAfter(), UAvoidPath2::isAfterDestination(), UResLocater::makeRowPolygon(), UFuncLoca2::markBestJointMatches(), UFuncLobst::testMethodCall(), and UAvoidPoint::tPointVisible().