org.psychomad.psycholib.j3d.util
Class UtilTriangleArray

java.lang.Object
  extended by org.psychomad.psycholib.j3d.util.UtilTriangleArray

public class UtilTriangleArray
extends java.lang.Object

This class allow to realize some mathematical operation on a triangle stored in a TriangleArray structure.


Constructor Summary
UtilTriangleArray()
           
 
Method Summary
static void computeNormal(javax.media.j3d.TriangleArray tr, int index)
          Compute the normal of a triangle store in a TriangleArray and update its normal value.
static float getArea(javax.media.j3d.TriangleArray tr, int index)
          Compute the area of the triangle.
static javax.vecmath.Point3f getGPoint(javax.media.j3d.TriangleArray tr, int index)
          Allow to get the G point of a triangle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtilTriangleArray

public UtilTriangleArray()
Method Detail

computeNormal

public static void computeNormal(javax.media.j3d.TriangleArray tr,
                                 int index)
Compute the normal of a triangle store in a TriangleArray and update its normal value.

Parameters:
tr - the TriangleArray structure from which we extract a triangle to compute its normal
index - index position of the triangle in the TriangleArray structure

getGPoint

public static javax.vecmath.Point3f getGPoint(javax.media.j3d.TriangleArray tr,
                                              int index)
Allow to get the G point of a triangle. This G point is defined at the 2/3 of a mediane.

Parameters:
tr - the TriangleArray structure from which we extract a triangle to compute its normal
index - index position of the triangle in the TriangleArray structure
Returns:
the G point of the triangle pass in arg.

getArea

public static float getArea(javax.media.j3d.TriangleArray tr,
                            int index)
Compute the area of the triangle. triangle given a,b,c = [s(s-a)(s-b)(s-c)] when s = (a+b+c)/2 (Heron's formula)

Parameters:
tr - the TriangleArray structure from which we extract a triangle to compute its normal
index - index position of the triangle in the TriangleArray structure


Copyright 2006 null. All Rights Reserved.