JTS Topology Suite version 1.12

com.vividsolutions.jts.triangulate
Class Segment

java.lang.Object
  extended by com.vividsolutions.jts.triangulate.Segment

public class Segment
extends java.lang.Object

Models a constraint segment in a triangulation. A constraint segment is an oriented straight line segment between a start point and an end point.

Author:
David Skea, Martin Davis

Constructor Summary
Segment(Coordinate p0, Coordinate p1)
          Creates a new instance for the given points.
Segment(Coordinate p0, Coordinate p1, java.lang.Object data)
          Creates a new instance for the given points, with associated external data.
Segment(double x1, double y1, double z1, double x2, double y2, double z2)
          Creates a new instance for the given ordinates.
Segment(double x1, double y1, double z1, double x2, double y2, double z2, java.lang.Object data)
          Creates a new instance for the given ordinates, with associated external data.
 
Method Summary
 boolean equalsTopo(Segment s)
          Determines whether two segments are topologically equal.
 java.lang.Object getData()
          Gets the external data associated with this segment
 Coordinate getEnd()
          Gets the end coordinate of the segment
 double getEndX()
          Gets the end X ordinate of the segment
 double getEndY()
          Gets the end Y ordinate of the segment
 double getEndZ()
          Gets the end Z ordinate of the segment
 LineSegment getLineSegment()
          Gets a LineSegment modelling this segment.
 Coordinate getStart()
          Gets the start coordinate of the segment
 double getStartX()
          Gets the start X ordinate of the segment
 double getStartY()
          Gets the start Y ordinate of the segment
 double getStartZ()
          Gets the start Z ordinate of the segment
 Coordinate intersection(Segment s)
          Computes the intersection point between this segment and another one.
 void setData(java.lang.Object data)
          Sets the external data to be associated with this segment
 java.lang.String toString()
          Computes a string representation of this segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Segment

public Segment(double x1,
               double y1,
               double z1,
               double x2,
               double y2,
               double z2)
Creates a new instance for the given ordinates.


Segment

public Segment(double x1,
               double y1,
               double z1,
               double x2,
               double y2,
               double z2,
               java.lang.Object data)
Creates a new instance for the given ordinates, with associated external data.


Segment

public Segment(Coordinate p0,
               Coordinate p1,
               java.lang.Object data)
Creates a new instance for the given points, with associated external data.

Parameters:
p0 - the start point
p1 - the end point
data - an external data object

Segment

public Segment(Coordinate p0,
               Coordinate p1)
Creates a new instance for the given points.

Parameters:
p0 - the start point
p1 - the end point
Method Detail

getStart

public Coordinate getStart()
Gets the start coordinate of the segment

Returns:
a Coordinate

getEnd

public Coordinate getEnd()
Gets the end coordinate of the segment

Returns:
a Coordinate

getStartX

public double getStartX()
Gets the start X ordinate of the segment

Returns:
the X ordinate value

getStartY

public double getStartY()
Gets the start Y ordinate of the segment

Returns:
the Y ordinate value

getStartZ

public double getStartZ()
Gets the start Z ordinate of the segment

Returns:
the Z ordinate value

getEndX

public double getEndX()
Gets the end X ordinate of the segment

Returns:
the X ordinate value

getEndY

public double getEndY()
Gets the end Y ordinate of the segment

Returns:
the Y ordinate value

getEndZ

public double getEndZ()
Gets the end Z ordinate of the segment

Returns:
the Z ordinate value

getLineSegment

public LineSegment getLineSegment()
Gets a LineSegment modelling this segment.

Returns:
a LineSegment

getData

public java.lang.Object getData()
Gets the external data associated with this segment

Returns:
a data object

setData

public void setData(java.lang.Object data)
Sets the external data to be associated with this segment

Parameters:
data - a data object

equalsTopo

public boolean equalsTopo(Segment s)
Determines whether two segments are topologically equal. I.e. equal up to orientation.

Parameters:
s - a segment
Returns:
true if the segments are topologically equal

intersection

public Coordinate intersection(Segment s)
Computes the intersection point between this segment and another one.

Parameters:
s - a segment
Returns:
the intersection point, or null if there is none

toString

public java.lang.String toString()
Computes a string representation of this segment.

Overrides:
toString in class java.lang.Object
Returns:
a string

JTS Topology Suite version 1.12