computational.geometry
Class TwoSegmentIntersection

java.lang.Object
  extended by computational.geometry.TwoSegmentIntersection

public class TwoSegmentIntersection
extends java.lang.Object


Field Summary
static int HIT_ENDPOINT
          One segment's endpoint hits the the other segment.
static int NO_INTERSECTION
          The two segments do not intersect.
static int PROPER_INTERSECTION
          The two segments intersects in an internal point.
static int SEGMENT_OVERLAY
          The two segments overlays, either partially or completely.
 
Constructor Summary
TwoSegmentIntersection(Segment s0, Segment s1)
          Builds a TwoSegmentIntersection object wrapping information about intersection between two segments.
 
Method Summary
 RealShape getIntersection()
          Returns the intersection between the two segments, that is the set of points belonging to both segments.
 java.util.List getSegments()
          Returns a list containing the two segments interested in this intersection.
 int getType()
          Returns the type of intersection between the two segments, i.e.: NO_INTERSECTION if segments do not intersect; PROPER_INTERSECTION if segments intersect properly; SEGMENT_OVERLAY if segments overlays, either partially or completely; HIT_ENDPOINT if one segment's endpoint hits the the other segment.
static int intersect(Segment s, Segment t)
          Computes the kind of intersection between two segments.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HIT_ENDPOINT

public static final int HIT_ENDPOINT
One segment's endpoint hits the the other segment.

See Also:
Constant Field Values

NO_INTERSECTION

public static final int NO_INTERSECTION
The two segments do not intersect.

See Also:
Constant Field Values

PROPER_INTERSECTION

public static final int PROPER_INTERSECTION
The two segments intersects in an internal point.

See Also:
Constant Field Values

SEGMENT_OVERLAY

public static final int SEGMENT_OVERLAY
The two segments overlays, either partially or completely.

See Also:
Constant Field Values
Constructor Detail

TwoSegmentIntersection

public TwoSegmentIntersection(Segment s0,
                              Segment s1)
Builds a TwoSegmentIntersection object wrapping information about intersection between two segments.

Parameters:
s0 - the first segment.
s1 - the second segment.
Method Detail

getIntersection

public RealShape getIntersection()
Returns the intersection between the two segments, that is the set of points belonging to both segments. We have three cases:


getSegments

public java.util.List getSegments()
Returns a list containing the two segments interested in this intersection.

Returns:
a list containing the two segments.

getType

public int getType()
Returns the type of intersection between the two segments, i.e.:

Returns:
the type of intersection between the two segments.

intersect

public static int intersect(Segment s,
                            Segment t)
Computes the kind of intersection between two segments.

Parameters:
s - the first segment.
t - the second segment.
Returns:
one of the following values:
  • NO_INTERSECTION if segments do not intersect;
  • PROPER_INTERSECTION if segments intersect properly;
  • SEGMENT_OVERLAY if segments overlays, either partially or completely;
  • HIT_ENDPOINT if one segment's endpoint hits the the other segment.
See Also:
BasicTests.intersectProperly(Segment,Segment), BasicTests.intersect(Segment,Segment)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object