Re: Retrieval of Delaunay Edges

Hi Scott,
 
Given an object "Delaunay delaunay" in 2-D you can do:
 
  int[][] tris = delaunay.Tri;
  if (tris != null) {
    boolean[] mark = new boolean[delaunay.NumEdges];
    for (int i=0; i<delaunay.NumEdges; i++) mark[i] = false;
    int ntris = tris.length; 
    int dim = tris[0].length;
    if (dim != 2) {
      throw new VisADException("not 2-D triangles");
    }
    for (int i=0; i<ntris; i++) {
      for (int j=0; j<dim+1; j++) {
        int e = Edges[i][j];
        if (!mark[e]) {
          mark[e] = true;
          int k0 = tris[i][j];
          int k1 = tris[i][(j+1) % (dim+1)]
          // the next unique edge is from vertex k0 to vertex k1
          // k0 and k1 and indices into the array returned by 
          // getSamples() from the associated Set, which is
          // organized float[dim][number_of_vertices]
        } 
      }
    }
  }
 
I hope this isn't too cryptic (and hopefully also correct).
 
Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html



  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: