Dear HEIKO:
Pursuant to what Doug said: You might want to take a look at:
http://www.cs.rpi.edu/~hulber/cgeom/
to inspect Hulber's GiftWrap module. He provides source code at
http://www.cs.rpi.edu/~hulber/cgeom/giftWrap.java
DISCLAIMER:
This information does not constitute an endorsement of the above. If the
information is used to design, construct or operate nuclear power plants,
off-shore oil rigs, multinational space stations, or great big airport
control towers, please try it out first in a test environment.
Sincerely, Ted
>From: Doug Gehringer <[EMAIL PROTECTED]>
>Reply-To: Doug Gehringer <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: [JAVA3D] Creating a cube with GeometryInfo
>Date: Thu, 21 Oct 1999 10:28:56 -0700
>
>You are dealing with two problems here: determining the faces that define
>the
>surface of your points and generating triangles and normals for those
>faces.
>The Triangulator utility helps with the second problem but not the first.
>
>If the points are completely "unstructured" (that is, if you have no
>information
>about where the faces are), then one way of generating a surface is to
>calculate
>the convex hull of the points. This is the set of surfaces which enclose
>the
>points as if they were "gift wrapped". There are several algorithms which
>can
>produce the convex hull-- you may be able to find an implementation out
>there
>somewhere.
>
>Doug Gehringer
>Sun Microsystems
>
>
>
>
> > From: <[EMAIL PROTECTED]>
> > Subject: Re: [JAVA3D] Creating a cube with GeometryInfo
> >
> > Although I haven't tried your example, I'm pretty sure, that it deals
>with
> > a plane (all z-coordinates are 0). As Dennis J. Bouvier pointed out
> > already, this is considerably easier then my case of a closed volume.
> > However, I still think that a class called Triangulator should be able
>to
> > deal with this. It seems a very common task compared to the generation
>of
> > planes with possible holes.
> > The problem is, given a set of points in 3D and no information about
> > conncetions between them, how do I generate triangles. I'm no expert in
> > this area (obviously) but wouldn't Delaunay triangulation do nicely? Is
> > there any code available doing this (inside or outside Java3D)?
> >
> > Regards
> >
> > HEIKO
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> > Daniel Selman <[EMAIL PROTECTED]>@java.sun.com> on 20-10-99 17:24:30
> >
> > Please respond to [EMAIL PROTECTED]
> >
> > Sent by: Discussion list for Java 3D API <[EMAIL PROTECTED]>
> >
> >
> > To: [EMAIL PROTECTED]
> > cc:
> >
> > Subject: Re: [JAVA3D] Creating a cube with GeometryInfo
> >
> >
> > Your Name (sic!),
> >
> > Here is an example (from my book) that works.
> >
> > Sincerely,
> >
> > Daniel Selman
> >
> > [EMAIL PROTECTED]
> > http://www.tornadolabs.com
> >
> > ======
> >
> > //generate a surface from 10 vertices and create a hole in the surface
>by
> > removing
> > //a hole defined using 5 vertices. Note that the hole must be entirely
> > within the
> > //outer polygon.
> > private double[] m_VertexArray = {1,1,0, //0
> > 0,3,0,
>//1
> > 1,5,0,
>//2
> > 2,4,0,
>//3
> > 4,5,0,
>//4
> > 3,3,0,
>//5
> > 4,2,0,
>//6
> > 4,0,0,
>//7
> > 3,0,0,
>//8
> > 2,1,0,
>//9
> > //these are vertices for the hole
> > 1,3,0,
>//10
> > 2,3,0,
>//11
> > 3,2,0,
>//12
> > 3,1,0,
>//13
> >
>2,2,0};//14
> > //triangulate the polygon
> > GeometryInfo gi = new GeometryInfo( GeometryInfo.POLYGON_ARRAY );
> >
> > gi.setCoordinates( m_VertexArray );
> >
> > //the first 10 points make up the outer edge of the polygon, the next
>five
> > make up the hole
> > int[] stripCountArray = {10,5};
> > int[] countourCountArray = {stripCountArray.length}
> > gi.setContourCounts( countourCountArray );
> > gi.setStripCounts( stripCountArray );
> >
> > Triangulator triangulator = new Triangulator();
> > triangulator.triangulate( gi );
> >
> > //also generate normal vectors so that the surface can be light
> > NormalGenerator normalGenerator = new NormalGenerator();
> > normalGenerator.generateNormals( gi );
> >
> > //create an appearance
> > Appearance ap = new Appearance();
> >
> > //render as a wireframe
> > PolygonAttributes polyAttrbutes = new PolygonAttributes();
> > polyAttrbutes.setPolygonMode( PolygonAttributes.POLYGON_LINE );
> > polyAttrbutes.setCullFace( PolygonAttributes.CULL_NONE ) ;
> > ap.setPolygonAttributes( polyAttrbutes );
> >
> > //add both a wireframe and a solid version of the triangulated surface
> > Shape3D shape1 = new Shape3D( gi.getGeometryArray(), ap );
> > Shape3D shape2 = new Shape3D( gi.getGeometryArray() );
> >
> > -----Original Message-----
> > From: Discussion list for Java 3D API
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Your Name
> > Sent: 20 October 1999 04:14
> > To: [EMAIL PROTECTED]
> > Subject: [JAVA3D] Creating a cube with GeometryInfo
> >
> >
> > Hi,
> >
> > I'm sure there is an easy answer to this, but I still can't get it to
>work.
> > What I'm trying to do is to display a simple cube within Java3D. Now, I
> > know, I could use the ColorCube class for this (works fine), but I want
>to
> > do it via the GeometryInfo to be able to later on create more
>complicated
> > objects. So what I do is to define the 8 vertices of a cube to be
> > (0,0,0),(0,0,1),... up to (1,1,1), pass this set of coordinates to the
> > GeometryInfo, triangulate, generate normals, stripify and create a
>Shape3D
> > from it. Code is as follows:
> >
> > GeometryInfo gInfo=new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
> > gInfo.setCoordinates(mCoords);
> > int[] ii={mCoords.length/3};
> > gInfo.setStripCounts( ii);
> > Triangulator tri=new Triangulator();
> > tri.triangulate(gInfo);
> > NormalGenerator normGen=new NormalGenerator();
> > normGen.generateNormals(gInfo);
> > Stripifier strip=new Stripifier();
> > strip.stripify(gInfo);
> > Shape3D shape=new Shape3D();
> > shape.setGeometry(gInfo.getGeometryArray());
> >
> > However, when I display the Shape3D, I get a bunch of triangles and not
>the
> > total cube. Now I first thought that some of the faces where backface
> > culled, so I set the PolgonAttributes correspondingly:
> >
> > Appearance app=new Appearance();
> > PolygonAttributes pAtt=new PolygonAttributes();
> > pAtt.setCullFace(PolygonAttributes.CULL_NONE);
> > pAtt.setBackFaceNormalFlip(true);
> > app.setPolygonAttributes(pAtt);
> > Material mat=new Material();
> > mat.setAmbientColor(0.4f,0.4f,0.4f);
> > app.setMaterial(mat);
> > shape.setAppearance(app)
> > Still, the same effect, only a few triangles show up, not a full cube.
> >
> > Probably I did misunderstand the way the Triangulator works, can anybody
> > shed light on this?
> >
> > Regards
> >
> > HEIKO
> > [EMAIL PROTECTED]
> >
> >
>===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff JAVA3D-INTEREST". For general help, send email
>to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff JAVA3D-INTEREST". For general help, send email
>to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
> >
>===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff JAVA3D-INTEREST". For general help, send email
>to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".