gishur.x2.core
Class XSegment

java.lang.Object
  |
  +--gishur.x2.core.XObject
        |
        +--gishur.x2.core.XIntersectableObject
              |
              +--gishur.x2.core.XParametricCurve
                    |
                    +--gishur.x2.core.XSegment
All Implemented Interfaces:
java.lang.Cloneable, Cloneable, Intersectable, Intersectable, java.io.Serializable

public class XSegment
extends XParametricCurve

Version:
1.0
Author:
Thomas Wolf
See Also:
Serialized Form

Fields inherited from class gishur.x2.core.XParametricCurve
DIRECTION_DOWN, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, STATE_BOTH_END, STATE_SOURCE_END, STATE_TARGET_END
 
Fields inherited from class gishur.x2.core.XObject
RESERVED_STATE_MAX_MASK, STATE_DIRTY, STATE_LOCKED, STATE_MUTABLE
 
Fields inherited from interface gishur.x2.core.Intersectable
FACES, POINT_INSIDE, POINT_ON_BORDER, POINT_OUTSIDE, POINTS, POINTS_CURVES
 
Fields inherited from interface gishur.core.geom.Intersectable
DEFAULT
 
Constructor Summary
XSegment(double x, double y, boolean src, double slope, int dir, boolean sc, boolean tc)
          Creates a segment with endpoints to (x,y) and an unknown point in direction dir using slope slope.
XSegment(double x1, double y1, double x2, double y2)
          Creates a segment with source point (x1,y1) and target point (x2,y2).
XSegment(double x1, double y1, double x2, double y2, boolean sc, boolean tc)
          Creates a segment with source point (x1,y1) and target point (x2,y2).
XSegment(XPoint source, XPoint target)
          Creates a segment with source point source and target point target.
XSegment(XPoint source, XPoint target, boolean sc, boolean tc)
          Creates a segment with source point source and target point target.
 
Method Summary
 XPoint calculatePoint(double x)
          Returns a point on the segment with x-coordinate x or null if no such point exists.
 XPoint calculatePointOnBorder(double x, boolean src)
          Calculates a point on the segment that has signed distance x from the source point (src==true) resp. from the target point (src==false).
 java.lang.Object clone()
          Creates a new object of the same class as this object.
 XPoint closestPoint(XPoint p)
          Returns a point on the segment that is closest to p.
static XSegment createDualLine(XPoint p)
          Returns the dual point to this line.
static XSegment createLine(double x1, double y1, double x2, double y2)
          Creates a line going through (x1,y1) and (x2,y2).
static XSegment createLine(XPoint source, XPoint target)
          Creates a line going through source and target.
static XSegment createRay(double x1, double y1, double x2, double y2)
          Creates a ray from (x1,y1) through (x2,y2).
static XSegment createRay(int dir, double slope, XPoint target)
          Creates a ray ending at target that points in direction dir (from target) and has slope slope.
static XSegment createRay(XPoint source, double slope, int dir)
          Creates a ray from source that points in direction dir and has slope slope.
static XSegment createRay(XPoint source, XPoint target)
          Creates a ray from source through target.
static XSegment createSegment(double x1, double y1, double x2, double y2)
          Creates a segment with source point (x1,y1) and target point (x2,y2).
static XSegment createSegment(XPoint source, XPoint target)
          Creates a segment with source point source and target point target.
 int direction()
          Returns the direction this directed segment points to.
 XPoint dualPoint()
          Returns the dual point to this line.
 boolean equals(java.lang.Object o)
          Determines whether two objects (this and o) are equal.
 boolean equals(XSegment s)
          Determines whether two segments are equal.
 XSegment flip()
          Flips source and target points.
 java.lang.Object getOldXObject()
          Returns corresponding old gishur.x-object.
protected  XObject[] getXObjectMembers()
          This method should return all XObject members that contain geometric information.
 boolean horizontal()
          Returns true if the segment is horizontal.
 java.lang.Object intersection(int mode, java.lang.Object o)
          Calculates the intersection between this object and the given object o.
 boolean isLine()
          Returns true, if this XSegment is a straight line.
 boolean isRay()
          Returns true, if this XSegment is a ray.
 boolean isSegment()
          Returns true, if this XSegment is a (real) segment.
 double length()
          Returns the length of this segment, e.g. the distance between source and target (no matter if source or target are open).
 int locate(XPoint p)
          Locates the specified point.
 void makeImmutable()
          Makes this object immutable.
 void makeMutable()
          Makes this object mutable.
 int orientation(XPoint p)
          Return an indicator of where the point p lies with respect to the directed line this.
 boolean parallel(XSegment s)
          Returns true, if the given Segment is parallel to this segment.
 double param(XPoint p)
          Calculates the parameter for the curve of a given point.
 XPoint plumb(XPoint p)
          Returns a point on this segment through a plumb by p to the segment.
 XPoint plumbTo(XPoint p, XSegment l)
          Returns the intersection point by the orthogonal line to this and throught p with the given segment l.
 XPoint point(double t)
          Calculates a point on the curve with parameter t.
 void set(double x1, double y1, double x2, double y2)
          Sets this segment to (x1,y1)-(x2,y2).
 void set(double x1, double y1, double x2, double y2, boolean sc, boolean tc)
          Sets this segment to (x1,y1)-(x2,y2) with source / target closed according to sc / tc. The object must be mutable.
 void set(XPoint source, XPoint target)
          Sets this segment to source-target. If either (or both) point is null, the point won't be overwritten.
 void set(XPoint source, XPoint target, boolean sc, boolean tc)
          Sets this segment to source-target with source / target closed according to sc / tc. If either (or both) point is null, the point won't be overwritten.
 void setRay(double x, double y, double slope, int dir)
          Sets this segment endpoints to (x,y) and an unknown point in direction dir using slope slope. The object must be mutable.
 void setRay(XPoint source, double slope, int dir)
          Sets this segment endpoints to source and an unknown point in direction dir using slope slope. If the point is null, the point won't be overwritten.
 void setSource(XPoint source)
          Sets the source point to source (if not null).
 void setTarget(XPoint target)
          Sets the target point to target (if not null).
 double slope()
          Returns the slope of this segment.
 XPoint source()
          Return the source point of the segment.
 boolean supportIntersection(int mode, java.lang.Object o)
          Returns true, if this class (or object) provides intersection with the given object o.
 XSegment swapPoints()
          Swaps source and target points and preserves the open sides, e.g. a ray points to the same direction after swapping points.
 XPoint target()
          Return the target point of the segment.
 XSegment toLine()
          Returns a line from this object.
 XSegment toRay()
          Returns a ray from this object (which is at the target point open).
 XSegment toSegment()
          Returns a segment from this object.
 java.lang.String toString()
          Returns a string representation of the segment.
 XObject transform(double m00, double m01, double m02, double m10, double m11, double m12)
          Transforms this XObject by the given affine transformation matrix.
 XPoint vector(double t, int dir, boolean normalize)
          Returns a (normalized) vector in the specified direction relative to this segment at a point on the segment with parameter t.
 XPoint vector(int dir, boolean normalize)
          Returns a (normalized) vector in the specified direction relative to this segment.
 boolean vertical()
          Returns true if the segment is vertical.
 double y_abs()
          Returns the y-value of the intersection of the line through source and target with the y-axis.
 
Methods inherited from class gishur.x2.core.XParametricCurve
checkParam, finite, hasNoEnd, inverseDirection, liesInterior, majorEndPoint, minorEndPoint, normal, normal, setSourceEnd, setTargetEnd, sourceEnd, tangent, tangent, targetEnd
 
Methods inherited from class gishur.x2.core.XIntersectableObject
contains, contains, liesOn
 
Methods inherited from class gishur.x2.core.XObject
checkState, checkStateCleared, clearDirty, clearState, copy, dirty, getMutable, inverseTransform, lock, locked, modify, mutable, restoreMutability, rotate, scale, setState, state, state, toString_complete, toString_state, transform, translate, translate, unlock
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XSegment

public XSegment(double x1,
                double y1,
                double x2,
                double y2,
                boolean sc,
                boolean tc)
Creates a segment with source point (x1,y1) and target point (x2,y2). The boolean values sc and tc determine if the segment is open at the source/target point(s), e.g. if the object is a real segment (both true), a ray (exactly one true) or a line (both false).
Parameters:
x1,y1 - source point
x2,y2 - target point
sc - line ends at source point
tc - line ends at target point

XSegment

public XSegment(XPoint source,
                XPoint target,
                boolean sc,
                boolean tc)
Creates a segment with source point source and target point target. The boolean values sc and tc determine if the segment is open at the source/target point(s), e.g. if the object is a real segment (both true), a ray (exactly one true) or a line (both false).
Parameters:
source - source point
target - target point
sc - line ends at source point
tc - line ends at target point
Throws:
GeomException - if source or target point is null

XSegment

public XSegment(double x,
                double y,
                boolean src,
                double slope,
                int dir,
                boolean sc,
                boolean tc)
Creates a segment with endpoints to (x,y) and an unknown point in direction dir using slope slope. The value of src specifies if (x,y) will be source (true) or target (false). The values of sc and tc determine this object to be a segment, line or ray. Is sc false then the segment will be elongated beyond the source point otherwise it will be an endpoint - same applies to tc and the target point.
Parameters:
x,y - source/target point
src - if true then (x,y) is source, else it is target
slope - slope of segment
dir - the direction used (any constant of {XParametricCurve.DIRECTION_UP, XParametricCurve.DIRECTION_DOWN,XParametricCurve.DIRECTION_LEFT,XParametricCurve.DIRECTION_RIGHT})
sc - if true, segment will be closed at the source point (ray or segment)
tc - if true, segment will be closed at the target point (ray or segment)
Throws:
GeomException - if invalid direction constant

XSegment

public XSegment(double x1,
                double y1,
                double x2,
                double y2)
Creates a segment with source point (x1,y1) and target point (x2,y2).
Parameters:
x1,y1 - source point
x2,y2 - target point

XSegment

public XSegment(XPoint source,
                XPoint target)
Creates a segment with source point source and target point target.
Parameters:
source - source point
target - target point
Throws:
GeomException - if source or target point is null
Method Detail

createSegment

public static XSegment createSegment(double x1,
                                     double y1,
                                     double x2,
                                     double y2)
Creates a segment with source point (x1,y1) and target point (x2,y2).
Parameters:
x1,y1 - source point
x2,y2 - target point
Returns:
Segment (x1,y1)-(x2,y2).

createSegment

public static XSegment createSegment(XPoint source,
                                     XPoint target)
Creates a segment with source point source and target point target.
Parameters:
source - source point
target - target point
Returns:
Segment source-target.
Throws:
GeomException - if source or target point is null

createRay

public static XSegment createRay(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
Creates a ray from (x1,y1) through (x2,y2).
Parameters:
x1,y1 - source point
x2,y2 - target point
Returns:
Ray (x1,y1)->(x2,y2).

createRay

public static XSegment createRay(XPoint source,
                                 XPoint target)
Creates a ray from source through target.
Parameters:
source - source point
target - target point
Returns:
Ray source->target.
Throws:
GeomException - if source or target point is null

createRay

public static XSegment createRay(XPoint source,
                                 double slope,
                                 int dir)
Creates a ray from source that points in direction dir and has slope slope.
Parameters:
source - source point
slope - the rays slope
dir - direction (a constant of {XParametricCurve.DIRECTION_RIGHT, XParametricCurve.DIRECTION_LEFT,XParametricCurve.DIRECTION_UP,XParametricCurve.DIRECTION_DOWN})
Returns:
Ray pointing from source in direction dir with slope slope.
Throws:
GeomException - if source point is null

createRay

public static XSegment createRay(int dir,
                                 double slope,
                                 XPoint target)
Creates a ray ending at target that points in direction dir (from target) and has slope slope.
Parameters:
dir - direction (a constant of {XParametricCurve.DIRECTION_RIGHT, XParametricCurve.DIRECTION_LEFT,XParametricCurve.DIRECTION_UP,XParametricCurve.DIRECTION_DOWN})
slope - the rays slope
target - target point
Returns:
Ray pointing from target in direction dir with slope slope.
Throws:
GeomException - if target point is null

createLine

public static XSegment createLine(double x1,
                                  double y1,
                                  double x2,
                                  double y2)
Creates a line going through (x1,y1) and (x2,y2).
Parameters:
x1,y1 - source point
x2,y2 - target point
Returns:
Line through (x1,y1) and (x2,y2).

createLine

public static XSegment createLine(XPoint source,
                                  XPoint target)
Creates a line going through source and target.
Parameters:
source - source point
target - target point
Returns:
Line through source and target.
Throws:
GeomException - if source or target point is null

createDualLine

public static XSegment createDualLine(XPoint p)
Returns the dual point to this line. The map is:
      p=(a,b)  ->  p*={Y=aX+b}
      g*(-a,b) <-  g={Y=aX+b} 
Returns:
Dual point.

toString

public java.lang.String toString()
Returns a string representation of the segment. Open endpoints are marked with "<<" respectively ">>".
Overrides:
toString in class XObject
Returns:
a string representation of the object.

clone

public java.lang.Object clone()
Creates a new object of the same class as this object.
Overrides:
clone in class XObject
Returns:
a clone of this instance.
Throws:
OutOfMemoryError - if there is not enough memory.
See Also:
Cloneable

equals

public boolean equals(XSegment s)
Determines whether two segments are equal.
Parameters:
s - segment to compare with this.
Returns:
True, if the two segments are equal.

equals

public boolean equals(java.lang.Object o)
Determines whether two objects (this and o) are equal.
Overrides:
equals in class java.lang.Object
Parameters:
o - Object to compare with.
Returns:
True, if the two objects are equal.

makeMutable

public void makeMutable()
Makes this object mutable. This means this Object can modify its coordinates (and some other geometric information). This must be assured by every subclass of XObject itself - but propagation to all XObject members contained by this class (returned by getXObjectMembers()) is assured by this method.
Overrides:
makeMutable in class XObject

makeImmutable

public void makeImmutable()
Makes this object immutable. This means this Object cannot modify its coordinates (and some other geometric information). This must be assured by every subclass of XObject itself - but propagation to all XObject members contained by this class (returned by getXObjectMembers()) is assured by this method.
Overrides:
makeImmutable in class XObject

getXObjectMembers

protected XObject[] getXObjectMembers()
This method should return all XObject members that contain geometric information. The result will be used by makeMutable(), makeImmutable(), XObject.clearDirty(), XObject.lock() and XObject.unlock(). To make this work there must not occur circular dependencies.
Overrides:
getXObjectMembers in class XObject
Returns:
Array with all XObject members (or null if none).

source

public XPoint source()
Return the source point of the segment.
Overrides:
source in class XParametricCurve
Returns:
Source point.

target

public XPoint target()
Return the target point of the segment.
Overrides:
target in class XParametricCurve
Returns:
Target point.

isLine

public boolean isLine()
Returns true, if this XSegment is a straight line.

isSegment

public boolean isSegment()
Returns true, if this XSegment is a (real) segment.

isRay

public boolean isRay()
Returns true, if this XSegment is a ray.

vertical

public boolean vertical()
Returns true if the segment is vertical.
Returns:
True is segment is vertical.

horizontal

public boolean horizontal()
Returns true if the segment is horizontal.
Returns:
True is segment is horizontal.

parallel

public boolean parallel(XSegment s)
Returns true, if the given Segment is parallel to this segment.
Parameters:
s - the other segment
Returns:
True, if s and this are parallel.

orientation

public int orientation(XPoint p)
Return an indicator of where the point p lies with respect to the directed line this. The value will be XPoint.ORIENTATION_LEFT if p lies left of this, XPoint.ORIENTATION_RIGHT if it lies to the right or XPoint.ORIENTATION_COLLINEAR if p is collinear with this segment.
Parameters:
p - the point
Returns:
The orientation of p with respect to this (one constant of {ORIENTATION_LEFT,ORIENTATION_RIGHT, ORIENTATION_COLLINEAR})
Throws:
GeomException - p is null

y_abs

public double y_abs()
Returns the y-value of the intersection of the line through source and target with the y-axis.
Returns:
Y-coordinate value of the intersection with the y-axis.

slope

public double slope()
Returns the slope of this segment.
Returns:
The slope of this segment.

length

public double length()
Returns the length of this segment, e.g. the distance between source and target (no matter if source or target are open).
Returns:
Length of the segment.

direction

public int direction()
Returns the direction this directed segment points to.
Returns:
Direction of this segment (a constant of {XParametricCurve.DIRECTION_RIGHT, XParametricCurve.DIRECTION_LEFT,XParametricCurve.DIRECTION_UP,XParametricCurve.DIRECTION_DOWN}).

vector

public XPoint vector(int dir,
                     boolean normalize)
Returns a (normalized) vector in the specified direction relative to this segment. The value of dir specifies if the vector should point along the segment (XParametricCurve.DIRECTION_UP), point in the opposite direction (XParametricCurve.DIRECTION_DOWN), points orthogonal to the right (XParametricCurve.DIRECTION_RIGHT) or points orthogonal to the left (XParametricCurve.DIRECTION_LEFT).
Parameters:
dir - direction constant
normalize - true, if result vector should be normalized
Returns:
Vector in direction to the segment or orthogonal to it.
Throws:
GeomException - if dir has an illegal value.

vector

public XPoint vector(double t,
                     int dir,
                     boolean normalize)
Returns a (normalized) vector in the specified direction relative to this segment at a point on the segment with parameter t. The value of dir specifies if the vector should point tangential along the segment (XParametricCurve.DIRECTION_UP), point tangential in the opposite direction (XParametricCurve.DIRECTION_DOWN), point normal to the segment to the right (XParametricCurve.DIRECTION_RIGHT) or point normal to the segment to the left (XParametricCurve.DIRECTION_LEFT).
Overrides:
vector in class XParametricCurve
Parameters:
t - parameter of the segment point where to calculate the vector
dir - direction constant
normalize - true, if result vector should be normalized
Returns:
Vector in direction to the segment or orthogonal to it.
Throws:
GeomException - if dir has an illegal value.
See Also:
vector(int,boolean)

point

public XPoint point(double t)
Calculates a point on the curve with parameter t. If the curve is XParametricCurve.finite(), then holds 0≤t≤1.
Overrides:
point in class XParametricCurve
Parameters:
t - parameter
Point - on the curve with parameter t or null if the parameter is not valid.

param

public double param(XPoint p)
Calculates the parameter for the curve of a given point. The point must lie on the curve or an GeomException will be thrown.
Overrides:
param in class XParametricCurve
Parameters:
p - point
Returns:
Parameter of p.
Throws:
GeomException - if p does not lie on the curve

calculatePoint

public XPoint calculatePoint(double x)
Returns a point on the segment with x-coordinate x or null if no such point exists.
Parameters:
x - x-coordinate
Returns:
point on segment with specified x-coordinate

calculatePointOnBorder

public XPoint calculatePointOnBorder(double x,
                                     boolean src)
Calculates a point on the segment that has signed distance x from the source point (src==true) resp. from the target point (src==false).
Parameters:
x - signed length parameter
if - true, measured from source, else measured from target
Returns:
Point on the segment with signed distance x or null if no such point.

plumb

public XPoint plumb(XPoint p)
Returns a point on this segment through a plumb by p to the segment. null will be returned, if the orthogonal line along the plumb does not hit the segment.
Parameters:
p - point to plumb from
Returns:
Point on the segment or null
Throws:
GeomException - if p is null

plumbTo

public XPoint plumbTo(XPoint p,
                      XSegment l)
Returns the intersection point by the orthogonal line to this and throught p with the given segment l.
Parameters:
p - point
l - segment
Returns:
A point on l.
Throws:
GeomException - if any argument is null

closestPoint

public XPoint closestPoint(XPoint p)
Returns a point on the segment that is closest to p. The result can be p if p lies on the segment.
Parameters:
p - point to search from
Returns:
Closest point to p on the segment.

dualPoint

public XPoint dualPoint()
Returns the dual point to this line. The map is:
      p=(a,b)  ->  p*={Y=aX+b}
      g*(-a,b) <-  g={Y=aX+b} 
Returns:
Dual point.

flip

public XSegment flip()
Flips source and target points. The open sides don't flip, e.g. a ray points in the opposite direction, after flipping.
See Also:
swapPoints()

swapPoints

public XSegment swapPoints()
Swaps source and target points and preserves the open sides, e.g. a ray points to the same direction after swapping points.
See Also:
flip()

set

public void set(double x1,
                double y1,
                double x2,
                double y2,
                boolean sc,
                boolean tc)
Sets this segment to (x1,y1)-(x2,y2) with source / target closed according to sc / tc.

The object must be mutable.

Parameters:
x1,y1 - source point
x2,y2 - target point
sc - segment is closed (true) or open (false) on source point
tc - segment is closed (true) or open (false) on target point
Throws:
GeomException - if object is immutable

set

public void set(double x1,
                double y1,
                double x2,
                double y2)
Sets this segment to (x1,y1)-(x2,y2). The object must be mutable.
Parameters:
x1,y1 - source point
x2,y2 - target point
Throws:
GeomException - if object is immutable

set

public void set(XPoint source,
                XPoint target,
                boolean sc,
                boolean tc)
Sets this segment to source-target with source / target closed according to sc / tc.

If either (or both) point is null, the point won't be overwritten. The object must be mutable.

Parameters:
source - source point
target - target point
sc - segment is closed (true) or open (false) on source point
tc - segment is closed (true) or open (false) on target point
Throws:
GeomException - if object is immutable

set

public void set(XPoint source,
                XPoint target)
Sets this segment to source-target.

If either (or both) point is null, the point won't be overwritten. The object must be mutable.

Parameters:
source - source point
target - target point
Throws:
GeomException - if object is immutable

setRay

public void setRay(double x,
                   double y,
                   double slope,
                   int dir)
Sets this segment endpoints to (x,y) and an unknown point in direction dir using slope slope.

The object must be mutable.

Parameters:
x,y - source point
slope - slope of segment
dir - the direction used (any constant of {XParametricCurve.DIRECTION_UP, XParametricCurve.DIRECTION_DOWN,XParametricCurve.DIRECTION_LEFT,XParametricCurve.DIRECTION_RIGHT})
Throws:
GeomException - if invalid direction constant or if object is immutable

setRay

public void setRay(XPoint source,
                   double slope,
                   int dir)
Sets this segment endpoints to source and an unknown point in direction dir using slope slope.

If the point is null, the point won't be overwritten. The object must be mutable.

Parameters:
source - source point
slope - slope of segment
dir - the direction used (any constant of {XParametricCurve.DIRECTION_UP, XParametricCurve.DIRECTION_DOWN,XParametricCurve.DIRECTION_LEFT,XParametricCurve.DIRECTION_RIGHT})
Throws:
GeomException - if invalid direction constant or if object is immutable

setSource

public void setSource(XPoint source)
Sets the source point to source (if not null). The object must be mutable.
Overrides:
setSource in class XParametricCurve
Parameters:
source - source point
Throws:
GeomException - if object is immutable

setTarget

public void setTarget(XPoint target)
Sets the target point to target (if not null). The object must be mutable.
Overrides:
setTarget in class XParametricCurve
Parameters:
target - target point
Throws:
GeomException - if object is immutable

toSegment

public XSegment toSegment()
Returns a segment from this object. The return value is this if this object is a segment (XParametricCurve.STATE_BOTH_END is set) or it is mutable. In all other cases a new XSegment object will be returned. Note that in this case source and target points refer to the same objects than this source and target points.
Returns:
Segment.

toRay

public XSegment toRay()
Returns a ray from this object (which is at the target point open). The return value is this if this object is a ray or it is mutable. In all other cases a new XSegment object will be returned. Note that in this case source and target points refer to the same objects than this source and target points.
Returns:
Ray.

toLine

public XSegment toLine()
Returns a line from this object. The return value is this if this object is a line (XParametricCurve.STATE_BOTH_END is cleared) or it is mutable. In all other cases a new XSegment object will be returned. Note that in this case source and target points refer to the same objects than this source and target points.
Returns:
Line.

transform

public XObject transform(double m00,
                         double m01,
                         double m02,
                         double m10,
                         double m11,
                         double m12)
Transforms this XObject by the given affine transformation matrix.
Overrides:
transform in class XObject
Parameters:
m00,m01,m02 - first row of the transformation matrix
m10,m11,m12 - second row of the transformation matrix
Returns:
transformed XObject (this, only if it is mutable, otherwise a new XObject represeting the transformed object)

supportIntersection

public boolean supportIntersection(int mode,
                                   java.lang.Object o)
Returns true, if this class (or object) provides intersection with the given object o. It should only return true, if this class provides an intersection metod itself.
Parameters:
mode - intersection mode
o - object for intersection
Returns:
true, if intersection is supported

intersection

public java.lang.Object intersection(int mode,
                                     java.lang.Object o)
Calculates the intersection between this object and the given object o. This method should not be called directly, rather construct an Intersection object (it will call this method). The returned Object is either a single intersection object or an array or a list (based upon BasicList) of intersection objects.

This method does not verify, if the intersection with o can be calculated (use supportIntersection(int, java.lang.Object) instead), but throws an IntersectionException, if an error occures. This means, it may be that supportIntersection(int, java.lang.Object) returns true and this method does not throw an exception and returns with a (propably wrong) result.

The resulted objects are always newly created and do not point to existing objects.

Parameters:
mode - intersection mode
o - object for intersection
Returns:
intersection object(s)
Throws:
IntersectionException - if an error occured

locate

public int locate(XPoint p)
Locates the specified point. The result is a point location constant (one of {Intersectable.POINT_INSIDE,Intersectable.POINT_OUTSIDE, Intersectable.POINT_ON_BORDER}). Because this class represents line objects, Intersectable.POINT_INSIDE cannot occur as return value.
Parameters:
p - point to locate
Returns:
location constant
Throws:
GeomException - p is null

getOldXObject

public java.lang.Object getOldXObject()
Returns corresponding old gishur.x-object.
Overrides:
getOldXObject in class XObject
Returns:
Corresponding old gishur.x-object.