JTS Topology Suite version 1.12

com.vividsolutions.jts.geomgraph
Class EdgeEnd

java.lang.Object
  extended by com.vividsolutions.jts.geomgraph.EdgeEnd
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
DirectedEdge, EdgeEndBundle

public class EdgeEnd
extends java.lang.Object
implements java.lang.Comparable

Models the end of an edge incident on a node. EdgeEnds have a direction determined by the direction of the ray from the initial point to the next point. EdgeEnds are comparable under the ordering "a has a greater angle with the x-axis than b". This ordering is used to sort EdgeEnds around a node.

Version:
1.7

Field Summary
protected  Edge edge
           
protected  Label label
           
 
Constructor Summary
protected EdgeEnd(Edge edge)
           
  EdgeEnd(Edge edge, Coordinate p0, Coordinate p1)
           
  EdgeEnd(Edge edge, Coordinate p0, Coordinate p1, Label label)
           
 
Method Summary
 int compareDirection(EdgeEnd e)
          Implements the total order relation:
 int compareTo(java.lang.Object obj)
           
 void computeLabel(BoundaryNodeRule boundaryNodeRule)
           
 Coordinate getCoordinate()
           
 Coordinate getDirectedCoordinate()
           
 double getDx()
           
 double getDy()
           
 Edge getEdge()
           
 Label getLabel()
           
 Node getNode()
           
 int getQuadrant()
           
protected  void init(Coordinate p0, Coordinate p1)
           
 void print(java.io.PrintStream out)
           
 void setNode(Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

edge

protected Edge edge

label

protected Label label
Constructor Detail

EdgeEnd

protected EdgeEnd(Edge edge)

EdgeEnd

public EdgeEnd(Edge edge,
               Coordinate p0,
               Coordinate p1)

EdgeEnd

public EdgeEnd(Edge edge,
               Coordinate p0,
               Coordinate p1,
               Label label)
Method Detail

init

protected void init(Coordinate p0,
                    Coordinate p1)

getEdge

public Edge getEdge()

getLabel

public Label getLabel()

getCoordinate

public Coordinate getCoordinate()

getDirectedCoordinate

public Coordinate getDirectedCoordinate()

getQuadrant

public int getQuadrant()

getDx

public double getDx()

getDy

public double getDy()

setNode

public void setNode(Node node)

getNode

public Node getNode()

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable

compareDirection

public int compareDirection(EdgeEnd e)
Implements the total order relation:

a has a greater angle with the positive x-axis than b

Using the obvious algorithm of simply computing the angle is not robust, since the angle calculation is obviously susceptible to roundoff. A robust algorithm is: - first compare the quadrant. If the quadrants are different, it it trivial to determine which vector is "greater". - if the vectors lie in the same quadrant, the computeOrientation function can be used to decide the relative orientation of the vectors.


computeLabel

public void computeLabel(BoundaryNodeRule boundaryNodeRule)

print

public void print(java.io.PrintStream out)

JTS Topology Suite version 1.12