Example #1
0
 /** @return the previous QuadEdge (pointing to this.orig) */
 public QuadEdge oprev() {
   return rot.onext().rot();
 }
Example #2
0
 /** @return the symetric (reverse) QuadEdge */
 public QuadEdge sym() {
   return rot.rot();
 }
Example #3
0
 /** @return the symetric dual QuadEdge */
 public QuadEdge rotSym() {
   return rot.sym();
 }
Example #4
0
 /**
  * Test if the Point p is on the line porting the edge
  *
  * @param e QuadEdge
  * @param p Point to test
  * @return true/false
  */
 public static boolean isOnLine(QuadEdge e, Point p) {
   // test if the vector product is zero
   if ((p.x - e.orig().x) * (p.y - e.dest().y) == (p.y - e.orig().y) * (p.x - e.dest().x))
     return true;
   return false;
 }
Example #5
0
 /**
  * Test if the Point p is at the right of the QuadEdge q.
  *
  * @param QuadEdge reference
  * @param p Point to test
  * @return true/false
  */
 public static boolean isAtRightOf(QuadEdge q, Point p) {
   return isCounterClockwise(p, q.dest(), q.orig());
 }
Example #6
0
 /**
  * Delete a QuadEdge
  *
  * @param q the QuadEdge to delete
  */
 public static void deleteEdge(QuadEdge q) {
   splice(q, q.oprev());
   splice(q.sym(), q.sym().oprev());
 }
Example #7
0
 public static void swapEdge(QuadEdge e) {
   QuadEdge a = e.oprev();
   QuadEdge b = e.sym().oprev();
   splice(e, a);
   splice(e.sym(), b);
   splice(e, a.lnext());
   splice(e.sym(), b.lnext());
   e.orig = a.dest();
   e.sym().orig = b.dest();
 }
Example #8
0
 /**
  * Create a new QuadEdge by connecting 2 QuadEdges
  *
  * @param e1,e2 the 2 QuadEdges to connect
  * @return the new QuadEdge
  */
 public static QuadEdge connect(QuadEdge e1, QuadEdge e2) {
   QuadEdge q = makeEdge(e1.dest(), e2.orig());
   splice(q, e1.lnext());
   splice(q.sym(), e2);
   return q;
 }
Example #9
0
  /**
   * attach/detach the two edges = combine/split the two rings in the dual space
   *
   * @param q1,q2 the 2 QuadEdge to attach/detach
   */
  public static void splice(QuadEdge a, QuadEdge b) {
    QuadEdge alpha = a.onext().rot();
    QuadEdge beta = b.onext().rot();

    QuadEdge t1 = b.onext();
    QuadEdge t2 = a.onext();
    QuadEdge t3 = beta.onext();
    QuadEdge t4 = alpha.onext();

    a.setOnext(t1);
    b.setOnext(t2);
    alpha.setOnext(t3);
    beta.setOnext(t4);
  }
Example #10
0
  /**
   * Create a new edge (i.e. a segment)
   *
   * @param orig origin of the segment
   * @param dest end of the segment
   * @return the QuadEdge of the origin point
   */
  public static QuadEdge makeEdge(Point orig, Point dest) {
    QuadEdge q0 = new QuadEdge(null, null, orig);
    QuadEdge q1 = new QuadEdge(null, null, null);
    QuadEdge q2 = new QuadEdge(null, null, dest);
    QuadEdge q3 = new QuadEdge(null, null, null);

    // create the segment
    q0.onext = q0;
    q2.onext = q2; // lonely segment: no "next" quadedge
    q1.onext = q3;
    q3.onext = q1; // in the dual: 2 communicating facets

    // dual switch
    q0.rot = q1;
    q1.rot = q2;
    q2.rot = q3;
    q3.rot = q0;

    return q0;
  }