private static int[][] findReferences(final List<Vector3D> vertices,final List<int[]> facets){
  final int[] nbFacets=new int[vertices.size()];
  int maxFacets=0;
  for (  final int[] facet : facets) {
    if (facet.length < 3) {
      throw new MathIllegalArgumentException(LocalizedCoreFormats.WRONG_NUMBER_OF_POINTS,3,facet.length,true);
    }
    for (    final int index : facet) {
      maxFacets=FastMath.max(maxFacets,++nbFacets[index]);
    }
  }
  final int[][] references=new int[vertices.size()][maxFacets];
  for (  int[] r : references) {
    Arrays.fill(r,-1);
  }
  for (int f=0; f < facets.size(); ++f) {
    for (    final int v : facets.get(f)) {
      int k=0;
      while (k < maxFacets && references[v][k] >= 0) {
        ++k;
      }
      references[v][k]=f;
    }
  }
  return references;
}

private static int [ ] [ ] findReferences ( final List < Vector3D > vertices , final List < int [ ] > facets ) { final int [ ] nbFacets = new int [ vertices . size ( ) ] ; int maxFacets = 0 ; for ( final int [ ] facet : facets ) { if ( facet . length < 3 ) { throw new MathIllegalArgumentException ( LocalizedCoreFormats . WRONG_NUMBER_OF_POINTS , 3 , facet . length , true ) ; } for ( final int index : facet ) { maxFacets = FastMath . max ( maxFacets , ++ nbFacets [ index ] ) ; } } final int [ ] [ ] references = new int [ vertices . size ( ) ] [ maxFacets ] ; for ( int [ ] r : references ) { Arrays . fill ( r , - 1 ) ; } for ( int f = 0 ; f < facets . size ( ) ; ++ f ) { for ( final int v : facets . get ( f ) ) { int k = 0 ; while ( k < maxFacets && references [ v ] [ k ] >= 0 ) { ++ k ; } references [ v ] [ k ] = f ; } } return references ; }
find the facets that reference each edges .
