Example usage for javax.media.j3d LineArray LineArray

List of usage examples for javax.media.j3d LineArray LineArray

Introduction

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

Prototype

public LineArray(int vertexCount, int vertexFormat) 

Source Link

Document

Constructs an empty LineArray object using the specified parameters.

Usage

From source file:Demo3D.java

/**
 * Construct an aimer.//from  ww  w  . ja v a 2s.co m
 * 
 * @return javax.media.j3d.Shape3D myAimer - the constructed aimer.
 */
public Shape3D myAimer() {
    // Construction of the aimer (LineArray).
    aimer = new LineArray(20, LineArray.COORDINATES | LineArray.COLOR_3);

    // Scalling of the vertices of the aimer using scale_XYZ.
    scaledExtremites = new float[extremites.length];
    for (int i = 0; i < extremites.length; i++)
        scaledExtremites[i] = extremites[i] * scale_XYZ;

    aimer.setCoordinates(0, scaledExtremites);
    aimer.setColors(0, color);

    this.setGeometry(aimer);

    return this;
}

From source file:Demo3D.java

/**
 * Constructor that allows to specify the desired initial colors and the
 * length of the axes.//from   w  ww  .ja va2 s .c om
 * 
 * @param type
 *            float rougeX, vertX, bleuX, rougeY, vertY, bleuY, rougeZ,
 *            vertZ, bleuZ - the colors of the axes
 * @param type
 *            float s_XYZ - the scale factor to adjust the axes's length
 */
public CoordSyst(float rougeX, float vertX, float bleuX, float rougeY, float vertY, float bleuY, float rougeZ,
        float vertZ, float bleuZ, float s_XYZ) {
    rX = rougeX;
    rY = rougeY;
    rZ = rougeZ;
    gX = vertX;
    gY = vertY;
    gZ = vertZ;
    bX = bleuX;
    bY = bleuY;
    bZ = bleuZ;
    scale_XYZ = s_XYZ;

    // Colors of the three axes.
    float color[] = { rX, gX, bX, rX, gX, bX, // the x axis
            rY, gY, bY, rY, gY, bY, // the y axis
            rZ, gZ, bZ, rZ, gZ, bZ }; // the z axis

    // Construction of the axes (LineArray).
    axes = new LineArray(6, LineArray.COORDINATES | LineArray.COLOR_3);

    // Scalling of the vertices of the 3 axes using scale_XYZ.
    scaledExtremites = new float[extremites.length];
    for (int i = 0; i < extremites.length; i++)
        scaledExtremites[i] = extremites[i] * scale_XYZ;

    axes.setCoordinates(0, scaledExtremites);
    axes.setColors(0, color);

    this.setGeometry(axes);
}