|
The PointArray© Justin Couch 2001Working with point arrays is the simplest of all the primitives. Each coordinate you supply maps to exactly one point in 3D space. ConstructionConstructing a new instance of thePointArray class requires
using the same style constructor as the base GeometryArray
class. That is, all you need to provide it is the list of format flags and
a listing of the number of points that are to be rendered.
int format = GeometryArray.COORDINATE |
GeometryArray.COLOR_3;
PointArray points = new PointArray(3, format);
Because points represent a single location in space, and points are not
related to each other, the first argument can be any value. Apart from the
normal restrictions, this is the total number of points held in this array.
In this example, we provide 3 points and you can see those in Figure 5.
Figure 5: A point array showing the vertex numbering
float[] vertices =
{
0, 0, 0, // v1
0, 2, 0, // v2
1, 5, -3, // v3
};
Setting the array of vertices is just like LineArrays. Use the
setCoordinates() method to change the values to the new
array.
lines.setCoordinates(0, vertices);
Again, the position index works the same as for lines. If you want to set all
of the coordinates, start with a value of zero.
When working with colour values, there is nothing particularly interesting. Each colour value provided matches with one point. Because each point is an individual, there is no colour blending or any other funky stuff. |
|
[ j3d.org ]
[ Aviatrix3D ]
[ Code Repository ]
[ Java3D ]
[ OpenGL ]
[ Books ]
[ Contact Us ]
Hosted by Yumetech Last Updated: $Date: 2006/04/18 18:20:11 $ |