str.append( ((Shape3D)item).getGeometry() );
ArrayList geoArrays = new ArrayList(); for (int k = 0; k < shape.numGeometries(); k++) { Geometry geometry = shape.getGeometry(k); if (geometry instanceof CompressedGeometry) { Shape3D[] sa = ((CompressedGeometry)geometry).decompress(); for (int j = 0; j < sa.length; j++) { for (int i = 0; i < sa[j].numGeometries(); i++) { geoArrays.add(sa[j].getGeometry(i));
float radius = 2.4f; int divisions = 24; // Further flags: GENERATE_TEXTURE_COORDS etc. int primflags = Sphere.GEOMETRY_NOT_SHARED | Sphere.GENERATE_NORMALS; Sphere sphere = new Sphere(radius, primflags, divisions); Shape3D shape3D = sphere.getShape(); Geometry = shape3D.getGeometry(); // Your desired result ! shape3D.setGeometry(null);
public ShapeGroup duplicate() { final ShapeGroup ret = new ShapeGroup(); if (shape != null) { ret.shape = new Shape3D(shape.getGeometry(), shape.getAppearance()); ret.group.addChild(ret.shape); } ret.pos = pos; return ret; } }
public Shape3DState( SymbolTableData symbol, Controller control ) { super( symbol, control ); if (node!=null) { appearance = control.getSymbolTable().addReference( ((Shape3D)node).getAppearance() ); int length = ((Shape3D)node).numGeometries(); geometry = new int[length]; for(int i=0; i<length; i++) geometry[i] = control.getSymbolTable().addReference( ((Shape3D)node).getGeometry(i) ); } }
if (node instanceof Shape3D) { Shape3D shape = (Shape3D) node; if (shape.getGeometry() instanceof LineArray) { Appearance appearance = shape.getAppearance(); ColoringAttributes ca = appearance.getColoringAttributes(); LineArray segments = (LineArray) shape.getGeometry(); int nSegs = segments.getVertexCount(); for (int i = 0; i < nSegs; i++) {
if (benchmark) startTime = System.currentTimeMillis() ; Geometry g = shapes[0].getGeometry() ; if (! (g instanceof GeometryArray)) throw new IllegalArgumentException if (debug) System.out.println("\nShape3D " + s + ":") ; g = shapes[s].getGeometry() ; if (! (g instanceof GeometryArray)) throw new IllegalArgumentException
if (benchmark) startTime = System.currentTimeMillis() ; Geometry g = shapes[0].getGeometry() ; if (! (g instanceof GeometryArray)) throw new IllegalArgumentException if (debug) System.out.println("\nShape3D " + s + ":") ; g = shapes[s].getGeometry() ; if (! (g instanceof GeometryArray)) throw new IllegalArgumentException
Geometry geo = shape.getGeometry(i); if (geo instanceof GeometryArray) { setCapabilities((GeometryArray)geo, level);
/** * Use the currently selected color to paint an edge. * * @param shape a Java3D shape - must be a LineArray * */ void highlightEdge(Shape3D shape) { Color3f highlightColor = volumes.getSelectedColor(); if (shape.getGeometry() instanceof LineArray) { Appearance appearance = shape.getAppearance(); ColoringAttributes ca = appearance.getColoringAttributes(); Color3f before = new Color3f(); appearance.setColoringAttributes(ca); ca.getColor(before); ca.setColor(highlightColor); } }
/** * Draw the specified Shape3D leaf node object. This is * a convenience method that is identical to calling the * setAppearance(Appearance) and draw(Geometry) methods * passing the appearance and geometry component objects of * the specified shape node as arguments. * * @param shape the Shape3D node containing the Appearance component * object to set and Geometry component object to draw * * @exception IllegalSharingException if the Shape3D node * is part of or is subsequently made part of a live scene graph. * * @exception IllegalSharingException if the Shape3D node's Appearance * refers to an ImageComponent2D that is being used by a * Canvas3D as an off-screen buffer. */ public void draw(Shape3D shape) { if (shape.isLive()) { throw new IllegalSharingException(J3dI18N.getString("GraphicsContext3D26")); } ((Shape3DRetained)shape.retained).setInImmCtx(true); setAppearance(shape.getAppearance()); draw(shape.getGeometry()); }
/** * Sets the slice index of the specified plane to the given value. * * @param axis * @param v */ public void setSlice(final int axis, final int v) { if (v >= dimensions[axis] || v < 0) return; slices[axis] = v; final Group g = (Group) axisSwitch.getChild(axisIndex[axis][FRONT]); final int num = g.numChildren(); if (num > 1) System.out.println(num + " children, expected only 1"); final Shape3D shape = (Shape3D) ((Group) g.getChild(num - 1)).getChild(0); final double[] quadCoords = geomCreator.getQuadCoords(axis, v); ((QuadArray) shape.getGeometry()).setCoordinates(0, quadCoords); final Texture2D tex = appCreator.getTexture(axis, v); shape.getAppearance().setTexture(tex); final TexCoordGeneration tg = appCreator.getTg(axis); shape.getAppearance().setTexCoordGeneration(tg); } }
/** * Compute the volume (number of voxels) that this Java3D shape intercepts * in the original image (prior to skeletonization) * * @param shape */ private void computeAndDisplayEdgeVolume(Shape3D shape) { // Has user clicked on a J3D line? if (!(shape.getGeometry() instanceof LineArray)) { return; // NOPE } // Does this line correspond to an Edge? UserData userData = (UserData) (shape.getUserData()); Object graphData = userData.getGraphInfo(); if (!(graphData instanceof Edge)) { return; // NOPE } int voxelCount = reconstructEdge((Edge) graphData); // Initialize int oldColorIndex = userData.getColorIndex(); int currentColorIndex = volumes.getCurrentColorIndex(); volumes.updateVoxelCount(oldColorIndex, -voxelCount); volumes.updateVoxelCount(currentColorIndex, +voxelCount); // Make corresponding changes to the VolumePanel volumesPanel.updateVoxelCount(oldColorIndex); volumesPanel.updateVoxelCount(currentColorIndex); userData.setColorIndex(currentColorIndex); }
a.setTexture(p.t); if ((((GeometryArray)shape.getGeometry()).getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) == 0) { TexCoordGeneration tcg = new TexCoordGeneration();
Geometry geo = ((Shape3D)pickNode).getGeometry(j);