edu.uci.ics.dillenco.simplegraph01
Class HalfEdge

java.lang.Object
  extended by edu.uci.ics.dillenco.simplegraph01.HalfEdge

public class HalfEdge
extends Object

A HalfEdge object represents a half-edge, which consists of a QEdge (in the sense of the Guibas-Stolfi quadedge structure), a rotation (0 thru 3), and a flip coefficient (0 or 1)


Constructor Summary
HalfEdge(HalfEdge h)
          Constructs a HalfEdge, taking its QEdge, rotation, and flip coefficients from the input parameter.
HalfEdge(QEdge e, int rot)
          Constructs a HalfEdge from the given QEdge and rotation coefficients.
HalfEdge(QEdge e, int rot, int flip)
          Constructs a HalfEdge from the given QEdge, rotation, and flip coefficients.
HalfEdge(QEdge e, int flip, Node v)
          Constructs a HalfEdge from the given QEdge and flip coefficient with prescribed origin Node.
HalfEdge(QEdge e, int flip, Node v, boolean neighbor)
          Constructs a HalfEdge from the given QEdge and flip coefficient with prescribed origin or neighbor Node.
HalfEdge(QEdge e, Node v)
          Constructs a HalfEdge from the given QEdge with prescribed origin Node.
HalfEdge(QEdge e, Node v, boolean neighbor)
          Constructs a HalfEdge from the given QEdge with prescribed origin or neighbor Node.
 
Method Summary
 String charName(Graph g)
           
 void flipOp()
          Apply the flip operation to this this HalfEdge.
 int getFlip()
          Get the flip coefficient associated with this HalfEdge.
 Node getHead()
          Return the head of this HalfEdge, which must be a directed edge.
 Node getNeighbor()
          Get the neighbor node of this HalfEdge.
 HalfEdge getONext()
          Return the next HalfEdge with the same origin as this one.
 HalfEdge getOPrev()
          Return the previous HalfEdge with the same origin as this one.
 Node getOrigin()
          Get the origin node of this HalfEdge.
 QEdge getQEdge()
          Get the Qedge associated with this HalfEdge.
 int getRot()
          Get the rotation coefficient associated with this HalfEdge.
 HalfEdge getSym()
          Return the HalfEdge symmetric to this halfEdge.
 Node getTail()
          Return the tail of this HalfEdge, which must be a directed edge.
 boolean isDirected()
          Return whether this HalfEdge is a directed edge.
 boolean isHead()
          Return whether the origin of this half edge is the head of the edge to which it belongs (i.e., whether this edge is directed toward the origin of this half-edge).
 boolean isTail()
          Return whether the origin of this half edge is the tail of the edge to which it belongs (i.e., whether this edge is directed away from the origin of this half-edge).
 void rotateOp(int r)
          Apply the rotation (rot) operation to this this HalfEdge.
 void symOp()
          Apply the sym operation to this this HalfEdge.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HalfEdge

public HalfEdge(QEdge e,
                int rot,
                int flip)
Constructs a HalfEdge from the given QEdge, rotation, and flip coefficients.

Parameters:
e - the base QEdge
rot - the rotation coefficient
flip - the flip coefficient

HalfEdge

public HalfEdge(QEdge e,
                int rot)
Constructs a HalfEdge from the given QEdge and rotation coefficients. The flip coefficient defaults to 0. Equivalent to HalfEdge(e,rot,0) The flip coefficient defaults to 0.

Parameters:
e - the base QEdge
rot - the rotation coefficient.

HalfEdge

public HalfEdge(HalfEdge h)
Constructs a HalfEdge, taking its QEdge, rotation, and flip coefficients from the input parameter. This is, in effect, a clone of the halfEdge, although the QEdge associated with the HalfEdge is not cloned.

Parameters:
h - the HalfEdge to be cloned.

HalfEdge

public HalfEdge(QEdge e,
                int flip,
                Node v,
                boolean neighbor)
Constructs a HalfEdge from the given QEdge and flip coefficient with prescribed origin or neighbor Node. If the specified node v is not incident on the QEdge, a GraphCheckException is thrown.

Parameters:
e - the base QEdge.
flip - the flip coefficient.
v - the node to be either the origin or the neighbor node.
neighbor - true if v is to be the neighbor node, false if v is to be the origin node.

HalfEdge

public HalfEdge(QEdge e,
                Node v,
                boolean neighbor)
Constructs a HalfEdge from the given QEdge with prescribed origin or neighbor Node. If the specified node v is not incident on the QEdge, a GraphCheckException is thrown. The flip coefficient defaults to 0. Equivalent to HalfEdge(e,0,v,neighbor)

Parameters:
e - the base QEdge.
v - the node to be either the origin or the neighbor node.
neighbor - true if v is to be the neighbor node, false if v is to be the origin node.

HalfEdge

public HalfEdge(QEdge e,
                int flip,
                Node v)
Constructs a HalfEdge from the given QEdge and flip coefficient with prescribed origin Node. If the specified node v is not incident on the QEdge, a GraphCheckException is thrown. Equivalent to HalfEdge(e,flip,v,false)

Parameters:
e - the base QEdge.
flip - the flip coefficient.
v - the node to be the origin node.

HalfEdge

public HalfEdge(QEdge e,
                Node v)
Constructs a HalfEdge from the given QEdge with prescribed origin Node. If the specified node v is not incident on the QEdge, a GraphCheckException is thrown. The flip coefficient defaults to 0. Equivalent to HalfEdge(e,0,v,false)

Parameters:
e - the base QEdge.
v - the node to be the origin node.
Method Detail

toString

public String toString()
Overrides:
toString in class Object

charName

public String charName(Graph g)

getQEdge

public QEdge getQEdge()
Get the Qedge associated with this HalfEdge.

Returns:
the associated QEdge

getRot

public int getRot()
Get the rotation coefficient associated with this HalfEdge.

Returns:
the associated rotation coefficient

getFlip

public int getFlip()
Get the flip coefficient associated with this HalfEdge.

Returns:
the associated flip coefficient

flipOp

public void flipOp()
Apply the flip operation to this this HalfEdge. Modifies the HalfEdge.


rotateOp

public void rotateOp(int r)
Apply the rotation (rot) operation to this this HalfEdge. Modifies the HalfEdge.

Parameters:
r - the rotation to be applied. This should be a number in the range 0-3, although no check is made.

symOp

public void symOp()
Apply the sym operation to this this HalfEdge. Modifies the HalfEdge.


getOrigin

public Node getOrigin()
Get the origin node of this HalfEdge.

Returns:
the origin node

getNeighbor

public Node getNeighbor()
Get the neighbor node of this HalfEdge. This is the origin node of the symmetric half edge.

Returns:
the neighbor node

isDirected

public boolean isDirected()
Return whether this HalfEdge is a directed edge.

Returns:
true if directed

isHead

public boolean isHead()
Return whether the origin of this half edge is the head of the edge to which it belongs (i.e., whether this edge is directed toward the origin of this half-edge).

Returns:
true if the origin is the head of the edge

isTail

public boolean isTail()
Return whether the origin of this half edge is the tail of the edge to which it belongs (i.e., whether this edge is directed away from the origin of this half-edge).

Returns:
true if the origin is the tail of the edge

getHead

public Node getHead()
Return the head of this HalfEdge, which must be a directed edge. If the edge is not directed, a GraphCheckException will be thrown.

Returns:
the head of this edge
Throws:
GraphCheckException - if the edge is not directed

getTail

public Node getTail()
Return the tail of this HalfEdge, which must be a directed edge. If the edge is not directed, a GraphCheckException will be thrown.

Returns:
the tail of this edge
Throws:
GraphCheckException - if the edge is not directed

getONext

public HalfEdge getONext()
Return the next HalfEdge with the same origin as this one.

Returns:
the next HalfEdge with the same origin as this one

getOPrev

public HalfEdge getOPrev()
Return the previous HalfEdge with the same origin as this one.

Returns:
the previous HalfEdge with the same origin as this one

getSym

public HalfEdge getSym()
Return the HalfEdge symmetric to this halfEdge.

Returns:
a new Half Edge with the same base QEdge and the same orientation as this one, but with the origin and neighbor vertices reversed.