Beispiel #1
0
 /**
  * Report the boundary of a Set of Simplices. The boundary is a Set of facets where each facet is
  * a Set of vertices <V>.
  *
  * @param   <V> vertices (generic type V)
  * @param simplexSet Set of Simplices
  * @return an Iterator for the facets that make up the boundary
  */
 public static <V> Set<Set<V>> boundary(final Set<? extends Simplex<V>> simplexSet) {
   final Set<Set<V>> theBoundary = new HashSet<Set<V>>();
   for (final Simplex<V> simplex : simplexSet) {
     for (final Set<V> facet : simplex.facets()) {
       if (theBoundary.contains(facet)) {
         theBoundary.remove(facet);
       } else {
         theBoundary.add(facet);
       }
     }
   }
   return theBoundary;
 }
Beispiel #2
0
 /**
  * True iff simplices are neighbors. Two simplices are neighbors if they are the same dimension
  * and they share a facet.
  *
  * @param simplex the other Simplex
  * @return true iff this Simplex is a neighbor of simplex
  */
 public boolean isNeighbor(final Simplex<V> simplex) {
   final HashSet<V> h = new HashSet<V>(this);
   h.removeAll(simplex);
   return (this.size() == simplex.size()) && (h.size() == 1);
 }