Hi Thomas,

a normal is a vector perpenticular to the pane built by three points of the triangle 
in question. It is needed to calculate lighting and visibility of
surfaces. If you go counterclockwise thru all 3 points (a, b, c) of a triangle using 
the fingers of your right hand, the normal vector is looking into
the direction of your thumb. You can calculate a normal vector via cross product (ab) 
X (ac) for example.
In Java3D you have to assign the normal vector to every vertex of a triangle.

Gernot

On Fri, 11 Feb 2000 14:37:57 -0000, Thomas M Clarke wrote:

>What exactly are Normals? (I know there used to calculate which face gets
>lighting)
>And How do I define normals for example for the following TriangleArray:
>
> private static final float[] verts =
> {
>  -1.0f, 0.0f, 0.0f,
>  1.0f, 0.0f, 0.0f,
>  0.0f, 1.0f, 0.5f,
>
>  -1.0f, 0.0f, 0.0f,
>  0.0f, 0.0f, 1.0f,
>  0.0f, 1.0f, 0.5f,
>
>  1.0f, 0.0f, 0.0f,
>  0.0f, 0.0f, 1.0f,
>  0.0f, 1.0f, 0.5f,
>
>  -1.0f, 0.0f, 0.0f,
>  1.0f, 0.0f, 0.0f,
>  0.0f, 0.0f, 1.0f,
> };
>
>(this is a shape that has four faces and makes up something like a pyramid)
>I just copy and pasted the above verts into the normal array to see what
>happened and it didnt exactly work:
>
> private static final float[] normals =
> {
>  -1.0f, 0.0f, 0.0f,
>  1.0f, 0.0f, 0.0f,
>  0.0f, 1.0f, 0.5f,
>
>  -1.0f, 0.0f, 0.0f,
>  0.0f, 0.0f, 1.0f,
>  0.0f, 1.0f, 0.5f,
>
>  1.0f, 0.0f, 0.0f,
>  0.0f, 0.0f, 1.0f,
>  0.0f, 1.0f, 0.5f,
>
>  -1.0f, 0.0f, 0.0f,
>  1.0f, 0.0f, 0.0f,
>  0.0f, 0.0f, 1.0f,
> };
>
>I then created the shape with the following code:
>
>  Tarray = new TriangleArray(12, TriangleArray.COLOR_3 |
>TriangleArray.COORDINATES | TriangleArray.NORMALS);
>  Tarray.setCoordinates(0, verts);
>  Tarray.setNormals(0, normals);
>  app = new Appearance();
>  mat = new Material(aColor, eColor, dColor, sColor, shinyness);
>  app.setMaterial(mat);
>  shp = new Shape3D(Tarray, app);
>
>
>Thank you
>
>Thomas M Clarke
>
>===========================================================================
>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".


[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".

Reply via email to