public class OrientedShape3D extends Shape3D
OrientedShape3D is similar in functionality to the Billboard behavior, but OrientedShape3D nodes will orient themselves correctly for each view, and they can be used within a SharedGroup.
If the alignment mode is ROTATE_ABOUT_AXIS, then the rotation will be around the specified axis. If the alignment mode is ROTATE_ABOUT_POINT, then the rotation will be about the specified point, with an additional rotation to align the +y axis of the TransformGroup with the +y axis in the View.
If the constant scale enable flag is set, the object will be drawn the same size in absolute screen coordinates (meters), regardless of the following: any transforms above this OrientedShape3D node in the scene graph, the view scale, the window scale, or the effects of perspective correction. This is done by scaling the geometry about the local origin of this node, such that 1 unit in local coordinates is equal to the number of meters specified by this node's scale value. If the constant scale enable flag is set to false, then the scale is not used. The default scale is 1.0 meters.
OrientedShape3D nodes are ideal for drawing screen-aligned text or for drawing roughly-symmetrical objects. A typical use might consist of a quadrilateral that contains a texture of a tree.
Note that in a multiple View system, picking and interestion test is done with the primary View only.
Billboard
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_AXIS_READ
Specifies that this OrientedShape3D node
allows reading its alignment axis information.
|
static int |
ALLOW_AXIS_WRITE
Specifies that this OrientedShape3D node
allows writing its alignment axis information.
|
static int |
ALLOW_MODE_READ
Specifies that this OrientedShape3D node
allows reading its alignment mode information.
|
static int |
ALLOW_MODE_WRITE
Specifies that this OrientedShape3D node
allows writing its alignment mode information.
|
static int |
ALLOW_POINT_READ
Specifies that this OrientedShape3D node
allows reading its rotation point information.
|
static int |
ALLOW_POINT_WRITE
Specifies that this OrientedShape3D node
allows writing its rotation point information.
|
static int |
ALLOW_SCALE_READ
Specifies that this OrientedShape3D node
allows reading its scale and constant scale enable information.
|
static int |
ALLOW_SCALE_WRITE
Specifies that this OrientedShape3D node
allows writing its scale and constant scale enable information.
|
static int |
ROTATE_ABOUT_AXIS
Specifies that rotation should be about the specified axis.
|
static int |
ROTATE_ABOUT_POINT
Specifies that rotation should be about the specified point and
that the children's Y-axis should match the view object's Y-axis.
|
static int |
ROTATE_NONE
Specifies that no rotation is done.
|
ALLOW_APPEARANCE_OVERRIDE_READ, ALLOW_APPEARANCE_OVERRIDE_WRITE, ALLOW_APPEARANCE_READ, ALLOW_APPEARANCE_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE, ALLOW_GEOMETRY_READ, ALLOW_GEOMETRY_WRITE
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
Constructor and Description |
---|
OrientedShape3D()
Constructs an OrientedShape3D node with default parameters.
|
OrientedShape3D(Geometry geometry,
Appearance appearance,
int mode,
Point3f point)
Constructs an OrientedShape3D node with the specified geometry
component, appearance component, mode, and rotation point.
|
OrientedShape3D(Geometry geometry,
Appearance appearance,
int mode,
Point3f point,
boolean constantScaleEnable,
double scale)
Constructs an OrientedShape3D node with the specified geometry
component, appearance component, mode, and rotation point.
|
OrientedShape3D(Geometry geometry,
Appearance appearance,
int mode,
Vector3f axis)
Constructs an OrientedShape3D node with the specified geometry
component, appearance component, mode, and axis.
|
OrientedShape3D(Geometry geometry,
Appearance appearance,
int mode,
Vector3f axis,
boolean constantScaleEnable,
double scale)
Constructs an OrientedShape3D node with the specified geometry
component, appearance component, mode, axis, constant scale
enable flag, and scale
The specified axis must not be parallel to the Z
axis--(0,0,z) for any value of z.
|
Modifier and Type | Method and Description |
---|---|
Node |
cloneNode(boolean forceDuplicate)
Used to create a new instance of the node.
|
void |
duplicateNode(Node originalNode,
boolean forceDuplicate)
Copies all node information from
originalNode into
the current node. |
void |
getAlignmentAxis(Vector3f axis)
Retrieves the alignment axis of this OrientedShape3D node,
and copies it into the specified vector.
|
int |
getAlignmentMode()
Retrieves the alignment mode.
|
boolean |
getConstantScaleEnable()
Retrieves the constant scale enable flag.
|
void |
getRotationPoint(Point3f point)
Retrieves the rotation point of this OrientedShape3D node,
and copies it into the specified vector.
|
double |
getScale()
Retrieves the scale value for this OrientedShape3D.
|
void |
setAlignmentAxis(float x,
float y,
float z)
Sets the new alignment axis.
|
void |
setAlignmentAxis(Vector3f axis)
Sets the new alignment axis.
|
void |
setAlignmentMode(int mode)
Sets the alignment mode.
|
void |
setConstantScaleEnable(boolean constantScaleEnable)
Sets the constant scale enable flag.
|
void |
setRotationPoint(float x,
float y,
float z)
Sets the new rotation point.
|
void |
setRotationPoint(Point3f point)
Sets the new rotation point.
|
void |
setScale(double scale)
Sets the scale for this OrientedShape3D.
|
addGeometry, getAllGeometries, getAppearance, getAppearanceOverrideEnable, getBounds, getCollisionBounds, getGeometry, getGeometry, indexOfGeometry, insertGeometry, intersect, intersect, intersect, numGeometries, removeAllGeometries, removeGeometry, removeGeometry, setAppearance, setAppearanceOverrideEnable, setCollisionBounds, setGeometry, setGeometry
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
public static final int ROTATE_ABOUT_AXIS
setAlignmentMode(int)
,
Constant Field Valuespublic static final int ROTATE_ABOUT_POINT
setAlignmentMode(int)
,
Constant Field Valuespublic static final int ROTATE_NONE
setAlignmentMode(int)
,
Constant Field Valuespublic static final int ALLOW_MODE_READ
public static final int ALLOW_MODE_WRITE
public static final int ALLOW_AXIS_READ
public static final int ALLOW_AXIS_WRITE
public static final int ALLOW_POINT_READ
public static final int ALLOW_POINT_WRITE
public static final int ALLOW_SCALE_READ
public static final int ALLOW_SCALE_WRITE
public OrientedShape3D()
public OrientedShape3D(Geometry geometry, Appearance appearance, int mode, Vector3f axis)
geometry
- the geometry component with which to initialize
this shape nodeappearance
- the appearance component of the shape nodemode
- alignment mode, one of: ROTATE_ABOUT_AXIS,
ROTATE_ABOUT_POINT, or ROTATE_NONEaxis
- the ray about which the OrientedShape3D rotatespublic OrientedShape3D(Geometry geometry, Appearance appearance, int mode, Point3f point)
geometry
- the geometry component with which to initialize
this shape nodeappearance
- the appearance component of the shape nodemode
- alignment mode, one of: ROTATE_ABOUT_AXIS,
ROTATE_ABOUT_POINT, or ROTATE_NONEpoint
- the position about which the OrientedShape3D rotatespublic OrientedShape3D(Geometry geometry, Appearance appearance, int mode, Vector3f axis, boolean constantScaleEnable, double scale)
geometry
- the geometry component with which to initialize
this shape nodeappearance
- the appearance component of the shape nodemode
- alignment mode, one of: ROTATE_ABOUT_AXIS,
ROTATE_ABOUT_POINT, or ROTATE_NONEaxis
- the ray about which the OrientedShape3D rotatesconstantScaleEnable
- a flag indicating whether to enable
constant scalescale
- scale value used when constant scale is enabledpublic OrientedShape3D(Geometry geometry, Appearance appearance, int mode, Point3f point, boolean constantScaleEnable, double scale)
geometry
- the geometry component with which to initialize
this shape nodeappearance
- the appearance component of the shape nodemode
- alignment mode, one of: ROTATE_ABOUT_AXIS,
ROTATE_ABOUT_POINT, or ROTATE_NONEpoint
- the position about which the OrientedShape3D rotatesconstantScaleEnable
- a flag indicating whether to enable
constant scalescale
- scale value used when constant scale is enabledpublic void setAlignmentMode(int mode)
mode
- alignment mode, one of: ROTATE_ABOUT_AXIS,
ROTATE_ABOUT_POINT, or ROTATE_NONECapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic int getAlignmentMode()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setAlignmentAxis(Vector3f axis)
axis
- the new alignment axisCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setAlignmentAxis(float x, float y, float z)
x
- the x component of the alignment axisy
- the y component of the alignment axisz
- the z component of the alignment axisCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getAlignmentAxis(Vector3f axis)
axis
- the vector that will contain the alignment axisCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setRotationPoint(Point3f point)
point
- the new rotation pointCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setRotationPoint(float x, float y, float z)
x
- the x component of the rotation pointy
- the y component of the rotation pointz
- the z component of the rotation pointCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getRotationPoint(Point3f point)
point
- the point that will contain the rotation pointCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setConstantScaleEnable(boolean constantScaleEnable)
constantScaleEnable
- a flag indicating whether to enable
constant scaleCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic boolean getConstantScaleEnable()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setScale(double scale)
scale
- the scale valueCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic double getScale()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Node cloneNode(boolean forceDuplicate)
cloneTree
to duplicate the current node.
cloneNode
should be overridden by any user subclassed
objects. All subclasses must have their cloneNode
method consist of the following lines:
public Node cloneNode(boolean forceDuplicate) { UserSubClass usc = new UserSubClass(); usc.duplicateNode(this, forceDuplicate); return usc; }
cloneNode
in class Shape3D
forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.Node.cloneTree()
,
Node.duplicateNode(org.scijava.java3d.Node, boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
public void duplicateNode(Node originalNode, boolean forceDuplicate)
originalNode
into
the current node. This method is called from the
cloneNode
method which is, in turn, called by the
cloneTree
method.
For any NodeComponent
objects
contained by the object being duplicated, each NodeComponent
object's duplicateOnCloneTree
value is used to determine
whether the NodeComponent
should be duplicated in the new node
or if just a reference to the current node should be placed in the
new node. This flag can be overridden by setting the
forceDuplicate
parameter in the cloneTree
method to true
.
NOTE: Applications should not call this method directly.
It should only be called by the cloneNode method.
duplicateNode
in class Shape3D
originalNode
- the original node to duplicate.forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.ClassCastException
- if originalNode is not an instance of
Shape3D
Node.cloneTree()
,
Node.cloneNode(boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
Copyright © 2016–2022 SciJava. All rights reserved.