Exemplo n.º 1
0
  /**
   * checks whether an edge is shared by two faces f1 and f2: the function check whether the
   * corresponding vertices appear both in f1 and f2, in the correct order. LCA: a' tester
   */
  public boolean areEqual(
      TriangulationDSFace_2<X> face1, int i1, TriangulationDSFace_2<X> face2, int i2) {
    HalfedgeHandle<X> edge1 = new HalfedgeHandle<X>(face1, i1);
    HalfedgeHandle<X> edge2 = new HalfedgeHandle<X>(face2, i2);

    TriangulationDSVertex_2<X> v1 = edge1.getVertex(0); // first vertex of edge1
    TriangulationDSVertex_2<X> v2 = edge1.getVertex(1); // second vertex of edge1

    boolean contained = edge2.hasVertex(v1);
    if (contained == false) return false;
    contained = edge2.hasVertex(v2);
    if (contained == false) return false;

    if (v1.equals(edge2.getVertex(0))) return false;

    return true;
  }