当前位置: 首页>>代码示例>>Java>>正文


Java LineArray.COORDINATES属性代码示例

本文整理汇总了Java中javax.media.j3d.LineArray.COORDINATES属性的典型用法代码示例。如果您正苦于以下问题:Java LineArray.COORDINATES属性的具体用法?Java LineArray.COORDINATES怎么用?Java LineArray.COORDINATES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.media.j3d.LineArray的用法示例。


在下文中一共展示了LineArray.COORDINATES属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setLines

public void setLines() {
    LineArray ver_Line = new LineArray(8, LineArray.COORDINATES);
    Point3d verts2[] = new Point3d[8];

    //bottom two lines
    verts2[0] = new Point3d(0, 0, 0);
    verts2[1] = new Point3d(0, 1.6, 0);
    verts2[2] = new Point3d(0.6, 0, 0);
    verts2[3] = new Point3d(0.6, 1.6, 0);

    //top two lines
    verts2[4] = new Point3d(0, 0, -0.6);
    verts2[5] = new Point3d(0, 1.6, -0.6);
    verts2[6] = new Point3d(0.6, 0, -0.6);
    verts2[7] = new Point3d(0.6, 1.6, -0.6);

    ver_Line.setCoordinates(0, verts2);
    setGeometry(ver_Line);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:19,代码来源:Segment3D.java

示例2: addLines

public void addLines() {
    LineArray ver_Line = new LineArray(8, LineArray.COORDINATES);
    Point3d verts2[] = new Point3d[8];

    //bottom two lines
    verts2[0] = new Point3d(0, 0, 0);
    verts2[1] = new Point3d(0, 0, heightZ);
    verts2[2] = new Point3d(lengthX, 0, 0);
    verts2[3] = new Point3d(lengthX, 0, heightZ);

    //top two lines
    verts2[4] = new Point3d(0, widthY, 0);
    verts2[5] = new Point3d(0, widthY, heightZ);
    verts2[6] = new Point3d(lengthX, widthY, 0);
    verts2[7] = new Point3d(lengthX, widthY, heightZ);

    ver_Line.setCoordinates(0, verts2);
    setGeometry(ver_Line);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:19,代码来源:RegionCA1.java

示例3: addLines

public void addLines() {
    LineArray ver_Line = new LineArray(8, LineArray.COORDINATES);
    Point3d verts2[] = new Point3d[8];

    /*
    //bottom two lines
    verts2[0] = new Point3d(0, 0, 0);
    verts2[1] = new Point3d(0, 1.6, 0);
    verts2[2] = new Point3d(lengthX, 0, 0);
    verts2[3] = new Point3d(lengthX, 1.6, 0);

    //top two lines
    verts2[4] = new Point3d(0, 0, -0.6);
    verts2[5] = new Point3d(0, 1.6, -0.6);
    verts2[6] = new Point3d(lengthX, 0, -0.6);
    verts2[7] = new Point3d(lengthX, 1.6, -0.6);

     *
     */

    //bottom two lines
    verts2[0] = new Point3d(0, 0, 0);
    verts2[1] = new Point3d(0, 0, heightZ);
    verts2[2] = new Point3d(lengthX, 0, 0);
    verts2[3] = new Point3d(lengthX, 0, heightZ);
    //top two lines
    verts2[4] = new Point3d(0, widthY, 0);
    verts2[5] = new Point3d(0, widthY, heightZ);
    verts2[6] = new Point3d(lengthX, widthY, 0);
    verts2[7] = new Point3d(lengthX, widthY, heightZ);

    ver_Line.setCoordinates(0, verts2);
    setGeometry(ver_Line);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:34,代码来源:CorticalColumn.java

示例4: addScaleBarToSceneGraph

/**
 * add a 100 µm scale bar to the BranchGroup
 *
 * @param scene
 *                the BranchGroup
 */
public static void addScaleBarToSceneGraph(TransformGroup scene, Point3f scaleBarPos, float scale) {
    if (scaleBarPos == null) {
        scaleBarPos = new Point3f();
    }

    float barPos = -150.0f * scale;
    float hight = 100.0f * scale;
    //logger.info("scaleBarPos: " + scaleBarPos.toString());
    LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    //la.setCoordinate(0, new Point3f(scaleBarPos.x + 0.7f, scaleBarPos.y + 0.0f, scaleBarPos.z + 0.9f));
    //la.setCoordinate(1, new Point3f(scaleBarPos.x + 0.7f, scaleBarPos.y + 0.0f, scaleBarPos.z + 1.0f));
    la.setCoordinate(0, new Point3f(barPos, scaleBarPos.y, scaleBarPos.z));
    la.setCoordinate(1, new Point3f(barPos, scaleBarPos.y, scaleBarPos.z + hight));
    for (int i = 0; i < 2; ++i) {
        la.setColor(i, grey);
    }
    scene.addChild(new Shape3D(la));
    Text3D text3d = new Text3D(new Font3D(new Font("plain", java.awt.Font.PLAIN, 1), new FontExtrusion()), "100 µm");
    text3d.setAlignment(Text3D.ALIGN_LAST);
    Shape3D text3dShape3d = new Shape3D(text3d);
    Appearance appearance = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(grey);
    appearance.setColoringAttributes(ca);
    text3dShape3d.setAppearance(appearance);

    TransformGroup tg = new TransformGroup();
    Transform3D t3d = new Transform3D();
    t3d.rotX(Math.PI / 2);
    float textScale = 30f * scale;
    //t3d.setScale(0.025);
    t3d.setScale(textScale);
    t3d.setTranslation(new Vector3f((barPos + (barPos/10.0f)), scaleBarPos.y, scaleBarPos.z + hight/2.0f));
    tg.setTransform(t3d);
    tg.addChild(text3dShape3d);
    scene.addChild(tg);
    // scene.addChild(text3dShape3d);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:44,代码来源:Utils3D.java

示例5: createLineArrayFromPoints

private LineArray createLineArrayFromPoints(Point3d p1, Point3d p2) {
    LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la.setCoordinate(0, p1);
    la.setCoordinate(1, p2);
    for (int i = 0; i < 2; ++i) {
        la.setColor(i, lineColor);
    }
    return la;
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:9,代码来源:Line3dCreator.java

示例6: addCoordinateSphereAxesToSceneGraph

/**
 * Function to add a white sphere and axes at the origin of the
 * coordinate system for better orientation. The z-axis is in black.
 */
public static void addCoordinateSphereAxesToSceneGraph(BranchGroup scene, float radius) {
    float rad = (radius <= 0.0f) ? 0.1f : radius;
    Appearance ap = new Appearance();
    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(white);
    ap.setColoringAttributes(ca);
    scene.addChild(new Sphere(rad, ap));

    LineArray la1 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la1.setCoordinate(0, new Point3f());
    la1.setCoordinate(1, new Point3f(5.0f * rad, 0.0f, 0.0f));
    for (int i = 0; i < 2; ++i) {
        la1.setColor(i, white);
    }
    scene.addChild(new Shape3D(la1));
    LineArray la2 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la2.setCoordinate(0, new Point3f());
    la2.setCoordinate(1, new Point3f(0.0f, 5.0f * rad, 0.0f));
    for (int i = 0; i < 2; ++i) {
        la2.setColor(i, white);
    }
    scene.addChild(new Shape3D(la2));
    LineArray la3 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la3.setCoordinate(0, new Point3f());
    la3.setCoordinate(1, new Point3f(0.0f, 0.0f, 5.0f * rad));
    for (int i = 0; i < 2; ++i) {
        la3.setColor(i, black);
    }
    scene.addChild(new Shape3D(la3));
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:34,代码来源:ColorUtil.java

示例7: Axis

public Axis() {
    axisBG = new BranchGroup();

    // Geometry�̐���
    LineArray axisX = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    LineArray axisY = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    LineArray axisZ = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);

    // ���_�̃Z�b�g
    Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f green = new Color3f(0.0f, 1.0f, 0.0f);
    Color3f blue = new Color3f(0.0f, 0.0f, 1.0f);

    axisX.setCoordinate(0, new Point3f(-1.0f, 0.0f, 0.0f));
    axisX.setCoordinate(1, new Point3f(1.0f, 0.0f, 0.0f));
    axisX.setColor(0, red);
    axisX.setColor(1, red);

    axisY.setCoordinate(0, new Point3f(0.0f, -1.0f, 0.0f));
    axisY.setCoordinate(1, new Point3f(0.0f, 1.0f, 0.0f));
    axisY.setColor(0, green);
    axisY.setColor(1, green);

    axisZ.setCoordinate(0, new Point3f(0.0f, 0.0f, -1.0f));
    axisZ.setCoordinate(1, new Point3f(0.0f, 0.0f, 1.0f));
    axisZ.setColor(0, blue);
    axisZ.setColor(1, blue);

    // BG�ɒlj�
    axisBG.addChild(new Shape3D(axisX));
    axisBG.addChild(new Shape3D(axisY));
    axisBG.addChild(new Shape3D(axisZ));
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:33,代码来源:Axis.java

示例8: Axis

public Axis() {
    axisBG = new BranchGroup();

    // Geometry�̐���
    LineArray axisX = new LineArray(2, LineArray.COORDINATES
            | LineArray.COLOR_3);
    LineArray axisY = new LineArray(2, LineArray.COORDINATES
            | LineArray.COLOR_3);
    LineArray axisZ = new LineArray(2, LineArray.COORDINATES
            | LineArray.COLOR_3);

    // ���_�̃Z�b�g
    Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f green = new Color3f(0.0f, 1.0f, 0.0f);
    Color3f blue = new Color3f(0.0f, 0.0f, 1.0f);

    axisX.setCoordinate(0, new Point3f(-10.0f, 0.0f, 0.0f));
    axisX.setCoordinate(1, new Point3f(10.0f, 0.0f, 0.0f));
    axisX.setColor(0, red);
    axisX.setColor(1, red);

    axisY.setCoordinate(0, new Point3f(0.0f, -10.0f, 0.0f));
    axisY.setCoordinate(1, new Point3f(0.0f, 10.0f, 0.0f));
    axisY.setColor(0, green);
    axisY.setColor(1, green);

    axisZ.setCoordinate(0, new Point3f(0.0f, 0.0f, -10.0f));
    axisZ.setCoordinate(1, new Point3f(0.0f, 0.0f, 10.0f));
    axisZ.setColor(0, blue);
    axisZ.setColor(1, blue);

    // axisBG�ɒlj�
    axisBG.addChild(new Shape3D(axisX));
    axisBG.addChild(new Shape3D(axisY));
    axisBG.addChild(new Shape3D(axisZ));
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:36,代码来源:Axis.java

示例9: createLineTypes

Group createLineTypes() {

    Group lineGroup = new Group();

    Appearance app = new Appearance();
    ColoringAttributes ca = new ColoringAttributes(black,
        ColoringAttributes.SHADE_FLAT);
    app.setColoringAttributes(ca);

    // Plain line
    Point3f[] plaPts = new Point3f[2];
    plaPts[0] = new Point3f(-0.9f, -0.7f, 0.0f);
    plaPts[1] = new Point3f(-0.5f, 0.7f, 0.0f);
    LineArray pla = new LineArray(2, LineArray.COORDINATES);
    pla.setCoordinates(0, plaPts);
    Shape3D plShape = new Shape3D(pla, app);
    lineGroup.addChild(plShape);

    // line pattern dot
    Point3f[] dotPts = new Point3f[2];
    dotPts[0] = new Point3f(-0.4f, -0.7f, 0.0f);
    dotPts[1] = new Point3f(-0.0f, 0.7f, 0.0f);
    LineArray dot = new LineArray(2, LineArray.COORDINATES);
    dot.setCoordinates(0, dotPts);
    LineAttributes dotLa = new LineAttributes();
    dotLa.setLineWidth(2.0f);
    dotLa.setLinePattern(LineAttributes.PATTERN_DOT);
    Appearance dotApp = new Appearance();
    dotApp.setLineAttributes(dotLa);
    dotApp.setColoringAttributes(ca);
    Shape3D dotShape = new Shape3D(dot, dotApp);
    lineGroup.addChild(dotShape);

    // line pattern dash
    Point3f[] dashPts = new Point3f[2];
    dashPts[0] = new Point3f(-0.0f, -0.7f, 0.0f);
    dashPts[1] = new Point3f(0.4f, 0.7f, 0.0f);
    LineArray dash = new LineArray(2, LineArray.COORDINATES);
    dash.setCoordinates(0, dashPts);
    LineAttributes dashLa = new LineAttributes();
    dashLa.setLineWidth(4.0f);
    dashLa.setLinePattern(LineAttributes.PATTERN_DASH);
    Appearance dashApp = new Appearance();
    dashApp.setLineAttributes(dashLa);
    dashApp.setColoringAttributes(ca);
    Shape3D dashShape = new Shape3D(dash, dashApp);
    lineGroup.addChild(dashShape);

    // line pattern dot-dash
    Point3f[] dotDashPts = new Point3f[2];
    dotDashPts[0] = new Point3f(0.5f, -0.7f, 0.0f);
    dotDashPts[1] = new Point3f(0.9f, 0.7f, 0.0f);
    LineArray dotDash = new LineArray(2, LineArray.COORDINATES);
    dotDash.setCoordinates(0, dotDashPts);
    LineAttributes dotDashLa = new LineAttributes();
    dotDashLa.setLineWidth(4.0f);
    dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH_DOT);
    Appearance dotDashApp = new Appearance();
    dotDashApp.setLineAttributes(dotDashLa);
    dotDashApp.setColoringAttributes(ca);
    Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
    lineGroup.addChild(dotDashShape);

    return lineGroup;

  }
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:66,代码来源:LineTypes.java

示例10: addCoordinateSphereAxesToSceneGraph

/**
 * Function to add a white sphere and axes at the origin of the
 * coordinate system for better orientation. The z-axis is in black.
 *
 * @param scene
 * @param radius
 */
public static void addCoordinateSphereAxesToSceneGraph(TransformGroup scene, float scale, Point3f coordPos) {
    if (coordPos == null) {
        coordPos = new Point3f();
    }

    Transform3D t3d = new Transform3D();
    Vector3f spherePos = new Vector3f(coordPos);
    t3d.set(spherePos);
    TransformGroup tg = new TransformGroup(t3d);

    float rad = 10.0f * scale;
    Appearance ap = new Appearance();

    TransparencyAttributes myTA = new TransparencyAttributes();
    myTA.setTransparency(0.1f);
    myTA.setTransparencyMode(TransparencyAttributes.NICEST);
    ap.setTransparencyAttributes(myTA);

    ColoringAttributes ca = new ColoringAttributes();
    ca.setColor(grey);
    ap.setColoringAttributes(ca);
    tg.addChild(new Sphere(rad, ap));
    scene.addChild(tg);

    LineArray la1 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la1.setCoordinate(0, coordPos);
    float axeSize = 100.0f * scale;
    // la1.setCoordinate(1, new Point3f(0.5f * rad, 0.0f, 0.0f));
    la1.setCoordinate(1, new Point3f(coordPos.x + axeSize, coordPos.y, coordPos.z));
    for (int i = 0; i < 2; ++i) {
        la1.setColor(i, yellow);
    }
    scene.addChild(new Shape3D(la1));
    LineArray la2 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la2.setCoordinate(0, coordPos);
    la2.setCoordinate(1, new Point3f(coordPos.x, coordPos.y + axeSize, coordPos.z));
    for (int i = 0; i < 2; ++i) {
        la2.setColor(i, red);
    }
    scene.addChild(new Shape3D(la2));
    LineArray la3 = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
    la3.setCoordinate(0, coordPos);
    la3.setCoordinate(1, new Point3f(coordPos.x, coordPos.y, coordPos.z + axeSize));
    for (int i = 0; i < 2; ++i) {
        la3.setColor(i, blue);
    }
    scene.addChild(new Shape3D(la3));
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:55,代码来源:Utils3D.java

示例11: addAxons

private void addAxons(TransformGroup objRoot) {
    ngView.outPrintln(" processing axons geometry\n");
    task.setMyProgress(0.3f);
    Appearance appearance = new Appearance();
    /*
    float width = 1.0f;
    boolean antialias = false;     
    appearance.setLineAttributes(new LineAttributes(width, LineAttributes.PATTERN_SOLID, antialias));
     */
    TransparencyAttributes myTA = new TransparencyAttributes();
    myTA.setTransparency(0.2f);
    myTA.setTransparencyMode(TransparencyAttributes.NICEST);
    appearance.setTransparencyAttributes(myTA);

    axonsShape3D = new Shape3D();
    //axonsShape3D.removeGeometry(0);
    axonsShape3D.removeAllGeometries();
    axonsShape3D.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
    axonsShape3D.setAppearance(appearance);
    int cAx = 0, totalNumberOfAxonalSegments;
    totalNumberOfAxonalSegments = net.getTotalNumOfAxonalSegments();
    //logger.debug("totalNumberOfAxonalSegments: " + totalNumberOfAxonalSegments);
    for (Neuron neuron : net.getNeuronList()) {
        if (!neuron.collide() && collide) {
            continue;
        }
        Section firstSection = neuron.getAxon().getFirstSection();
        if (firstSection != null) {
            Section.Iterator secIterator = firstSection.getIterator();
            while (secIterator.hasNext()) {
                Section section = secIterator.next();
                Section.SectionType secType = section.getSectionType();
                for (Segment segment : section.getSegments()) {
                    Point3f segStart = new Point3f(segment.getStart());
                    segStart.scale(scale);
                    Point3f segEnd = new Point3f(segment.getEnd());
                    segEnd.scale(scale);
                    LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
                    la.setCoordinate(0, segStart);
                    la.setCoordinate(1, segEnd);

                    /* old color
                    la.setColor(0, new Color3f(0.25f, 0.41f, 0.88f));
                    la.setColor(1, new Color3f(0.25f, 0.41f, 0.88f));
                     */

                    Color3f color;// = Utils3D.darkgreyblue;
                    if (secType == Section.SectionType.MYELINIZED) {
                        //color = Utils3D.darkgreyblue;
                        color = Utils3D.darkOrange;
                    } else {
                        //color = Utils3D.turquoise1;
                        color = Utils3D.darkSalmon;
                    }
                    la.setColor(0, color);
                    la.setColor(1, color);
                    //lineArrayList.add(la);
                    axonsShape3D.addGeometry(la);
                    cAx++;
                    if (totalNumberOfAxonalSegments > 0) {
                        task.setMyProgress(0.3f + cAx * 0.2f / totalNumberOfAxonalSegments);
                    }
                }
            }
        }
    }
    objRoot.addChild(axonsShape3D);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:68,代码来源:NeuGenVisualization.java

示例12: addDendrites

private void addDendrites(TransformGroup objRoot) {
    ngView.outPrintln(" processing dendrites geometry\n");
    Appearance appearance = new Appearance();
    //float width = 1.0f * scale;
    //boolean antialias = true;
    //appearance.setLineAttributes(new LineAttributes(width, LineAttributes.PATTERN_SOLID, antialias));
    dendritesShape3D = new Shape3D();
    dendritesShape3D.removeAllGeometries();
    dendritesShape3D.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
    //dendritesShape3D.removeGeometry(0);
    //dendritesShape3D.setAppearance(appearance);
    TransparencyAttributes myTA = new TransparencyAttributes();
    myTA.setTransparency(0.2f);
    myTA.setTransparencyMode(TransparencyAttributes.NICEST);
    appearance.setTransparencyAttributes(myTA);
    dendritesShape3D.setAppearance(appearance);

    int cDen = 0, totalNumberOfDenSegments;
    totalNumberOfDenSegments = net.getTotalNumOfDenSegments();
    //logger.info("total number of dendrite segments: " + totalNumberOfDenSegments);
    task.setMyProgress(0.5f);
    for (Neuron neuron : net.getNeuronList()) {
        if (!neuron.collide() && collide) {
            continue;
        }
        for (Dendrite dendrite : neuron.getDendrites()) {
            Section firstSection = dendrite.getFirstSection();
            if (firstSection != null) {
                Section.Iterator secIterator = firstSection.getIterator();
                while (secIterator.hasNext()) {
                    Section section = secIterator.next();
                    Section.SectionType secType = section.getSectionType();
                    for (Segment segment : section.getSegments()) {
                        Point3f segStart = new Point3f(segment.getStart());
                        segStart.scale(scale);
                        Point3f segEnd = new Point3f(segment.getEnd());
                        segEnd.scale(scale);
                        LineArray la = new LineArray(2, LineArray.COORDINATES | LineArray.COLOR_3);
                        la.setCoordinate(0, segStart);
                        la.setCoordinate(1, segEnd);
                        Color3f denColor = Utils3D.darkOliveGreen3;
                        if (secType != null) {
                            if (secType.equals(Section.SectionType.APICAL)) {
                                //logger.info("this is an apical section");
                                denColor = Utils3D.magenta;
                            } else if (secType.equals(Section.SectionType.BASAL)) {
                                //logger.info("this is a basal section");
                                //denColor = Utils3D.mediumSpringGreen;
                                denColor = Utils3D.yellow;
                            } else if (secType.equals(Section.SectionType.OBLIQUE)) {
                                //logger.info("this is an oblique section");
                                denColor = Utils3D.brown1;
                            }
                        }
                        la.setColor(0, denColor);
                        la.setColor(1, denColor);

                        //lineArrayList.add(la);
                        /* old color
                        la.setColor(0, new Color3f(0.93f, 0.87f, 0.51f));
                        la.setColor(1, new Color3f(0.93f, 0.87f, 0.51f));
                         */
                        dendritesShape3D.addGeometry(la);
                        cDen++;
                        if (totalNumberOfDenSegments > 0 && !Float.isInfinite(totalNumberOfDenSegments)) {
                            task.setMyProgress(0.5f + cDen * 0.3f / totalNumberOfDenSegments);
                        }
                    }
                }
            }
        }
    }
    objRoot.addChild(dendritesShape3D);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:74,代码来源:NeuGenVisualization.java

示例13: FrameLabels

public FrameLabels() {
    // <editor-fold defaultstate="collapsed">
    setCapability(BranchGroup.ALLOW_DETACH);
    LineArray frameEdges = new LineArray(24, LineArray.COORDINATES | LineArray.COLOR_3);
    int nextEdge = 0;
    addChild(new Shape3D(frameEdges));
    String[] labels = {"-", "0", "+"};
    Color3f frameColor = new Color3f(0.9f, 1.0f, 0.0f);
    float scale = 30f;
    for (int x = -1; x < 2; x++) {
        for (int y = -1; y < 2; y++) {
            for (int z = -1; z < 2; z++) {
                if (x != 0 || y != 0 || z != 0) {
                    int parity = (x + y + z) % 2;
                    String label = labels[x + 1] + labels[y + 1] + labels[z + 1];
                    Text2D text2D = new Text2D(label, frameColor, "Helvetica", 72, Font.PLAIN);
                    text2D.setRectangleScaleFactor(0.02f);
                    text2D.getGeometry().setCapability(Geometry.ALLOW_INTERSECT);
                    OrientedShape3D os3D = new OrientedShape3D();
                    os3D.setGeometry(text2D.getGeometry());
                    os3D.setAppearance(text2D.getAppearance());
                    os3D.setAlignmentMode(OrientedShape3D.ROTATE_ABOUT_POINT);
                    Transform3D move = new Transform3D();
                    move.setTranslation(new Vector3d(scale * x, scale * y, scale * z));
                    TransformGroup tg = new TransformGroup(move);
                    tg.addChild(os3D);
                    addChild(tg);

                    if (parity == 0) {
                        // odd parity means this is an edge center, so let's render the edge of the cube
                        int zeroCoord = (x == 0) ? 0 : ((y == 0) ? 1 : 2);
                        float[] start = {scale * x, scale * y, scale * z};
                        float[] end = {scale * x, scale * y, scale * z};
                        start[zeroCoord] = scale;
                        end[zeroCoord] = -scale;

                        frameEdges.setCoordinate(nextEdge, new Point3f(start));
                        frameEdges.setColor(nextEdge++, frameColor);
                        frameEdges.setCoordinate(nextEdge, new Point3f(end));
                        frameEdges.setColor(nextEdge++, frameColor);
                    }
                }
            }
        }
    }
    // </editor-fold>
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:47,代码来源:Java3dSceneGraph.java

示例14: setVector

public void setVector( Point3f location , Vector3f extent )
{
	VecmathUtils.checkReal( location );
	VecmathUtils.checkReal( extent );
	VecmathUtils.checkNonzero( extent );
	
	if( extent.length( ) == 0 )
	{
		throw new IllegalArgumentException( "extent must be nonzero" );
	}
	
	LineArray newArray = new LineArray( 6 , LineArray.COORDINATES );
	
	synchronized( lock )
	{
		newArray.setCoordinate( 0 , location );
		p1.add( extent , location );
		newArray.setCoordinate( 1 , p1 );
		newArray.setCoordinate( 3 , p1 );
		newArray.setCoordinate( 5 , p1 );
		// newArray.setCoordinate( 7 , p1 );
		// newArray.setCoordinate( 9 , p1 );
		
		v3.scale( -0.25f , extent );
		p1.add( v3 );
		
		if( v3.x == 0 && v3.y == 0 )
		{
			v1.set( 1 , 0 , 0 );
		}
		else
		{
			float xy = ( float ) Math.sqrt( v3.x * v3.x + v3.y * v3.y );
			v1.x = -v3.z * v3.x / xy;
			v1.y = -v3.z * v3.y / xy;
			v1.z = xy;
		}
		
		v2.cross( v1 , v3 );
		v2.scale( v3.length( ) / v2.length( ) );
		
		p2.add( p1 , v1 );
		newArray.setCoordinate( 2 , p2 );
		p2.scaleAdd( -1 , v1 , p1 );
		newArray.setCoordinate( 4 , p2 );
	}
	
	shape.setGeometry( newArray );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:49,代码来源:DebugVector.java


注:本文中的javax.media.j3d.LineArray.COORDINATES属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。