jwo.landserf.structure
Class Edge

java.lang.Object
  extended byjwo.landserf.structure.Edge
All Implemented Interfaces:
Serializable

public class Edge
extends Object
implements Serializable

Stores a 2d topological directional edge used for connecting 2d or higher dimensional features. Edge consists of 2 nodes P1 and P2 orderd P1->P2. Adapted from Zhao and Saalfeld, 1996.

Version:
2.2, 28th February, 2002.
Author:
Jo Wood
See Also:
Node, Triangle, Serialized Form

Field Summary
static int ALIGNED
          Indicates location aligned with directed edge.
static int LEFT
          Indicates location to the left of directed edge.
static int RIGHT
          Indicates location to the right of directed edge.
 
Constructor Summary
Edge(Node p1, Node p2)
          Creates an edge from the two given nodes.
 
Method Summary
 void calcEquation()
          Calculates the equation of the straight line that this edge forms a part of.
 int calcSide(Node node)
          Determines where the edge is in relation to a given node.
 Edge getInvEdge()
          Returns this edge's inverse (P2->P1).
 float getLength()
          Reports the 2d length of the edge.
 Edge getNextEdge()
          Returns the next anticlockwise edge in the sequence.
 Edge getNextHullEdge()
          Returns the next convex hull edge in the sequence.
 Node getP1()
          Returns the first point associated with this edge.
 Node getP2()
          Returns the second point associated with this edge.
 Triangle getTriang()
          Returns the triangle containing this edge.
 float getVersion()
          Reports the version of the object.
 void linkSymm(Edge edge)
          Creates a link to the symmetrical inverse of the supplied edge.
 Edge makeSymm()
          Creates a symmetrical inverse of this edge.
 Edge mostLeft()
          Traverses edge network and returns the left-most edge.
 Edge mostRight()
          Traverses edge network and returns the right-most edge.
 void p1ToEdge()
          Sets this edge to be the one pointed to by the first node.
 void setInvEdge(Edge edge)
          Sets the inverse (P2->P1) edge.
 void setNextEdge(Edge edge)
          Sets the next edge in the sequence.
 void setNextHullEdge(Edge edge)
          Sets the next convex hull edge in the sequence.
 void setTriang(Triangle triangle)
          Sets the triangle of which this edge forms a part.
 void setVersion(float version)
          Sets the version number of this object.
 String toString()
          Reports the coordinates of this edge.
 void update(Node p1, Node p2)
          Updates the topology and equation representing this edge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RIGHT

public static final int RIGHT
Indicates location to the right of directed edge.

See Also:
Constant Field Values

ALIGNED

public static final int ALIGNED
Indicates location aligned with directed edge.

See Also:
Constant Field Values

LEFT

public static final int LEFT
Indicates location to the left of directed edge.

See Also:
Constant Field Values
Constructor Detail

Edge

public Edge(Node p1,
            Node p2)
Creates an edge from the two given nodes.

Parameters:
p1 - First node of edge.
p2 - Second node of edge.
Method Detail

update

public void update(Node p1,
                   Node p2)
Updates the topology and equation representing this edge.

Parameters:
p1 - First node of edge.
p2 - Second node of edge.

makeSymm

public Edge makeSymm()
Creates a symmetrical inverse of this edge.

Returns:
Symmetrical inverse of this edge.

linkSymm

public void linkSymm(Edge edge)
Creates a link to the symmetrical inverse of the supplied edge.

Parameters:
edge - Symmetrical inverse of this edge.

calcSide

public int calcSide(Node node)
Determines where the edge is in relation to a given node.

Parameters:
node - Node to test with respect to this edge.
Returns:
Relative position of line (LEFT, RIGHT or ALIGNED).

calcEquation

public void calcEquation()
Calculates the equation of the straight line that this edge forms a part of.


p1ToEdge

public void p1ToEdge()
Sets this edge to be the one pointed to by the first node.


mostLeft

public Edge mostLeft()
Traverses edge network and returns the left-most edge.

Returns:
Left-most edge in a connected network.

mostRight

public Edge mostRight()
Traverses edge network and returns the right-most edge.

Returns:
Right-most edge in a connected network.

toString

public String toString()
Reports the coordinates of this edge. Overrides the method in Object.


getP1

public Node getP1()
Returns the first point associated with this edge.

Returns:
First node associated with this edge.

getP2

public Node getP2()
Returns the second point associated with this edge.

Returns:
Second point associated with this edge.

getLength

public float getLength()
Reports the 2d length of the edge.

Returns:
2d length of the edge.

getNextEdge

public Edge getNextEdge()
Returns the next anticlockwise edge in the sequence.

Returns:
Next anticlockwise edge.

setNextEdge

public void setNextEdge(Edge edge)
Sets the next edge in the sequence.

Parameters:
edge - Edge to add to sequence.

getInvEdge

public Edge getInvEdge()
Returns this edge's inverse (P2->P1).

Returns:
Inverse edge.

setInvEdge

public void setInvEdge(Edge edge)
Sets the inverse (P2->P1) edge.

Parameters:
edge - Inverse of this edge.

getNextHullEdge

public Edge getNextHullEdge()
Returns the next convex hull edge in the sequence.

Returns:
Next convex hull edge.

setNextHullEdge

public void setNextHullEdge(Edge edge)
Sets the next convex hull edge in the sequence.

Parameters:
edge - Next convex hull edge.

getTriang

public Triangle getTriang()
Returns the triangle containing this edge.

Returns:
Triangle containing this edge.

setTriang

public void setTriang(Triangle triangle)
Sets the triangle of which this edge forms a part.

Parameters:
triangle - Triangle that this edge belongs to.

getVersion

public float getVersion()
Reports the version of the object. This can be useful when serialising future (changed) versions of this class.

Returns:
Version number of this object.

setVersion

public void setVersion(float version)
Sets the version number of this object.

Parameters:
version - Version number of this object.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005