oaSegment Class Reference


Public Methods

 oaSegment ()
 oaSegment (const oaPoint &headIn, const oaPoint &tailIn)
 oaSegment (const oaVector &vec, const oaPoint &ref)
oaPointhead ()
oaPointtail ()
oaCoordx1 ()
oaCoordx2 ()
oaCoordy1 ()
oaCoordy2 ()
const oaPointhead () const
const oaPointtail () const
oaCoord x1 () const
oaCoord x2 () const
oaCoord y1 () const
oaCoord y2 () const
void set (const oaPoint &head, const oaPoint &tail)
void set (const oaVector &vec, const oaPoint &ref)
oaBoolean isHorizontal () const
oaBoolean isVertical () const
oaBoolean isOrthogonal () const
oaOffset getDeltaX () const
oaOffset getDeltaY () const
oaDouble distanceFrom2 (const oaPoint &point) const
oaDouble distanceFrom2 (const oaPoint &point, oaPoint &loc) const
oaBoolean contains (const oaPoint &point, oaBoolean includeEnds=true) const
oaBoolean collinearContains (const oaPoint &point, oaBoolean includeEnds=true) const
oaBoolean intersects (const oaSegment &seg, oaBoolean includeEnds=true) const
oaBoolean intersects (const oaSegment &seg, oaBoolean includeEnds, oaBoolean includeOverlap) const
oaBoolean intersects (const oaSegment &seg, oaPoint &iPt, oaBoolean mustIntersect=true) const
oaBoolean operator== (const oaSegment &segment) const
oaBoolean operator!= (const oaSegment &segment) const

Detailed Description

The oaSegment class is a utility class the represents a line segment. It is available for general application use. It is not used for the API of any managed class. oaBox::overlaps can be called with an oaSegment.


Constructor & Destructor Documentation

oaSegment::oaSegment   [inline]
 

This function constructs an empty oaSegment instance.

oaSegment::oaSegment const oaPoint &    headIn,
const oaPoint &    tailIn
[inline]
 

This function constructs an oaSegment instance and initializes the segment by specifying the end points.

Parameters:
headIn The head of the segment
tailIn The tail of the segment

oaSegment::oaSegment const oaVector &    vec,
const oaPoint &    ref
[inline]
 

This function constructs an oaSegment instance and initializes the segment by specifying the head and a vector from the head.

Parameters:
vec The vector from the head
ref The head of the segment


Member Function Documentation

oaBoolean oaSegment::collinearContains const oaPoint &    point,
oaBoolean    includeEnds = true
const
 

This function returns true if the specified collinear point lies on this segment. The flag includeEnds specifies whether the ends of the segments should be included or not.

Parameters:
point point to check
includeEnds specifies whether the ends of the segments should be included or not

oaBoolean oaSegment::contains const oaPoint &    point,
oaBoolean    includeEnds = true
const
 

This function returns true if the specified point lies on this segment.

Parameters:
point The point that must lie on the segment
includeEnds specifies whether the ends of the segments should be included or not

double oaSegment::distanceFrom2 const oaPoint &    point,
oaPoint &    loc
const
 

This function finds the location on the segment that is closest to the specified point and returns the square of the distance from this location to the point.

Parameters:
point The measurement point
loc The location on the segment

double oaSegment::distanceFrom2 const oaPoint &    point const
 

This function returns the square of the distance from the specified point to the closest point on this segment. This function is faster than the previous function, but does not determine the location of the point.

Parameters:
point The measurement point

oaInt4 oaSegment::getDeltaX   const [inline]
 

This function returns the deltaX between the head and tail of this segment.

oaInt4 oaSegment::getDeltaY   const [inline]
 

This function returns the deltaY between the head and tail of this segment.

const oaPoint & oaSegment::head   const [inline]
 

This function returns a reference to the head point of this segment.

oaPoint & oaSegment::head   [inline]
 

This function returns the head point of this segment.

oaBoolean oaSegment::intersects const oaSegment &    seg,
oaPoint &    iPt,
oaBoolean    mustIntersect = true
const
 

This function finds the point of intersection between this segment and segment seg.

Parameters:
seg The name of the segment to intersect
iPt The point of intersection
mustIntersect Specifies that the point of intersection must lie on both segments

oaBoolean oaSegment::intersects const oaSegment &    seg,
oaBoolean    includeEnds,
oaBoolean    includeOverlap
const
 

This function returns true if this segment intersects segment seg. The flag includeEnds specifies whether the ends of the segments should be included or not. It does this in a fast way, although it doesn't tell you where the intersection occurs.

The flag, allowOverlap, determines whether or not overlapping segments are viewed as intersecting (true = yes; false = no).

Parameters:
seg 
includeEnds 
includeOverlap 

oaBoolean oaSegment::intersects const oaSegment &    seg,
oaBoolean    includeEnds = true
const
 

This function returns true if this segment intersects segment seg. This function intersects segment seg quickly, but this function does not inform you where the intersection occurs. This function is faster than the previous function.

Parameters:
seg The name of the segment to intersect
includeEnds Includes the ends of the segments

oaBoolean oaSegment::isHorizontal   const [inline]
 

This function returns true if the slope of the segment is zero.

oaBoolean oaSegment::isOrthogonal   const [inline]
 

This function returns true if the slope of the segment is zero or +/- infinity.

oaBoolean oaSegment::isVertical   const [inline]
 

This function returns true if the slope of the segment is +/- infinity.

oaBoolean oaSegment::operator!= const oaSegment &    segment const [inline]
 

This function compares this oaSegment with the specified oaSegment segment and returns true if the segments are not equal.

oaBoolean oaSegment::operator== const oaSegment &    segment const [inline]
 

This function compares this oaSegment with the specified oaSegment segment and returns true if the segments are equal.

void oaSegment::set const oaVector &    vec,
const oaPoint &    ref
[inline]
 

This function sets the segment to start at the given reference point and point along the specified vector.

Parameters:
vec The vector from the head
ref The head of the segment

void oaSegment::set const oaPoint &    head,
const oaPoint &    tail
[inline]
 

This function sets the segment to have the specified end points.

Parameters:
head The head of the segment
tail The tail of the segment

const oaPoint & oaSegment::tail   const [inline]
 

This function returns the tail point of this segment.

oaPoint & oaSegment::tail   [inline]
 

This function returns the tail point of this segment.

oaInt4 oaSegment::x1   const [inline]
 

This function returns the X value of the head point of this segment.

oaInt4 & oaSegment::x1   [inline]
 

This function returns a reference to the X value of the head point of this segment.

oaInt4 oaSegment::x2   const [inline]
 

This function returns the X value of the tail point of this segment.

oaInt4 & oaSegment::x2   [inline]
 

This function returns a reference to the X value of the tail point of this segment.

oaInt4 oaSegment::y1   const [inline]
 

This function returns the Y value of the head point of this segment.

oaInt4 & oaSegment::y1   [inline]
 

This function returns a reference to the Y value of the head point of this segment.

oaInt4 oaSegment::y2   const [inline]
 

This function returns the Y value of the tail point of this segment.

oaInt4 & oaSegment::y2   [inline]
 

This function returns a reference to the Y value of the tail point of this segment.


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

Return to top of page