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


Java LineArray.setCoordinate方法代码示例

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


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

示例1: makeLineGeometry

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
LineArray makeLineGeometry( Strut strut, AlgebraicField field, Embedding embedding )
{
    LineArray result = new LineArray( 2, GeometryArray.COORDINATES );
    
    Point3d pt = null;
    AlgebraicVector gv = null;
    RealVector v = null;
    
    gv = strut .getLocation();

    v = embedding .embedInR3( gv );
    pt = new Point3d();
    pt.x = v.x; pt.y = v.y; pt.z = v.z;
    result .setCoordinate( 0, pt );
    
    gv = strut .getEnd();

    v = embedding .embedInR3( gv );
    pt = new Point3d();
    pt.x = v.x; pt.y = v.y; pt.z = v.z;
    result .setCoordinate( 1, pt );
    
    return result;
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:25,代码来源:Java3dWireframeFactory.java

示例2: addScaleBarToSceneGraph

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
/**
 * 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,代码行数:45,代码来源:Utils3D.java

示例3: createLineArrayFromPoints

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:10,代码来源:Line3dCreator.java

示例4: addCoordinateSphereAxesToSceneGraph

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
/**
 * 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,代码行数:35,代码来源:ColorUtil.java

示例5: Axis

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:34,代码来源:Axis.java

示例6: Axis

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:37,代码来源:Axis.java

示例7: renderNormals

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
public static LineArray renderNormals( IndexedGeometryArray array , float scale )
{
	final Point3f[ ] coordinates = copyCoordinates3f( array );
	final Vector3f[ ] normals = copyNormals3f( array );
	final int[ ] coordinateIndices = copyCoordinateIndices( array );
	final int[ ] normalIndices = copyNormalIndices( array );
	
	if( coordinates == null || normals == null || coordinateIndices == null || normalIndices == null )
	{
		throw new IllegalArgumentException( "Unable to get necessary information from the geometry" );
	}
	
	final int vertexCount = coordinateIndices.length * 2;
	
	final Point3f temp = new Point3f( );
	
	final LineArray result = new LineArray( vertexCount , GeometryArray.COORDINATES );
	int k = 0;
	for( int i = 0 ; i < coordinateIndices.length ; i++ )
	{
		final Point3f coordinate = coordinates[ coordinateIndices[ i ] ];
		final Vector3f normal = normals[ normalIndices[ i ] ];
		result.setCoordinate( k++ , coordinate );
		temp.scaleAdd( scale , normal , coordinate );
		result.setCoordinate( k++ , temp );
	}
	
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:30,代码来源:J3DUtils.java

示例8: createAxis

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
public static BranchGroup createAxis()
{

	BranchGroup axisBG = new BranchGroup();

	// create line for X axis
	LineArray axisXLines = new LineArray(2, GeometryArray.COORDINATES
			| GeometryArray.COLOR_3);
	axisBG.addChild(new Shape3D(axisXLines));

	axisXLines.setCoordinate(0, new Point3f(-1.0f, 0.0f, 0.0f));
	axisXLines.setCoordinate(1, new Point3f(1.0f, 0.0f, 0.0f));

	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);

	// create line for Y axis
	LineArray axisYLines = new LineArray(2, GeometryArray.COORDINATES
			| GeometryArray.COLOR_3);
	axisBG.addChild(new Shape3D(axisYLines));

	axisYLines.setCoordinate(0, new Point3f(0.0f, -1.0f, 0.0f));
	axisYLines.setCoordinate(1, new Point3f(0.0f, 1.0f, 0.0f));

	axisYLines.setColor(0, green);
	axisYLines.setColor(1, blue);

	// create line for Z axis
	Point3f z1 = new Point3f(0.0f, 0.0f, -1.0f);
	Point3f z2 = new Point3f(0.0f, 0.0f, 1.0f);

	LineArray axisZLines = new LineArray(10, GeometryArray.COORDINATES
			| GeometryArray.COLOR_3);
	axisBG.addChild(new Shape3D(axisZLines));

	axisZLines.setCoordinate(0, z1);
	axisZLines.setCoordinate(1, z2);
	axisZLines.setCoordinate(2, z2);
	axisZLines.setCoordinate(3, new Point3f(0.1f, 0.1f, 0.9f));
	axisZLines.setCoordinate(4, z2);
	axisZLines.setCoordinate(5, new Point3f(-0.1f, 0.1f, 0.9f));
	axisZLines.setCoordinate(6, z2);
	axisZLines.setCoordinate(7, new Point3f(0.1f, -0.1f, 0.9f));
	axisZLines.setCoordinate(8, z2);
	axisZLines.setCoordinate(9, new Point3f(-0.1f, -0.1f, 0.9f));

	Color3f colors[] = new Color3f[9];

	colors[0] = new Color3f(0.0f, 1.0f, 1.0f);
	for (int v = 0; v < 9; v++)
	{
		colors[v] = red;
	}

	axisZLines.setColors(1, colors);

	return axisBG;
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:60,代码来源:Axis3D.java

示例9: addCoordinateSphereAxesToSceneGraph

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
/**
 * 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,代码行数:56,代码来源:Utils3D.java

示例10: addAxons

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:69,代码来源:NeuGenVisualization.java

示例11: addDendrites

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:75,代码来源:NeuGenVisualization.java

示例12: FrameLabels

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:48,代码来源:Java3dSceneGraph.java

示例13: setVector

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
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,代码行数:50,代码来源:DebugVector.java

示例14: renderFronts

import javax.media.j3d.LineArray; //导入方法依赖的package包/类
public static LineArray renderFronts( IndexedGeometryArray geom , float scale )
{
	List<Point3f> points = new ArrayList<Point3f>( );
	
	Point3f[ ] coordinates = copyCoordinates3f( geom );
	int[ ] indices = copyCoordinateIndices( geom );
	
	Point3f t = new Point3f( );
	Vector3f v1 = new Vector3f( );
	Vector3f v2 = new Vector3f( );
	Vector3f n = new Vector3f( );
	
	int k;
	for( k = 0 ; k < indices.length ; k += 3 )
	{
		Point3f a = coordinates[ indices[ k ] ];
		Point3f b = coordinates[ indices[ k + 1 ] ];
		Point3f c = coordinates[ indices[ k + 2 ] ];
		
		v1.sub( b , a );
		v2.sub( c , b );
		
		n.cross( v2 , v1 );
		n.normalize( );
		
		t.add( a , b );
		t.add( c );
		t.scale( 1 / 3f );
		
		points.add( new Point3f( t ) );
		t.add( n );
		points.add( new Point3f( t ) );
	}
	
	LineArray result = new LineArray( points.size( ) , GeometryArray.COORDINATES );
	k = 0;
	for( Point3f p : points )
	{
		result.setCoordinate( k++ , p );
	}
	
	return result;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:44,代码来源:J3DUtils.java


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