Package javax.media.j3d

Examples of javax.media.j3d.LineArray


        detach();
      if (lightVector!=null) rootGroup.removeChild(lightVector);
        float[] vectorCoords = new float[] {
            0,0,0, x,y,z
        };
        LineArray la = new LineArray(2, LineArray.COORDINATES);
        la.setCoordinates(0,vectorCoords);
        Appearance a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(1.0f,1.0f,0.0f);
    a.setColoringAttributes(ca);
View Full Code Here


       
        // X axis in blue
        axisGroup = new BranchGroup();

        float[] axis = AxisMaker.makeAxis(0);
        LineArray la = new LineArray(axis.length/3, LineArray.COORDINATES);
        la.setCoordinates(0,axis);
        Appearance a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(0.0f,0.0f,1.0f);
    a.setColoringAttributes(ca);
    Shape3D saxis = new Shape3D(la, a);
    axisGroup.addChild(saxis);
       
        // Y axis in green
        axis = AxisMaker.makeAxis(1);
        la = new LineArray(axis.length/3, LineArray.COORDINATES);
        la.setCoordinates(0,axis);
        a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    ca = new ColoringAttributes();
    ca.setColor(0.0f,1.0f,0.0f);
    a.setColoringAttributes(ca);
    saxis = new Shape3D(la, a);
    axisGroup.addChild(saxis);
       
        // Z axis in purple
        axis = AxisMaker.makeAxis(2);
        la = new LineArray(axis.length/3, LineArray.COORDINATES);
        la.setCoordinates(0,axis);
        a = new Appearance();
    a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
    ca = new ColoringAttributes();
    ca.setColor(1.0f,0.0f,1.0f);
    a.setColoringAttributes(ca);
View Full Code Here

            Group g=new Group();
            // TODO i18n
            g.setName("Frame");
           
            float[] axis = makeAxis(0);
            LineArray la = new LineArray(axis.length/3, LineArray.COORDINATES);
            la.setCoordinates(0,axis);
            Appearance a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
            ColoringAttributes ca = new ColoringAttributes();
            ca.setColor(0.0f,0.0f,1.0f);
            a.setColoringAttributes(ca);
            Shape3D saxis = new Shape3D(la, a);
            saxis.setName("X");
            g.addChild(saxis);
           
            // Y axis in green
            axis = makeAxis(1);
            la = new LineArray(axis.length/3, LineArray.COORDINATES);
            la.setCoordinates(0,axis);
            a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
            ca = new ColoringAttributes();
            ca.setColor(0.0f,1.0f,0.0f);
            a.setColoringAttributes(ca);
            saxis = new Shape3D(la, a);
            saxis.setName("Y");
            g.addChild(saxis);
           
            // Z axis in purple
            axis = makeAxis(2);
            la = new LineArray(axis.length/3, LineArray.COORDINATES);
            la.setCoordinates(0,axis);
            a = new Appearance();
            a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
            ca = new ColoringAttributes();
            ca.setColor(1.0f,0.0f,1.0f);
            a.setColoringAttributes(ca);
View Full Code Here

                    getLocation(),"Line",2); // TODO i18n
            double[] v=d.getResult();
            if(v!=null){
                GroupNode gn=(GroupNode)getNode();
       
                LineArray la = new LineArray(2, LineArray.COORDINATES);
                la.setCoordinates(0,v);
                Appearance a = new Appearance();
                a.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_NONE, 0));
                ColoringAttributes ca = new ColoringAttributes();
                ca.setColor(1.0f,1.0f,1.0f);
                a.setColoringAttributes(ca);
View Full Code Here

            }
          }
        }
      } else {
        if (geometryArray instanceof LineArray) {
          LineArray lineArray = (LineArray)geometryArray;
          for (int i = 0, n = lineArray.getVertexCount(); i < n; i += 2) {
            writeLine(lineArray, i, i + 1, vertexIndexSubstitutes, textureCoordinatesIndexSubstitutes);
          }
        } else if (geometryArray instanceof TriangleArray) {
          TriangleArray triangleArray = (TriangleArray)geometryArray;
          for (int i = 0, n = triangleArray.getVertexCount(); i < n; i += 3) {
View Full Code Here

            normals = directNormals;
            uvs = directUvs;
          }
        } else {
          if (geometryArray instanceof LineArray) {
            LineArray lineArray = (LineArray)geometryArray;
            for (int i = 0, n = lineArray.getVertexCount(); i < n; i += 2) {
              exportLine(lineArray, i, i + 1, verticesIndices, i);
            }
          } else {
            if (geometryArray instanceof TriangleArray) {
              TriangleArray triangleArray = (TriangleArray)geometryArray;
View Full Code Here

        }
    }

    private void addBranchShape() {
        Shape3D branchShape = new Shape3D();
        LineArray branchLine = createBranchLine();
        Appearance branchAppearance = new Appearance();
        AppearanceFactory.setColorWithColoringAttributes(branchAppearance, ColorConstants.brown);
        branchShape.setGeometry(branchLine);
        branchShape.setAppearance(branchAppearance);
        group.addChild(branchShape);
View Full Code Here

        branchShape.setAppearance(branchAppearance);
        group.addChild(branchShape);
    }

    private LineArray createBranchLine() {
        LineArray branchLine = new LineArray(2, GeometryArray.COORDINATES);
        branchLine.setCoordinate(0, new Point3d(0, 0, 0));
        branchLine.setCoordinate(1, endPoint);
        return branchLine;
    }
View Full Code Here

        this.endPoint = new Point3d(axisType == Axis.X ? 5 : 0, axisType == Axis.Y ? 5 : 0, axisType == Axis.Z ? 5 : 0);
        createBranchShape();
    }

    private LineArray createBranchLine() {
        LineArray branchLine = new LineArray(2, GeometryArray.COORDINATES);
        branchLine.setCoordinate(0, startPoint);
        branchLine.setCoordinate(1, endPoint);
        return branchLine;
    }
View Full Code Here

        branchLine.setCoordinate(1, endPoint);
        return branchLine;
    }

    private void createBranchShape() {
        LineArray branchLine = createBranchLine();
        Appearance branchAppearance = new Appearance();
        setGeometry(branchLine);
        setAppearance(branchAppearance);
    }
View Full Code Here

TOP

Related Classes of javax.media.j3d.LineArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.