private static List<SubHyperplane<Euclidean3D>> buildBoundary(final List<Vector3D> vertices,final List<int[]> facets,final double tolerance){
  for (int i=0; i < vertices.size() - 1; ++i) {
    final Vector3D vi=vertices.get(i);
    for (int j=i + 1; j < vertices.size(); ++j) {
      if (Vector3D.distance(vi,vertices.get(j)) <= tolerance) {
        throw new MathIllegalArgumentException(LocalizedGeometryFormats.CLOSE_VERTICES,vi.getX(),vi.getY(),vi.getZ());
      }
    }
  }
  final int[][] references=findReferences(vertices,facets);
  final int[][] successors=successors(vertices,facets,references);
  for (int vA=0; vA < vertices.size(); ++vA) {
    for (    final int vB : successors[vA]) {
      if (vB >= 0) {
        boolean found=false;
        for (        final int v : successors[vB]) {
          found=found || (v == vA);
        }
        if (!found) {
          final Vector3D start=vertices.get(vA);
          final Vector3D end=vertices.get(vB);
          throw new MathIllegalArgumentException(LocalizedGeometryFormats.EDGE_CONNECTED_TO_ONE_FACET,start.getX(),start.getY(),start.getZ(),end.getX(),end.getY(),end.getZ());
        }
      }
    }
  }
  final List<SubHyperplane<Euclidean3D>> boundary=new ArrayList<SubHyperplane<Euclidean3D>>();
  for (  final int[] facet : facets) {
    Plane plane=new Plane(vertices.get(facet[0]),vertices.get(facet[1]),vertices.get(facet[2]),tolerance);
    final Vector2D[] two2Points=new Vector2D[facet.length];
    for (int i=0; i < facet.length; ++i) {
      final Vector3D v=vertices.get(facet[i]);
      if (!plane.contains(v)) {
        throw new MathIllegalArgumentException(LocalizedGeometryFormats.OUT_OF_PLANE,v.getX(),v.getY(),v.getZ());
      }
      two2Points[i]=plane.toSubSpace(v);
    }
    boundary.add(new SubPlane(plane,new PolygonsSet(tolerance,two2Points)));
  }
  return boundary;
}

private static List < SubHyperplane < Euclidean3D > > buildBoundary ( final List < Vector3D > vertices , final List < int [ ] > facets , final double tolerance ) { for ( int i = 0 ; i < vertices . size ( ) - 1 ; ++ i ) { final Vector3D vi = vertices . get ( i ) ; for ( int j = i + 1 ; j < vertices . size ( ) ; ++ j ) { if ( Vector3D . distance ( vi , vertices . get ( j ) ) <= tolerance ) { throw new MathIllegalArgumentException ( LocalizedGeometryFormats . CLOSE_VERTICES , vi . getX ( ) , vi . getY ( ) , vi . getZ ( ) ) ; } } } final int [ ] [ ] references = findReferences ( vertices , facets ) ; final int [ ] [ ] successors = successors ( vertices , facets , references ) ; for ( int vA = 0 ; vA < vertices . size ( ) ; ++ vA ) { for ( final int vB : successors [ vA ] ) { if ( vB >= 0 ) { boolean found = false ; for ( final int v : successors [ vB ] ) { found = found || ( v == vA ) ; } if ( ! found ) { final Vector3D start = vertices . get ( vA ) ; final Vector3D end = vertices . get ( vB ) ; throw new MathIllegalArgumentException ( LocalizedGeometryFormats . EDGE_CONNECTED_TO_ONE_FACET , start . getX ( ) , start . getY ( ) , start . getZ ( ) , end . getX ( ) , end . getY ( ) , end . getZ ( ) ) ; } } } } final List < SubHyperplane < Euclidean3D > > boundary = new ArrayList < SubHyperplane < Euclidean3D > > ( ) ; for ( final int [ ] facet : facets ) { Plane plane = new Plane ( vertices . get ( facet [ 0 ] ) , vertices . get ( facet [ 1 ] ) , vertices . get ( facet [ 2 ] ) , tolerance ) ; final Vector2D [ ] two2Points = new Vector2D [ facet . length ] ; for ( int i = 0 ; i < facet . length ; ++ i ) { final Vector3D v = vertices . get ( facet [ i ] ) ; if ( ! plane . contains ( v ) ) { throw new MathIllegalArgumentException ( LocalizedGeometryFormats . OUT_OF_PLANE , v . getX ( ) , v . getY ( ) , v . getZ ( ) ) ; } two2Points [ i ] = plane . toSubSpace ( v ) ; } boundary . add ( new SubPlane ( plane , new PolygonsSet ( tolerance , two2Points ) ) ) ; } return boundary ; }
build boundary from vertices and facets .
