private static void show(Node node) { StateSet states = StateSet.forTwoSidedShinySurface(Color.CYAN); node.setStates(states); World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); }
private static void show(Node node) { World world = new World(); world.addChild(node); SimpleFrame sf = new SimpleFrame(world); sf.getOrbitView().setScale(2.0); } }
/** * Returns a new simple frame with a triangle group. * @param tg a triangle group. * @return the simple frame. */ public static SimpleFrame asTriangles(TriangleGroup tg) { SimpleFrame sf = new SimpleFrame(); sf.addTriangles(tg); sf.getOrbitView().setWorldSphere(tg.getBoundingSphere(true)); return sf; }
public void testPoint() { int ntrial = 10; for (int itrial=0; itrial<ntrial; ++itrial) { Point3 p = randomPoint3(); Point3 pc = new Point3(p); Vector3 v = randomVector3(); assertEquals(p,p.plus(v).minus(v)); assertEquals(p,pc.plusEquals(v).minusEquals(v)); Point3 q = p.minus(v); assertEquals(q.distanceTo(p),v.length()); } }
private void buildTree(Group parent, BoundingBoxTree.Node bbtNode, int[] ijkl, float[] xyz, float[] uvw, float[] rgb) { if (bbtNode.isLeaf()) { QuadNode qn = new QuadNode(bbtNode,ijkl,xyz,uvw,rgb); parent.addChild(qn); } else { Group group = new Group(); parent.addChild(group); buildTree(group,bbtNode.getLeft(),ijkl,xyz,uvw,rgb); buildTree(group,bbtNode.getRight(),ijkl,xyz,uvw,rgb); } }
private void buildTree(Group parent, BoundingBoxTree.Node bbtNode, int[] ijk, float[] xyz, float[] uvw, float[] rgb) { if (bbtNode.isLeaf()) { TriangleNode tn = new TriangleNode(bbtNode,ijk,xyz,uvw,rgb); parent.addChild(tn); } else { Group group = new Group(); parent.addChild(group); buildTree(group,bbtNode.getLeft(),ijk,xyz,uvw,rgb); buildTree(group,bbtNode.getRight(),ijk,xyz,uvw,rgb); } }
/** * Returns a new simple frame with an image panel group. * @param ipg an image panel group. * @return the simple frame. */ public static SimpleFrame asImagePanels(ImagePanelGroup ipg) { SimpleFrame sf = new SimpleFrame(); sf.addImagePanels(ipg); sf.getOrbitView().setWorldSphere(ipg.getBoundingSphere(true)); return sf; }
public void testMatrixVector() { int ntrial = 10; for (int itrial=0; itrial<ntrial; ++itrial) { Vector3 v = randomVector3(); Matrix44 a = randomMatrix33(); Matrix44 ata = a.transposeTimes(a); assertEquals(ata.times(v),a.transposeTimes(a.times(v))); Matrix44 aat = a.timesTranspose(a); assertEquals(aat.times(v),a.times(a.transposeTimes(v))); } }
/** * Recursively builds a binary tree with leaf quad nodes. */ private void buildTree(int[] ijkl, float[] xyz, float[] uvw, float[] rgb) { float[] c = computeCenters(ijkl,xyz); BoundingBoxTree bbt = new BoundingBoxTree(MIN_QUAD_PER_NODE,c); buildTree(this,bbt.getRoot(),ijkl,xyz,uvw,rgb); } private void buildTree(Group parent, BoundingBoxTree.Node bbtNode,
/** * Restores the most recently saved (pushed) local-to-world transform. * Discards the current local-to-world transform. */ public void popLocalToWorld() { super.popLocalToWorld(); _pickSegment = _pickSegmentStack.pop(); _nearPoint = _pickSegment.getA(); _farPoint = _pickSegment.getB(); }
/** * Sets the bounding sphere of the frame with a given center x, y, z and * radius. * @param x the center X-coordinate. * @param y the center Y-coordinate. * @param z the center Z-coordinate. * @param r the radius. */ public void setWorldSphere(double x, double y, double z, double r) { setWorldSphere(new BoundingSphere(x,y,z,r)); }
/** * Pushes the view-dependent transform onto the specified pick context. * @param pc the pick context. */ protected void pickBegin(PickContext pc) { super.pickBegin(pc); Matrix44 transform = computeTransform(pc); pc.pushLocalToWorld(transform); }
/** * Pushes the view-dependent transform onto the specified cull context. * @param cc the cull context. */ protected void cullBegin(CullContext cc) { super.cullBegin(cc); Matrix44 transform = computeTransform(cc); cc.pushLocalToWorld(transform); }
/** * Gets the local-to-pixel transform. * @return the local-to-pixel transform. */ public Matrix44 getLocalToPixel() { return getWorldToPixel().timesEquals(_localToWorld); }
/** * Gets the world-to-pixel transform. * @return the world-to-pixel transform. */ public Matrix44 getWorldToPixel() { return getViewToPixel().timesEquals(_worldToView); }
/** * Gets the pixel-to-view transform. * @return the pixel-to-view transform. */ public Matrix44 getPixelToView() { return getViewToPixel().inverseEquals(); }
/** * Pushes the transform matrix onto the specified pick context. * @param pc the pick context. */ protected void pickBegin(PickContext pc) { super.pickBegin(pc); pc.pushLocalToWorld(_transform); }
/** * Pops the view-dependent transform from the specified cull context. * @param cc the cull context. */ protected void cullEnd(CullContext cc) { cc.popLocalToWorld(); super.cullEnd(cc); }