Example usage for javax.media.j3d PointArray setCoordinates

List of usage examples for javax.media.j3d PointArray setCoordinates

Introduction

In this page you can find the example usage for javax.media.j3d PointArray setCoordinates.

Prototype

public void setCoordinates(int index, float coordinates[]) 

Source Link

Document

Sets the coordinates associated with the vertices starting at the specified index for this object.

Usage

From source file:BoundsTest.java

protected Group createPoints() {
    Group group = new Group();

    final int kNumPoints = 200;
    final double kRadius = 10.0;
    Point3d points[] = new Point3d[kNumPoints];

    for (int n = 0; n < kNumPoints; n++) {
        double randX = (java.lang.Math.random() * kRadius) - kRadius / 2;
        double randY = (java.lang.Math.random() * kRadius) - kRadius / 2;
        double randZ = (java.lang.Math.random() * kRadius) - kRadius / 2;

        points[n] = new Point3d(randX, randY, randZ);
    }/*from w  ww  .  ja va  2 s .c o m*/

    PointArray pointArray = new PointArray(points.length, GeometryArray.COLOR_4 | GeometryArray.COORDINATES);
    pointArray.setCoordinates(0, points);
    Shape3D shapePoints = new Shape3D(pointArray, new Appearance());

    group.addChild(shapePoints);
    return group;
}

From source file:AppearanceExplorer.java

Shape3D createPointArray() {

    Point3f pnt[] = new Point3f[3];
    pnt[0] = new Point3f(-1.0f, -1.0f, 0.0f);
    pnt[1] = new Point3f(1.0f, -1.0f, 0.0f);
    pnt[2] = new Point3f(1.0f, 1.0f, 0.0f);

    PointArray pa = new PointArray(3, GeometryArray.COORDINATES);
    pa.setCoordinates(0, pnt);

    return new Shape3D(pa, appearance);
}