From Paul Pantera at Sun:

> GeometryInfo does a lot in the background.  If you put your geometry
> into it as POLYGON_ARRAY and then immediately call getGeometryArray(),
> it will create a default triangulator and triangulate your data, then
> unindexify it, and then create the GeometryArray and pass it back.
> There's no other choice because you can't put polygons into a
> GeometryArray.  The word "polygon" is never used anywhere in Java 3D
> except in GeometryInfo and the triangulator.
>
> To further expand this, the NormalGenerator and Stripifier only work on
> indexed triangles.  Therefore, no matter what format your data is in,
> it will be converted to indexed triangles if you call the
> NormalGenerator or Stripfier.  This is hidden from the user.  If you
> send in quads and call the stripfier, you will get triangle strips out,
> and you won't know that your quads were converted to indexed triangles
> in the interim.
>
> If you send quads (or fans or strips) to the NormalGenerator, they get
> converted to indexed triangles before Normals are calculated.  If you
> then call getGeometryArray(), the triangles are converted back to the
> original primitive in the most intelligent way possible.  If it was
> originally fans or strips, it will attempt to stitch them back
> together, but it may have to break a strip in two if there was a hard
> edge in the middle of the strip.  It does the same thing for quads.
> (There can't be a hard edge in the middle of a quad because the same
> facet normal is used by both sub-triangles of the quad).
>
> This probably rarely happens because most people aren't going to
> generate normals and then call getGeometryArray(), they're going to
> call the stripifier first.  In that case, the data is left as indexed
> triangles and sent immediately to the stripifier.  It's never converted
> back to the original primitive type.
>
> Keeping all that in mind, POLYGON_ARRAY is treated just like any other
> primitive by GeometryInfo.  Before it can be sent to the
> NormalGenerator or Stripifier, it must first be converted to
> triangles.  It uses the triangulator utility to do this.  Where it
> differs from the other primitives is when you don't call the
> Stripifyer.  If you call getGeometryArray() on POLYGON_ARRAY data
> without calling the stripifier, you will always get back individual
> triangles.
>
> So the answer to your question is yes, you don't need to call the
> triangulator explicitly (unless you want to specify the earOrder)
> because it gets called automatically when POLYGON_ARRAY data is used.
> Does it hurt to call it explicitly?  Not much.  The triangulator
> is smart enough to do nothing if the input data is already
> triangles.
>
> Homework:
>
> 1)  If I put Quad data into GeometryInfo and call the NormalGenerator
>     followed by getGeometryArray(), what will be the primitive of the
>     returned data?
>
> 2)  If I put Triangle Fan data into GeometryInfo and call the
>     Stripifier followed by getGeometryArray(), what will be the
>     primitive of the returned data?
>
> 3)  If I put Polygon data into GeometryInfo and call the
>     NormalGenerator then the Stripifier then getGeometryArray(),
>     what will be the primitive of the returned data?
>
> 4)  If I put Quad data into GeometryInfo and call the
>     Stripifier then the NormalGenerator then getGeometryArray(),
>     what will be the primitive of the returned data?
>
>
> Answers:
>
> 1)  Quad.  The quads get taken apart to calculate the normals,
>     then they get put back together.
>
> 2)  Triangle Strip.  The input primitive type doesn't matter
>     because you called the Stripifier.
>
> 3)  Triangle Strip.  Same as #2.
>
> 4)  Don't do this!  When you call the Stripifier, GeometryInfo
>     will convert your data into triangles, and then the
>     Stripifier will turn it into strips.  Then GeometryInfo
>     has to turn it back into triangles before it can call
>     the NormalGenerator!  Then, after calculating the normals,
>     it will attempt to stitch the strips back together. Don't
>     do this!  You are doing tons of extra work and
>     your strips aren't as long as they would have been.
>     Always call the NormalGenerator before calling the
>     Stripifier.
>
> -Paul
>
> ==========================================================================
> =
> 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".

Reply via email to