gishur.x2.core
Class Intersection

java.lang.Object
  |
  +--gishur.core.geom.Intersection
        |
        +--gishur.x2.core.Intersection

public class Intersection
extends Intersection

Intersection class for the planar X-objects. This class contains special access methods for various X-objects.

Example

(for calculating the intersection between two segments)

 // Create the segments...
 XSegment s1=new XSegment(100,100,600,400);
 XSegment s2=new XSegment(600,50,50,300);
 // Calculate the intersection...
 Intersection inter=new Intersection(s1,s2);
 // Analyze the result...
 if (inter.singleXPoint()) 
  System.out.println("Intersection at "+inter.xpoint());
 else
  System.out.println("No Intersection!");

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
Intersection()
          Constructs an empty Intersection.
Intersection(java.lang.Object o1, java.lang.Object o2)
          Constructs an Intersection object through calculating the intersection of the two given objects.
 
Method Summary
 boolean singleXPoint()
          Returns true, if and only if the intersection set consists of one single intersection point of type XPoint.
 XPoint xpoint()
          Returns the (first) intersection point of the intersection set or null if the intersection set does not contain a XPoint.
 XPoint xpoint(int i)
          Returns the i-th intersection point of type XPoint or null if there is no i-th intersection object or the i-th intersection object is no XPoint.
 XSegment xsegment(int i)
          Returns the i-th intersection segment of type XSegment or null if there is no i-th intersection object or the i-th intersection object is no XSegment.
 
Methods inherited from class gishur.core.geom.Intersection
empty, getObjectArray, getObjectList, length, object, object, single, toString, type, type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Intersection

public Intersection()
Constructs an empty Intersection.

Intersection

public Intersection(java.lang.Object o1,
                    java.lang.Object o2)
Constructs an Intersection object through calculating the intersection of the two given objects. The calculation is only possible, if at least one of the objects implements Intersectable and if that object supports the intersection with the other object. In all other cases an IntersectionException will be thrown.
Parameters:
o1,o2 - intersecting Objects
Throws:
IntersectionException -  
Method Detail

singleXPoint

public boolean singleXPoint()
Returns true, if and only if the intersection set consists of one single intersection point of type XPoint.
Returns:
true, if single intersection point

xpoint

public XPoint xpoint()
Returns the (first) intersection point of the intersection set or null if the intersection set does not contain a XPoint.
Returns:
the (first) intersection point

xpoint

public XPoint xpoint(int i)
Returns the i-th intersection point of type XPoint or null if there is no i-th intersection object or the i-th intersection object is no XPoint.
Parameters:
i - index of the requested intersection object
Returns:
i-th intersection point

xsegment

public XSegment xsegment(int i)
Returns the i-th intersection segment of type XSegment or null if there is no i-th intersection object or the i-th intersection object is no XSegment.
Parameters:
i - index of the requested intersection object
Returns:
i-th intersection segment