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