/** * 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); }
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); }
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); }
c.getContent().getCenter(contentCenter); final Point3f center = new Point3f(contentCenter);
c.getContent().getCenter(contentCenter); final Point3f center = new Point3f(contentCenter);