Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

ArLineSegment Class Reference

#include <ariaUtil.h>

Inheritance diagram for ArLineSegment:

ArLineFinderSegment List of all members.

Detailed Description

Represents a line segment in two-dimensional space.

The segment is defined by the coordinates of each endpoint.


Public Member Functions

 ArLineSegment (ArPose pose1, ArPose pose2)
 Constructor with endpoints as ArPose objects. Only X and Y components of the poses will be used.
 ArLineSegment (double x1, double y1, double x2, double y2)
 Constructor with endpoints.
 ArLineSegment ()
double getA (void) const
 Gets the A line parameter (see ArLine).
double getB (void) const
 Gets the B line parameter (see ArLine).
double getC (void) const
 Gets the C line parameter (see ArLine).
double getDistToLine (const ArPose pose)
 Gets the distance from this line segment to a point.
ArPose getEndPoint1 (void) const
 Get the first endpoint (X1, Y1).
ArPose getEndPoint2 (void) const
 Get the second endpoint of (X2, Y2).
double getLengthOf () const
 Determines the length of the line segment.
const ArLinegetLine (void) const
virtual double getPerpDist (const ArPose pose)
 Calculate the distance from the given point to (its projection on) this line segment.
bool getPerpPoint (const ArPose *pose, ArPose *perpPoint)
bool getPerpPoint (ArPose pose, ArPose *perpPoint)
 Determine the intersection point between this line segment, and a perpendicular line passing through the given pose (i.e. projects the given pose onto this line segment.).
virtual double getPerpSquaredDist (const ArPose pose)
 Calculate the squared distance from the given point to (its projection on) this line segment.
double getX1 (void) const
 Gets the x coordinate of the first endpoint.
double getX2 (void) const
 Gets the x coordinate of the second endpoint.
double getY1 (void) const
 Gets the y coordinate of the first endpoint.
double getY2 (void) const
 Gets the y coordinate of the second endpoint.
bool intersects (ArLineSegment *line, ArPose *pose)
bool intersects (const ArLine *line, ArPose *pose) const
 Determine where a line intersects this line segment.
bool linePointIsInSegment (ArPose *pose) const
 Internal function for seeing if a point on our line is within our segment.
void newEndPoints (const ArPose &pt1, const ArPose &pt2)
 Set new end points for this line segment.
void newEndPoints (double x1, double y1, double x2, double y2)
 Set new end points for this line segment.
virtual bool operator!= (const ArLineSegment &other) const
virtual bool operator< (const ArLineSegment &other) const
 Less than operator (for sets).
virtual bool operator== (const ArLineSegment &other) const
 Equality operator (for sets).

Protected Attributes

ArLine myLine
double myX1
double myX2
double myY1
double myY2


Constructor & Destructor Documentation

ArLineSegment::ArLineSegment  )  [inline]
 

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArLineSegment::ArLineSegment double  x1,
double  y1,
double  x2,
double  y2
[inline]
 

Constructor with endpoints.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.


Member Function Documentation

double ArLineSegment::getDistToLine const ArPose  pose  )  [inline]
 

Gets the distance from this line segment to a point.

If the point can be projected onto this line segment (i.e. a perpendicular line can be drawn through the point), then return that distance. Otherwise, return the distance to the closest endpoint.

Parameters:
pose the pointer of the pose to find the distance to

virtual double ArLineSegment::getPerpDist const ArPose  pose  )  [inline, virtual]
 

Calculate the distance from the given point to (its projection on) this line segment.

Parameters:
pose the the pose to find the perp point of
Returns:
if the pose does not intersect segment it will return < 0 if the pose intersects the segment it will return the distance to the intersection

bool ArLineSegment::getPerpPoint const ArPose pose,
ArPose perpPoint
[inline]
 

If there is no intersection, false is returned.

Parameters:
pose The X and Y components of this pose object indicate the point to project onto this line segment.
perpPoint The X and Y components of this pose object are set to indicate the intersection point
Returns:
true if an intersection was found and perpPoint was modified, false otherwise.
Java and Python Wrappers: Not available in Java or Python wrapper libraries. (This version simply allows you to pass the first pose as a pointer, in time-critical situations where a full copy of the object would impact performance.)

bool ArLineSegment::getPerpPoint ArPose  pose,
ArPose perpPoint
[inline]
 

Determine the intersection point between this line segment, and a perpendicular line passing through the given pose (i.e. projects the given pose onto this line segment.).

If there is no intersection, false is returned.

Parameters:
pose The X and Y components of this pose object indicate the point to project onto this line segment.
perpPoint The X and Y components of this pose object are set to indicate the intersection point
Returns:
true if an intersection was found and perpPoint was modified, false otherwise.
Java and Python Wrappers: Not available in Java or Python wrapper libraries.

virtual double ArLineSegment::getPerpSquaredDist const ArPose  pose  )  [inline, virtual]
 

Calculate the squared distance from the given point to (its projection on) this line segment.

Parameters:
pose the the pose to find the perp point of
Returns:
if the pose does not intersect segment it will return < 0 if the pose intersects the segment it will return the distance to the intersection

bool ArLineSegment::intersects ArLineSegment line,
ArPose pose
[inline]
 

Parameters:
line Line to check for intersection against this line segment.
pose if the lines intersect, the X and Y components of this pose are set to the point of intersection.
Returns:
true if they intersect, false if they do not

bool ArLineSegment::intersects const ArLine line,
ArPose pose
const [inline]
 

Determine where a line intersects this line segment.

Parameters:
line Line to check for intersection against this line segment.
pose if the lines intersect, the X and Y components of this pose are set to the point of intersection.
Returns:
true if they intersect, false if they do not


The documentation for this class was generated from the following file:
Generated on Thu Jan 7 10:34:42 2010 for Aria by  doxygen 1.4.2