Jure, Ive been using VisAD (http://www.ssec.wisc.edu/~billh/visad.html)
to do the triangulations for me. You can easily produce an array that
provides integer indexes for your x,y values. Here is a snip of code:
// Set up data
for (int i=0; i<nr; i++) {
apSamples[0][i] = (float) (2*Math.random());
apSamples[1][i] = (float) (2*Math.random());
}
// pass the x,y array to the delaunay object and
// harvest the index array (apTri)
try
{
long start = System.currentTimeMillis();
DelaunayWatson ApCD = new DelaunayWatson(apSamples);
long end = System.currentTimeMillis();
float time = (float) (end-start)/1000;
System.out.println("Operation took "+time+" seconds.");
apTri = ApCD.Tri;
}
catch (VisADException v)
{
System.out.println("DelaunayApplet: "+v);
System.exit(3);
}
// use the index to ref your points and create verts for your surface
// here i use a different value for the z vert.
for (int i=0; i<apTri.length; i++) {
verts[3*i + 0] = new Point3d(0.5 - apSamples[0][apTri[i][0]],0.5
- apSamples[1][apTri[i][0]],(0.5 - gp[apTri[i][0]][0])/3);
verts[3*i + 1] = new Point3d(0.5 - apSamples[0][apTri[i][1]],0.5
- apSamples[1][apTri[i][1]],(0.5 - gp[apTri[i][1]][0])/3);
verts[3*i + 2] = new Point3d(0.5 - apSamples[0][apTri[i][2]],0.5
- apSamples[1][apTri[i][2]],(0.5 - gp[apTri[i][2]][0])/3);
}
hope this is helpful
Peter S.
On Wed, 27 Jan 1999, Jure Zabkar wrote:
> I'd like to create a surface made out of triangles. I have a lot of
> points each of them having a list of neighboring points (voronoi
> diagram). Is there an easy way (maybe some trick) in Java3D to render
> such data or do I have to write my own method that would output
> triangles?
>
> thanks,
> Jure
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
>
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/