本文整理汇总了Java中javax.media.j3d.LineArray.setCoordinates方法的典型用法代码示例。如果您正苦于以下问题:Java LineArray.setCoordinates方法的具体用法?Java LineArray.setCoordinates怎么用?Java LineArray.setCoordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.LineArray
的用法示例。
在下文中一共展示了LineArray.setCoordinates方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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;
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: 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);
}