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

#include <uline.h>

Inheritance diagram for ULineSegment:
Inheritance graph

Public Member Functions

virtual void clear ()
 
virtual const char * getDataType ()
 
double getDistanceFromSeg (UPosition point, int *where=NULL)
 
double getDistanceFromSegSq (UPosition point, int *where=NULL)
 
double getDistanceXYSigned (UPosition point, int *where)
 
UPosition getOtherEnd ()
 
bool getSegmentCrossingXY (ULineSegment *other, UPosition *crossing)
 
void print (const char *prestring=NULL)
 
virtual void setFromPoints (const UPosition *pos1, const UPosition *pos2)
 
virtual void setFromPoints (UPosition pos1, UPosition pos2)
 
void setFromPoints (double x1, double y1, double z1, double x2, double y2, double z2)
 
void show (const char *prestring=NULL)
 
virtual void snprint (const char *prestring, char *buff, const int buffCnt)
 
- Public Member Functions inherited from ULine
int getCylinderCrossings (UPosition center, double r, double *t1, double *t2)
 
double getDistance (UPosition *point)
 
double getDistanceSq (UPosition *point)
 
double getDistanceSq (UPosition point)
 
UPosition getPlaneLineCrossing (ULine crossingLine, bool *notParallel=NULL)
 
double getPositionOnLine (UPosition *point)
 
double getPositionOnLine (UPosition point)
 
UPosition getPositionOnLine (const double t)
 
double getPositionOnLineXY (UPosition *point)
 
double getPositionOnLineXY (UPosition point)
 
UPosition getPositionOnLineXY (const double t)
 
int getSphereCrossings (UPosition center, double r, double *t1, double *t2)
 
bool getXYCrossing (ULine other, UPosition *crossingXY)
 
double getXYHeading ()
 
double getXYsignedDistance (UPosition pos)
 
bool isValid ()
 
void normalize ()
 
void print (const char *prestring=NULL)
 
void set (UPosition iPos, UPosition iVec)
 
void set2D (double x, double y, double heading)
 
void setFromPoints (double x1, double y1, double z1, double x2, double y2, double z2)
 
void show (const char *prestring=NULL)
 
void turn90degXY (bool left)
 
 ULine ()
 
 ULine (double Px, double Py, double Pz, double Vx, double Vy, double Vz)
 
virtual ~ULine ()
 
- Public Member Functions inherited from UDataBase
bool isA (const char *typeString)
 
virtual bool isAlsoA (const char *typeString)
 
 UDataBase ()
 
virtual ~UDataBase ()
 

Public Attributes

double length
 
- Public Attributes inherited from ULine
UPosition pos
 
UPosition vec
 

Detailed Description

Class to describe a 3D line using a 3D position, a unit vector and a length.

Member Function Documentation

void ULineSegment::clear ( void  )
virtual

Clear

Reimplemented from ULine.

References ULine::clear().

virtual const char* ULineSegment::getDataType ( )
inlinevirtual

Get (end) type string for this structure

Reimplemented from ULine.

References ULine::clear(), ULine::setFromPoints(), ULine::show(), and ULine::snprint().

Referenced by UFunctionVarPool::initCallReturnStructType().

double ULineSegment::getDistanceFromSeg ( UPosition  point,
int *  where = NULL 
)
inline

Get distance to line segment from a point (not squared). where = 0 if on line segment, 1 if closest to 'pos', and 2 if closest to 'other end'

Referenced by UPolygon::getDistance(), and testLineSegment().

double ULineSegment::getDistanceFromSegSq ( UPosition  point,
int *  where = NULL 
)

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 UPosition::distSq(), ULine::getPositionOnLine(), and ULine::pos.

double ULineSegment::getDistanceXYSigned ( UPosition  point,
int *  where 
)

Get — in XY space — the signed distance of 'point' relative to this segment. Positive is to the right of segment - seen from first end in direction towards other end. Returnes distance to either end or to a point on line whatever is closest. If 'where' is not NULL, then the closest part is returned here as: 0=point on line, 1= first point, 2= other end.

References dist, U2Dlined::distanceSigned(), ULine::getPositionOnLine(), ULine::pos, U2Dlined::set2P(), setFromPoints(), signofd(), UPosition::x, UPosition::y, and UPosition::z.

Referenced by UPolygon::getDistanceXYsigned2(), UManArc::getMinDistanceXYSigned(), UPolygon::isOverlappingXYconvex2(), UAvoidPath2::setClosestPoint(), UReactivePath::testForObstacleNearExit(), and testSignedDistance().

UPosition ULineSegment::getOtherEnd ( )
inline
bool ULineSegment::getSegmentCrossingXY ( ULineSegment other,
UPosition crossing 
)

Is this line segment crossing the other segment, Returns true if crossing (within ends), and The crossing (x,y-only) is returned in 'crossing' If no crossing is found, 'crossing' may be changed.

References a, ULine::getPositionOnLineXY(), and ULine::getXYCrossing().

Referenced by ULaserMeasurement::clear(), UPolygon::getCrossings(), UFakeMap::getFake2range(), UPolygon::isOverlappingXY(), UPolygon::isOverlappingXYconvex2(), UPolygon::isOverlappingXYtype(), and UAvoidLnkSeq::pathCrossing().

void ULineSegment::print ( const char *  prestring = NULL)
inline

Same as abowe

References ULine::show().

Referenced by testManLineToSeg(), and testManToSeg().

void ULineSegment::setFromPoints ( const UPosition pos1,
const UPosition pos2 
)
virtual
void ULineSegment::setFromPoints ( UPosition  pos1,
UPosition  pos2 
)
virtual

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.

Reimplemented from ULine.

References UPosition::dist(), and ULine::setFromPoints().

void ULineSegment::setFromPoints ( double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2 
)

Set line segment from points. a line segment is a start point, a direction vector and a length.

Parameters
x1,y1,z1defines the first (start) point
x2,y2,z2defines the end point

References ULine::setFromPoints(), and sqr().

void ULineSegment::show ( const char *  prestring = NULL)

Show values of line to console

References ULine::show().

Referenced by testLineSegment().

void ULineSegment::snprint ( const char *  prestring,
char *  buff,
const int  buffCnt 
)
virtual

Print values of line to string

Reimplemented from ULine.

References ULine::snprint().

Member Data Documentation

double ULineSegment::length

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