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


Java LineArray类代码示例

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


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

示例1: setLines

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

示例2: addLines

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

示例3: visualizeNormals

import javax.media.j3d.LineArray; //导入依赖的package包/类
public static Shape3D visualizeNormals( Shape3D shape , float scale , boolean local , Appearance app )
{
	final GeometryArray geomArray = ( GeometryArray ) shape.getGeometry( );
	
	LineArray rendered;
	
	if( geomArray instanceof IndexedGeometryArray )
	{
		final IndexedGeometryArray indexedGeomArray = ( IndexedGeometryArray ) geomArray;
		rendered = renderNormals( indexedGeomArray , scale );
	}
	else
	{
		rendered = renderNormals( geomArray , scale );
	}
	
	if( !local )
	{
		final Transform3D localToVworld = new Transform3D( );
		shape.getLocalToVworld( localToVworld );
		transformCoordinates( rendered , localToVworld );
	}
	
	return new Shape3D( rendered , app );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:26,代码来源:J3DUtils.java

示例4: visualizeFronts

import javax.media.j3d.LineArray; //导入依赖的package包/类
public static Shape3D visualizeFronts( Shape3D shape , float scale , boolean local , Appearance app )
{
	LineArray rendered = renderFronts( shape , scale );
	
	if( rendered == null )
	{
		return null;
	}
	if( local )
	{
		final Transform3D localToVworld = new Transform3D( );
		shape.getLocalToVworld( localToVworld );
		transformCoordinates( rendered , localToVworld );
	}
	return new Shape3D( rendered , app );
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:17,代码来源:J3DUtils.java

示例5: 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

示例6: create3D

import javax.media.j3d.LineArray; //导入依赖的package包/类
private void create3D() {
	super.create3D(true);
	// construct sensor body - a line for each individual sensor ray.
	Point3d[] coords = new Point3d[nbSensors * 2];
	for (int i = 0; i < nbSensors; i++) {
		Point3d start = new Point3d(positions[i]);
		coords[i * 2] = start;
		Point3d end = new Point3d(start);
		Point3d direction = new Point3d(directions[i]);
		if (((flags & FLAG_SHOW_FULL_SENSOR_RAY) == 0) && (type != TYPE_BUMPER))
			direction.scale(0.05f); // just a small ray
		end.add(direction);
		coords[i * 2 + 1] = end;

	}
	LineArray line = new LineArray(coords.length, GeometryArray.COORDINATES);
	line.setCoordinates(0, coords);

	Appearance appear = new Appearance();
	Material material = new Material();

	ColoringAttributes ca = new ColoringAttributes();
	ca.setColor(color);

	appear.setColoringAttributes(ca);
	appear.setMaterial(material);
	Shape3D shape = new Shape3D(line, appear);
	shape.setCollidable(false);
	shape.setPickable(false);
	addChild(shape);

}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:33,代码来源:RangeSensorBelt.java

示例7: addLines

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

示例8: 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

示例9: 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

示例10: 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

示例11: create3D

import javax.media.j3d.LineArray; //导入依赖的package包/类
private void create3D() {
  super.create3D(true);
  // construct sensor body - a line for each individual sensor ray.
  Point3d[] coords = new Point3d[nbSensors * 2];
  for (int i = 0; i < nbSensors; i++) {
    Point3d start = new Point3d(positions[i]);
    coords[i * 2] = start;
    Point3d end = new Point3d(start);
    Point3d direction = new Point3d(directions[i]);
    if (((flags & FLAG_SHOW_FULL_SENSOR_RAY) == 0) && (type != TYPE_BUMPER))
      direction.scale(0.05f); // just a small ray
    end.add(direction);
    coords[i * 2 + 1] = end;

  }
  LineArray line = new LineArray(coords.length, GeometryArray.COORDINATES);
  line.setCoordinates(0, coords);

  Appearance appear = new Appearance();
  Material material = new Material();

  ColoringAttributes ca = new ColoringAttributes();
  ca.setColor(color);

  appear.setColoringAttributes(ca);
  appear.setMaterial(material);
  Shape3D shape = new Shape3D(line, appear);
  shape.setCollidable(false);
  shape.setPickable(false);
  addChild(shape);

}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:33,代码来源:RangeSensorBelt.java

示例12: 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

示例13: 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

示例14: 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

示例15: renderFronts

import javax.media.j3d.LineArray; //导入依赖的package包/类
public static LineArray renderFronts( Shape3D shape , float scale )
{
	Geometry geom = shape.getGeometry( );
	
	if( geom instanceof IndexedGeometryArray )
	{
		return renderFronts( ( IndexedGeometryArray ) geom , scale );
	}
	else if( geom instanceof GeometryArray )
	{
		return renderFronts( ( GeometryArray ) geom , scale );
	}
	return null;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:15,代码来源:J3DUtils.java


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