public void setChannels(final boolean[] channels) { final boolean channelsChanged = channels[0] != this.channels[0] || channels[1] != this.channels[1] || channels[2] != this.channels[2]; if (!channelsChanged) return; this.channels = channels; if (contentNode != null) contentNode.channelsUpdated(channels); }
public void clearDisplayedData() { if (!available) return; contentNode.clearDisplayedData(); available = false; }
public void eyePtChanged(final View view) { if (contentNode != null) contentNode.eyePtChanged(view); }
public void contentProperties(final Content c) { if (!checkSel(c)) return; final Point3d min = new Point3d(); final Point3d max = new Point3d(); final Point3d center = new Point3d(); c.getContent().getMin(min); c.getContent().getMax(max); c.getContent().getCenter(center); final TextWindow tw = new TextWindow(c.getName(), " \tx\ty\tz", "min\t" + (float) min.x + "\t" + (float) min.y + "\t" + (float) min.z + "\n" + "max\t" + (float) max.x + "\t" + (float) max.y + "\t" + (float) max.z + "\n" + "cog\t" + (float) center.x + "\t" + (float) center.y + "\t" + (float) center.z + "\n\n" + "volume\t" + c.getContent().getVolume(), 512, 512); }
/** * Make sure that the average center of all contents is visible in the canvas. */ public void addCenterOf(final Iterable<Content> contents) { final Point3d center = new Point3d(); final Point3d tmp = new Point3d(); int counter = 0; for (final Content c : contents) { final Transform3D localToVworld = new Transform3D(); c.getContent().getLocalToVworld(localToVworld); c.getContent().getMin(tmp); center.add(tmp); c.getContent().getMax(tmp); center.add(tmp); counter += 2; } center.x /= counter; center.y /= counter; center.z /= counter; add(center); }
/** * Select the view at the selected Content. */ public void centerSelected(final Content c) { final Point3d center = new Point3d(); c.getContent().getCenter(center); final Transform3D localToVWorld = new Transform3D(); c.getContent().getLocalToVworld(localToVWorld); localToVWorld.transform(center); getViewPlatformTransformer().centerAt(center); }
c.getContent().getCenter(centerInVWorld); localToVWorld.transform(centerInVWorld); ipToVWorldInverse.transform(centerInVWorld, centerInIp); c.getContent().getMin(p1); localToVWorld.transform(p1); r = (float) p1.distance(centerInVWorld); c.getContent().getCenter(vec); transl_inv.set(vec); vec.set(-vec.x, -vec.y, -vec.z);
public void setTransform(final Transform3D transform) { if (contentNode == null) return; final Transform3D t = new Transform3D(); final Point3d c = new Point3d(); contentNode.getCenter(c); final Matrix3f m = new Matrix3f(); transform.getRotationScale(m); t.setRotationScale(m); // One might thing a rotation matrix has no translational // component, however, if the rotation is composed of // translation - rotation - backtranslation, it has indeed. final Vector3d v = new Vector3d(); v.x = -m.m00 * c.x - m.m01 * c.y - m.m02 * c.z + c.x; v.y = -m.m10 * c.x - m.m11 * c.y - m.m12 * c.z + c.y; v.z = -m.m20 * c.x - m.m21 * c.y - m.m22 * c.z + c.z; t.setTranslation(v); localRotate.setTransform(t); final Vector3d v2 = new Vector3d(); transform.get(v2); v2.sub(v); t.set(v2); localTranslate.setTransform(t); }
public void setLUT(final int[] rLUT, final int[] gLUT, final int[] bLUT, final int[] aLUT) { this.rLUT = rLUT; this.gLUT = gLUT; this.bLUT = bLUT; this.aLUT = aLUT; if (contentNode != null) contentNode.lutUpdated(rLUT, gLUT, bLUT, aLUT); }
public void setColor(final Color3f color) { if ((this.color == null && color == null) || (this.color != null && color != null && this.color.equals(color))) return; this.color = color; plShape.setColor(color); if (contentNode != null) contentNode.colorUpdated(this.color); }
public void getMin(final Point3d min) { min.set(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE); final Point3d tmp = new Point3d(); for (final ContentInstant c : contents.values()) { c.getContent().getMin(tmp); if (tmp.x < min.x) min.x = tmp.x; if (tmp.y < min.y) min.y = tmp.y; if (tmp.z < min.z) min.z = tmp.z; } }
public void getMax(final Point3d max) { max.set(Double.MIN_VALUE, Double.MIN_VALUE, Double.MIN_VALUE); final Point3d tmp = new Point3d(); for (final ContentInstant c : contents.values()) { c.getContent().getMax(tmp); if (tmp.x > max.x) max.x = tmp.x; if (tmp.y > max.y) max.y = tmp.y; if (tmp.z > max.z) max.z = tmp.z; } }
/** * Add another Content which should be completely visible in the canvas. */ public void add(final Content c) { final Transform3D localToVworld = new Transform3D(); c.getContent().getLocalToVworld(localToVworld); final Point3d min = new Point3d(); c.getContent().getMin(min); final Point3d max = new Point3d(); c.getContent().getMax(max); final Point3d tmp = new Point3d(); // transform each of the 8 corners to vworld // coordinates and feed it to add(Point3d). add(localToVworld, new Point3d(min.x, min.y, min.z)); add(localToVworld, new Point3d(max.x, min.y, min.z)); add(localToVworld, new Point3d(min.x, max.y, min.z)); add(localToVworld, new Point3d(max.x, max.y, min.z)); add(localToVworld, new Point3d(min.x, min.y, max.z)); add(localToVworld, new Point3d(max.x, min.y, max.z)); add(localToVworld, new Point3d(min.x, max.y, max.z)); add(localToVworld, new Point3d(max.x, max.y, max.z)); }
c.getContent().getCenter(contentCenter); final Point3f center = new Point3f(contentCenter);
c.getContent().getCenter(contentCenter); final Point3f center = new Point3f(contentCenter);