Esempio n. 1
0
  public void findEdge(List dirEdgeList) {
    /**
     * Check all forward DirectedEdges only. This is still general, because each edge has a forward
     * DirectedEdge.
     */
    for (Iterator i = dirEdgeList.iterator(); i.hasNext(); ) {
      DirectedEdge de = (DirectedEdge) i.next();
      if (!de.isForward()) continue;
      checkForRightmostCoordinate(de);
    }

    /**
     * If the rightmost point is a node, we need to identify which of the incident edges is
     * rightmost.
     */
    Assert.isTrue(
        minIndex != 0 || minCoord.equals(minDe.getCoordinate()),
        "inconsistency in rightmost processing");
    if (minIndex == 0) {
      findRightmostEdgeAtNode();
    } else {
      findRightmostEdgeAtVertex();
    }
    /** now check that the extreme side is the R side. If not, use the sym instead. */
    orientedDe = minDe;
    int rightmostSide = getRightmostSide(minDe, minIndex);
    if (rightmostSide == Position.LEFT) {
      orientedDe = minDe.getSym();
    }
  }
Esempio n. 2
0
 private void findRightmostEdgeAtNode() {
   Node node = minDe.getNode();
   DirectedEdgeStar star = (DirectedEdgeStar) node.getEdges();
   minDe = star.getRightmostEdge();
   // the DirectedEdge returned by the previous call is not
   // necessarily in the forward direction. Use the sym edge if it isn't.
   if (!minDe.isForward()) {
     minDe = minDe.getSym();
     minIndex = minDe.getEdge().getCoordinates().length - 1;
   }
 }