本文整理汇总了Java中javax.media.j3d.LineArray类的典型用法代码示例。如果您正苦于以下问题:Java LineArray类的具体用法?Java LineArray怎么用?Java LineArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineArray类属于javax.media.j3d包,在下文中一共展示了LineArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: createLineTypes
import javax.media.j3d.LineArray; //导入依赖的package包/类
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,代码行数:67,代码来源:LineTypes.java
示例17: addKinectShape
import javax.media.j3d.LineArray; //导入依赖的package包/类
public void addKinectShape() {
// create an appearance
Appearance ap = new Appearance();
// render as a wireframe
PolygonAttributes polyAttrbutes = new PolygonAttributes();
polyAttrbutes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
polyAttrbutes.setCullFace(PolygonAttributes.CULL_NONE);
ap.setPolygonAttributes(polyAttrbutes);
Box kinect = new Box(0.6f, 0.1f, 0.2f, ap);
// scale and move start position to (-4,0,0) // change later
TransformGroup posnTG = new TransformGroup();
Transform3D t3d = new Transform3D();
// t3d.setScale(0.5);
t3d.setTranslation(new Vector3d(0f, 2.4f, 6.0f));
posnTG.setTransform(t3d);
posnTG.addChild(kinect);
Color3f red = new Color3f(1.0f, 0.0f, 0.0f);
// line pattern dot-dash
ColoringAttributes ca = new ColoringAttributes(red, ColoringAttributes.NICEST);
Point3f[] dotDashPts = new Point3f[2];
dotDashPts[0] = new Point3f(0.0f, 0.0f, 0.0f);
dotDashPts[1] = new Point3f(4.9f, 4.7f, -5.0f);
LineArray dotDash = new LineArray(2, GeometryArray.COORDINATES);
dotDash.setCoordinates(0, dotDashPts);
LineAttributes dotDashLa = new LineAttributes();
dotDashLa.setLineWidth(4.0f);
dotDashLa.setLinePattern(LineAttributes.PATTERN_DASH);
Appearance dotDashApp = new Appearance();
dotDashApp.setLineAttributes(dotDashLa);
dotDashApp.setColoringAttributes(ca);
Shape3D dotDashShape = new Shape3D(dotDash, dotDashApp);
posnTG.addChild(dotDashShape);
// Shape3D pyramid = createPyramid();
// posnTG.addChild(pyramid);
sceneBG.addChild(posnTG);
}
开发者ID:glaudiston,项目名称:project-bianca,代码行数:44,代码来源:Points3DPanel.java
示例18: createAxis
import javax.media.j3d.LineArray; //导入依赖的package包/类
/**
* Creates a representation of the 3 axis of the 3d world. Used only in the
* creation phase.
*/
private void createAxis() {
Point3f[] axisCoords = {
// X axis arrow
new Point3f(0.0f, 0.001f, 0.0f), new Point3f(1, 0.001f, 0.0f), new Point3f(1, 0.001f, 0.0f),
new Point3f(0.95f, 0.001f, 0.05f),
new Point3f(1, 0.001f, 0.0f),
new Point3f(0.95f, 0.001f, -0.05f),
// a small X
new Point3f(1.0f, 0.001f, 0.1f), new Point3f(0.9f, 0.001f, 0.2f),
new Point3f(1.0f, 0.001f, 0.2f),
new Point3f(0.9f, 0.001f, 0.1f),
// Z axis arrow
new Point3f(0.0f, 0.001f, 0.0f), new Point3f(0, 0.001f, 1.0f), new Point3f(0, 0.001f, 1.0f), new Point3f(0.05f, 0.001f, 0.95f),
new Point3f(0, 0.001f, 1.0f),
new Point3f(-0.05f, 0.001f, 0.95f),
// a small Z
new Point3f(0.1f, 0.001f, 1.0f), new Point3f(0.2f, 0.001f, 1.0f), new Point3f(0.1f, 0.001f, 0.9f), new Point3f(0.2f, 0.001f, 0.9f),
new Point3f(0.1f, 0.001f, 1.0f), new Point3f(0.2f, 0.001f, 0.9f),
// Y axis arrow
new Point3f(0.0f, 0.001f, 0.0f), new Point3f(0, 1.0f, 0.0f), new Point3f(0, 1.0f, 0.0f), new Point3f(0.05f, 0.95f, 0f), new Point3f(0, 1f, 0f),
new Point3f(0.00f, 0.95f, 0.05f),
// a small Y
new Point3f(0.2f, 1f, 0.0f), new Point3f(0.1f, 0.9f, 0f), new Point3f(0.1f, 1.0f, 0.0f), new Point3f(0.15f, 0.95f, 0.0f)
};
// scale axis drawing to 5% of word size
for (int i = 0; i < axisCoords.length; i++) {
axisCoords[i].scale(worldSize * 0.05f);
}
LineArray axisLines = new LineArray(axisCoords.length, GeometryArray.COORDINATES);
axisLines.setCoordinates(0, axisCoords);
Appearance axisAppear = new Appearance();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(white);
axisAppear.setColoringAttributes(ca);
Material mat = new Material();
mat.setDiffuseColor(white);
axisAppear.setMaterial(mat);
Shape3D axis = new Shape3D(axisLines, axisAppear);
axis.setCollidable(false);
axis.setPickable(false);
sceneTrans.addChild(axis);
}
开发者ID:glaudiston,项目名称:project-bianca,代码行数:54,代码来源:World.java
示例19: setup
import javax.media.j3d.LineArray; //导入依赖的package包/类
private void setup()
{
// Can be used to make coordSys smaller TODO: specify in constructor
Transform3D coordTrans = new Transform3D();
coordTrans.setTranslation(translation);
coordTrans.setScale(scale);
setTransform(coordTrans);
RenderingAttributes ra = new RenderingAttributes();
ra.setDepthBufferEnable(true);
LineArray xGeom = new LineArray(10, GeometryArray.COORDINATES);
setupArrow(plusX, plusY, plusZ);
xGeom.setCoordinates(0, line);
ColoringAttributes xColoringAttributes = new ColoringAttributes(1.0f,
0.0f, 0.0f, ColoringAttributes.SHADE_FLAT);
Appearance xAppearance = new Appearance();
xAppearance.setColoringAttributes(xColoringAttributes);
xAppearance.setRenderingAttributes(ra);
Shape3D xShape = new Shape3D(xGeom, xAppearance);
addChild(xShape);
LineArray yGeom = new LineArray(10, GeometryArray.COORDINATES);
setupArrow(plusY, plusX, plusZ);
yGeom.setCoordinates(0, line);
ColoringAttributes yColoringAttributes = new ColoringAttributes(0.0f,
1.0f, 0.0f, ColoringAttributes.SHADE_FLAT);
Appearance yAppearance = new Appearance();
yAppearance.setColoringAttributes(yColoringAttributes);
yAppearance.setRenderingAttributes(ra);
Shape3D yShape = new Shape3D(yGeom, yAppearance);
addChild(yShape);
LineArray zGeom = new LineArray(10, GeometryArray.COORDINATES);
setupArrow(plusZ, plusX, plusY);
zGeom.setCoordinates(0, line);
ColoringAttributes zColoringAttributes = new ColoringAttributes(0.0f,
0.0f, 1.0f, ColoringAttributes.SHADE_FLAT);
Appearance zAppearance = new Appearance();
zAppearance.setColoringAttributes(zColoringAttributes);
zAppearance.setRenderingAttributes(ra);
Shape3D zShape = new Shape3D(zGeom, zAppearance);
addChild(zShape);
}
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:46,代码来源:CoordSys.java
示例20: 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
注:本文中的javax.media.j3d.LineArray类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论