Tabnine Logo
Shape3D
Code IndexAdd Tabnine to your IDE (free)

How to use
Shape3D
in
org.scijava.java3d

Best Java code snippets using org.scijava.java3d.Shape3D (Showing top 20 results out of 315)

origin: sc.fiji/3D_Viewer

  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;
  }
}
origin: stackoverflow.com

lsa.setNormals(0, normals);
lsa.setCoordinates(0, pts);
Shape3D sh=new Shape3D();
PolygonAttributes pa=new PolygonAttributes();
pa.setPolygonMode(PolygonAttributes.POLYGON_FILL);
app.setMaterial(mat);
app.setPolygonAttributes(pa);
sh.setGeometry(lsa);
sh.setAppearance(app);
sh.setPickable(true); 
TransformGroup objRotate = new TransformGroup();
objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
origin: org.scijava/j3dcore

/**
 * Checks whether the geometry in this shape node intersects with
 * the specified pickShape.
 *
 * @param path the SceneGraphPath to this shape node
 * @param pickShape the PickShape to be intersected
 *
 * @return true if the pick shape intersects this node; false
 * otherwise.
 *
 * @exception IllegalArgumentException if pickShape is a PickPoint.
 * Java 3D doesn't have spatial information of the surface.
 * Use PickBounds with BoundingSphere and a small radius, instead.
 *
 * @exception CapabilityNotSetException if the Geometry.ALLOW_INTERSECT
 * capability bit is not set in all of the Geometry objects
 * referred to by this shape node.
 */
public boolean intersect(SceneGraphPath path, PickShape pickShape) {
return intersect(path, pickShape, null);
}
origin: org.scijava/j3dcore

/**
 * Used to create a new instance of the node.  This routine is called
 * by <code>cloneTree</code> to duplicate the current node.
 * <code>cloneNode</code> should be overridden by any user subclassed
 * objects.  All subclasses must have their <code>cloneNode</code>
 * method consist of the following lines:
 * <P><blockquote><pre>
 *     public Node cloneNode(boolean forceDuplicate) {
 *         UserSubClass usc = new UserSubClass();
 *         usc.duplicateNode(this, forceDuplicate);
 *         return usc;
 *     }
 * </pre></blockquote>
 * @param forceDuplicate when set to <code>true</code>, causes the
 *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
 *  <code>false</code>, the value of each node's
 *  <code>duplicateOnCloneTree</code> variable determines whether
 *  NodeComponent data is duplicated or copied.
 *
 * @see Node#cloneTree
 * @see Node#duplicateNode
 * @see NodeComponent#setDuplicateOnCloneTree
 */
@Override
public Node cloneNode(boolean forceDuplicate) {
  Shape3D s = new Shape3D();
  s.duplicateNode(this, forceDuplicate);
  return s;
}
origin: sc.fiji/3D_Viewer

final Appearance a = appCreator.getAppearance(axis, index);
final Shape3D frontShape = new Shape3D(quadArray, a);
frontShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
frontShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
front.addChild(frontShapeGroup);
final Shape3D backShape = new Shape3D(quadArray, a);
backShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
backShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
origin: org.scijava/j3dutils

@Override
protected org.scijava.java3d.SceneGraphObject createNode() {
  return new Shape3D();
}
origin: sc.fiji/Volume_Calculator

/**
 * 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);
  }
}
origin: sc.fiji/3D_Viewer

p[7] = new Point3f(min.x, max.y, min.z);
final Shape3D shape = new Shape3D();
shape.setName("BB");
final float fz = tickDistance - (this.min.z % tickDistance);
shape.addGeometry(makeLine(p[0], p[1], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[1], p[2], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[2], p[3], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[3], p[0], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[4], p[5], c, td, fx, ts, false));
shape.addGeometry(makeLine(p[5], p[6], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[6], p[7], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[4], p[7], c, td, fy, ts, false));
shape.addGeometry(makeLine(p[4], p[0], c, td, fz, ts, false));
shape.addGeometry(makeLine(p[1], p[5], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[2], p[6], c, td, 0f, ts, true));
shape.addGeometry(makeLine(p[3], p[7], c, td, 0f, ts, true));
shape.setAppearance(createAppearance(color));
addChild(shape);
origin: org.scijava/j3dutils

/** Gets the appearance of the primitive (defaults to first subpart).
 */
public Appearance getAppearance(){
 return getShape(0).getAppearance();
}
origin: org.scijava/j3dutils

Shape3D shape = new Shape3D();
shape.setGeometry(gi.getGeometryArray(false, false, false));
origin: org.scijava/j3dutils

shape[BODY] = new Shape3D(cache.getComputedGeometry());
numVerts += cache.getNumVerts();
numTris += cache.getNumTris();
     xdivisions, 1.0-1.0/(double)ydivisions,
     outside, texCoordYUp);
 shape[BODY] = new Shape3D(gbuf.getGeom(flags));
 numVerts += gbuf.getNumVerts();
 numTris += gbuf.getNumTris();
  shape[BODY].addGeometry(cache.getComputedGeometry());
  numVerts += cache.getNumVerts();
  numTris += cache.getNumTris();
       xdivisions, ydivisions-1, 1.0/(double)ydivisions,
       outside, texCoordYUp);
  shape[BODY].addGeometry(gbuf.getGeom(flags));
  numVerts += gbuf.getNumVerts();
  numTris += gbuf.getNumTris();
(shape[BODY]).setCapability(Shape3D.ALLOW_APPEARANCE_READ);
(shape[BODY]).setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
  (shape[BODY]).setCapability(Shape3D.ALLOW_GEOMETRY_READ);
shape[CAP] = new Shape3D(cache.getComputedGeometry());
numVerts += cache.getNumVerts();
numTris += cache.getNumTris();
origin: org.scijava/j3dutils

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) );
  }
}
origin: sc.fiji/3D_Viewer

public Scalebar(final float length) {
  final Transform3D position = new Transform3D();
  positionTG = new TransformGroup(position);
  positionTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
  positionTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  addChild(positionTG);
  lineShape = new Shape3D();
  lineShape.setGeometry(createLineGeometry());
  lineShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
  positionTG.addChild(lineShape);
  final Transform3D texttranslate = new Transform3D();
  texttranslate.setTranslation(new Vector3f(length / 2, -length / 2, 0.0f));
  textTG = new TransformGroup(texttranslate);
  textTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
  positionTG.addChild(textTG);
  textShape = new OrientedShape3D();
  textShape.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
  textShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
  textShape.setGeometry(createTextGeometry());
  textShape.setAppearance(createTextAppearance());
  textShape.setAlignmentAxis(0.0f, 1.0f, 0.0f);
  textTG.addChild(textShape);
}
origin: org.scijava/j3dcore

/**
 * 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());
}
origin: stackoverflow.com

Shape3D plShape = new Shape3D();
int vIndex=-1;
int k=0;
    lsa.setColor(vIndex, new Color3f(0.9f,0.0f,0.0f));
  plShape.addGeometry(lsa);
origin: sc.fiji/Volume_Calculator

Shape3D edgeShape = new Shape3D(la, appearance);
edgeShape.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
edgeShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
edgeShape.setUserData(ud);
origin: org.scijava/j3dutils

shape.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
throw new IllegalArgumentException("Improper level");
for (int i = 0; i < shape.numGeometries(); i++) {
Geometry geo = shape.getGeometry(i);
if (geo instanceof GeometryArray) {
  setCapabilities((GeometryArray)geo, level);
origin: sc.fiji/Volume_Calculator

if (node instanceof Shape3D) {
  Shape3D shape = (Shape3D) node;
  if (shape.getGeometry() instanceof LineArray) {
    Appearance appearance = shape.getAppearance();
    ColoringAttributes ca = appearance.getColoringAttributes();
    ca.getColor(currentColor);
    LineArray segments = (LineArray) shape.getGeometry();
    int nSegs = segments.getVertexCount();
    for (int i = 0; i < nSegs; i++) {
      UserData ud = (UserData) (shape.getUserData());
      ud.setColorIndex(99);
origin: org.scijava/j3dutils

@Override
public void buildGraph() {
  ((Shape3D)node).setAppearance( (Appearance)control.getSymbolTable().getJ3dNode( appearance ) );
  ((Shape3D)node).setGeometry( (Geometry)control.getSymbolTable().getJ3dNode( geometry[0] ) );
  for(int i=1; i<geometry.length; i++) {
    ((Shape3D)node).addGeometry( (Geometry)control.getSymbolTable().getJ3dNode( geometry[i] ) );
  }
  super.buildGraph(); // Must be last call in method
}
origin: stackoverflow.com

 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);
org.scijava.java3dShape3D

Javadoc

The Shape3D leaf node specifies all geometric objects. It contains a list of one or more Geometry component objects and a single Appearance component object. The geometry objects define the shape node's geometric data. The appearance object specifies that object's appearance attributes, including color, material, texture, and so on.

The list of geometry objects must all be of the same equivalence class, that is, the same basic type of primitive. For subclasses of GeometryArray, all point objects are equivalent, all line objects are equivalent, and all polygon objects are equivalent. For other subclasses of Geometry, only objects of the same subclass are equivalent. The equivalence classes are as follows:

  • GeometryArray (point): [Indexed]PointArray
  • GeometryArray (line): [Indexed]{LineArray, LineStripArray}
  • GeometryArray (polygon): [Indexed]{TriangleArray, TriangleStripArray, TriangleFanArray, QuadArray}
  • CompressedGeometry
  • Raster
  • Text3D

When Shape3D is used with multiple geometry components, Java 3D may choose to use individual geometry bounds instead of the shape's bounds for region of influence operations, such as lighting. For example, the individual characters of a Text3D shape object may be rendered with a different light set.

Most used methods

  • <init>
    Constructs and initializes a Shape3D node with the specified geometry and appearance components. The
  • getGeometry
    Retrieves the geometry component at the specified index from this Shape3D node's list of geometry co
  • getAppearance
    Retrieves the appearance component of this shape node.
  • addGeometry
    Appends the specified geometry component to this Shape3D node's list of geometry components. If ther
  • setAppearance
    Sets the appearance component of this Shape3D node. Setting it to null specifies that default values
  • setCapability
  • setGeometry
    Replaces the geometry component at the specified index in this Shape3D node's list of geometry compo
  • intersect
    Checks whether the geometry in this shape node intersects with the specified pickShape.
  • numGeometries
    Returns the number of geometry components in this Shape3D node's list of geometry components.
  • checkDuplicateNode
  • checkForCycle
  • cloneTree
  • checkForCycle,
  • cloneTree,
  • duplicateAttributes,
  • duplicateNode,
  • getCapability,
  • getCollisionBounds,
  • getNodeComponent,
  • getUserData,
  • isLive,
  • isLiveOrCompiled

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • JFileChooser (javax.swing)
  • JPanel (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now