camera3d
Class VcObject

java.lang.Object
  extended bycamera3d.VcObject
All Implemented Interfaces:
RotatableObject, ScalableObject, TranslatableObject
Direct Known Subclasses:
GeometryBag, VcContent, VcHelper, VcLight, VcView

public abstract class VcObject
extends java.lang.Object
implements RotatableObject, TranslatableObject, ScalableObject

Abstract superclass to all objects that can be added to the scene graph.

Author:
Fábio Roberto de Miranda, Carlos da Silva dos Santos

Field Summary
protected  TransformMode transformationMode
           
 
Constructor Summary
VcObject()
          Default Constructor.
 
Method Summary
 void addChangeListener(VcObjectChangeListener listener)
          Adds the specified VcObjectChangeListener to be notified of changes made to this object.
 void addNode(javax.media.j3d.Node n)
          Adds a node to pivot transform group.
 void addVcChild(VcObject vcObject)
          Adds a VcObject as a child to this one.
 void detach()
          Removes the BranchGroup from its parent in Java 3D tree.
 void getBoundingBox(javax.media.j3d.BoundingBox returnBB)
          Returns parameters of this object's BoundingBox, in local coordinates.
 void getBoundingBoxInVWorld(javax.media.j3d.BoundingBox returnBB)
          Returns parameters of this object's BoundingBox, in virtual world coordinates.
 javax.media.j3d.BranchGroup getBranchGroup()
          Returns root BranchGroup
 java.util.List getChildrenList()
          Returns a List containing all VcObjects kept as children of this object
abstract  javax.swing.Icon getIcon()
          Returns a small Icon associated with the type of this object.
 java.lang.String getInfo()
           
static int getInstanceCounter()
          Returns the number of objects instatiated so far.
 java.lang.String getLabel()
          Returns the label which identifies this object.
 void getLocalToVworld(javax.media.j3d.Transform3D t3D)
          Returns this objects Local to Vworld transform.
 void getParentRotScaleTG(javax.media.j3d.Transform3D t3D)
          Returns the transform 3D which keeps the rotation and scaling parts of this object's transform.
 void getParentTransTG(javax.media.j3d.Transform3D t3D)
          Returns the transform 3D which keeps the translation part of this object's transform.
 java.lang.String getTooltipText()
          Returns a string describing this object.
 void getTransforms(javax.media.j3d.Transform3D transforms)
          Returns all accumulated transforms but pivot transforms.
 void getTranslation(javax.vecmath.Point3d transP3d)
          Returns this object's translation into the Vector3d object passed as input.
 double getXAngleDeg()
          Returns the value (degrees) of X angle in absolute coordinate system.
 double getXAngleRad()
          Returns the value (radians) of X angle in absolute coordinate system.
 double getXScale()
          Returns the value of scale in X axis direction.
 double getXTranslation()
          Returns the value of translation in X axis direction.
 double getYAngleDeg()
          Returns the value (degrees) of Y angle in absolute coordinate system.
 double getYAngleRad()
          Returns the value (radians) of Y angle in absolute coordinate system.
 double getYScale()
          Returns the value of scale in Y axis direction.
 double getYTranslation()
          Returns the value translation in Y axis direction.
 double getZAngleDeg()
          Returns the value (degrees) of Z angle in absolute coordinate system.
 double getZAngleRad()
          Returns the value (radians) of Z angle in absolute coordinate system.
 double getZScale()
          Returns the value of scale in Z axis direction.
 double getZTranslation()
          Returns the value of translation in Z axis direction.
 void hideBoundingBox()
           
 boolean isInvalidData()
          Returns a flag indicating whether internal data representating state needs updating.
 boolean isLive()
          Returns a flag indicating whether the object is part of a live scene graph.
 boolean isSelected()
          Returns a flag indicating whether this object is selected or not
 void printTransform(javax.media.j3d.Transform3D t3d)
           
 void removeAllChangeListeners()
          Removes all objects currently registered as listeners of changes made to this object.
 void removeAllNodes()
          Removes all nodes currently under pivot transform group.
 void removeBoundingBox()
           
 void removeChangeListener(VcObjectChangeListener chg)
          Removes one object currently registered as a listener of changes made to this object.
 void removeNode(javax.media.j3d.Node n)
          Removes a node from pivot transform group.
 void removeVcChild(int n)
          Removes a VcObject from child transform group.
 void removeVcChild(VcObject vcObject)
          Removes a VcObject from child transform group.
 void rotateAbsolute(TransformScope axis, double deltaAngle)
          Performs incremental rotation around one of the absolute axis.
 void rotateEuler(double x_angle, double y_angle, double z_angle)
          Sets the value of the rotation around the absolute X,Y and Z axis.
 void rotateEulerLocal(double x_angle, double y_angle, double z_angle)
          Rotates objects relative to its local coordinate system.
 void rotateEulerLocalX(double x_angle)
          Rotates this object around local X axis.
 void rotateEulerLocalY(double y_angle)
          Rotates this object around local Y axis.
 void rotateEulerLocalZ(double z_angle)
          Rotates this object around local Z axis.
 void rotateEulerX(double x_angle)
          Sets the value of the rotation around the absolute X axis.
 void rotateEulerY(double y_angle)
          Sets the value of the rotation around the absolute Y axis.
 void rotateEulerZ(double z_angle)
          Sets the value of the rotation around the absolute Z axis.
 void rotateLocal(TransformScope axis, double deltaAngle)
          Rotates object relative to its local axis system.
 void scaleRelative(TransformScope scope, double scale)
          Scales object relative to its local axis system.
 void scaleX(double scale)
          Sets this objects's absolute scale along (local) X axis.
 void scaleXRelative(double scale)
           
 void scaleY(double scale)
          Sets this objects's absolute scale along (local) Y axis.
 void scaleYRelative(double scale)
           
 void scaleZ(double scale)
          Sets this objects's absolute scale along (local) Z axis.
 void scaleZRelative(double scale)
           
 void select()
          By calling this object this object shows himself "selected", what is indicated by some visual modifications.
 void setAbsoluteScale(double x, double y, double z)
          Sets absolute scale for this object.
 void setGlobalAxisVisible(boolean visible)
           
abstract  void setIcon(javax.swing.Icon icon)
          Sets the Icon associated with the type of this object.
 void setLabel(java.lang.String s)
          Sets the label which identifies this object.
 void setLocalAxisVisible(boolean visible)
           
 void setOngoingTransformation(boolean transforming)
          Sets flag used to indicate whether this object is undergoing a transformation or not.
 void setOngoingTransformationMode(TransformMode mode)
          Sets a specific kind of transformation, useful for the displaying of gizmos, etc.
 void setRelativeScale(double x, double y, double z)
           
 void setTooltipText(java.lang.String text)
          Sets a text string describing this object.
 void setTransform(javax.media.j3d.Transform3D transform)
          Sets this object transform.
protected  void setTransformsToIdentity()
           
 void showBoundingBox()
           
 void translate(double x, double y, double z)
           
 void translate(javax.vecmath.Vector3d delta)
          "Modern" translation method.
 void translateLocal(double x, double y, double z)
           
 boolean underOngoingTransformation()
          Returns flag that indicates whether this object is undergoing a transformation or not.
 void unselect()
           
 void updateData()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transformationMode

protected TransformMode transformationMode
Constructor Detail

VcObject

public VcObject()
Default Constructor.

Method Detail

rotateEulerLocalX

public void rotateEulerLocalX(double x_angle)
Rotates this object around local X axis.

Parameters:
x_angle - Rotation to be applied (in degreees).

rotateEulerLocalY

public void rotateEulerLocalY(double y_angle)
Rotates this object around local Y axis.

Parameters:
y_angle - Rotation to be applied (in degreees).

rotateEulerLocalZ

public void rotateEulerLocalZ(double z_angle)
Rotates this object around local Z axis.

Parameters:
z_angle - Rotation to be applied (in degreees).

rotateEulerLocal

public void rotateEulerLocal(double x_angle,
                             double y_angle,
                             double z_angle)
Rotates objects relative to its local coordinate system. At the end of execution notifyChangeListeners() is called.

Parameters:
x_angle - angle of rotation to be applied (X axis) in radians.
y_angle - angle of rotation to be applied (Y axis) in radians.
z_angle - angle of rotation to be applied (Z axis) in radians.

rotateEulerX

public void rotateEulerX(double x_angle)
Sets the value of the rotation around the absolute X axis. Other angles remain unchanged. Field invalidData is set to false, as rotAngles is updated. Method notifyChangeListeners() is called at the end of execution.

Parameters:
x_angle - new value of X rotation (in degrees).

rotateEulerY

public void rotateEulerY(double y_angle)
Sets the value of the rotation around the absolute Y axis. Other angles remain unchanged. Field invalidData is set to false, as rotAngles is updated. Method notifyChangeListeners() is called at the end of execution.

Parameters:
y_angle - new value of Y rotation (in degrees).

rotateEulerZ

public void rotateEulerZ(double z_angle)
Sets the value of the rotation around the absolute Z axis. Other angles remain unchanged. Field invalidData is set to false, as rotAngles is updated. Method notifyChangeListeners() is called at the end of execution.

Parameters:
z_angle - new value of Z rotation (in degrees).

rotateEuler

public void rotateEuler(double x_angle,
                        double y_angle,
                        double z_angle)
Sets the value of the rotation around the absolute X,Y and Z axis. Field invalidData is set to false, as rotAngles is updated. Method notifyChangeListeners() is called at the end of execution.

Parameters:
x_angle - new value of X rotation (in degrees).
y_angle - new value of Y rotation (in degrees).
z_angle - new value of Z rotation (in degrees).

rotateLocal

public void rotateLocal(TransformScope axis,
                        double deltaAngle)
Description copied from interface: RotatableObject
Rotates object relative to its local axis system.

Specified by:
rotateLocal in interface RotatableObject
Parameters:
axis - axis affected by rotation.
deltaAngle -

rotateAbsolute

public void rotateAbsolute(TransformScope axis,
                           double deltaAngle)
Performs incremental rotation around one of the absolute axis. It is suitable to be called by manipulators, in order to perform absolute rotation.
Method from RotatableObject interface.

Specified by:
rotateAbsolute in interface RotatableObject
Parameters:
axis - the axis around which the rotation will be performed.
deltaAngle - of the increment (in radians).

addNode

public void addNode(javax.media.j3d.Node n)
Adds a node to pivot transform group. Method notifyChangeListeners() is called by the end of execution.

Parameters:
n - Node to be added.

removeNode

public void removeNode(javax.media.j3d.Node n)
Removes a node from pivot transform group. Method notifyChangeListeners() is called at the end of execution.

Parameters:
n - Node to be removed.

removeAllNodes

public void removeAllNodes()
Removes all nodes currently under pivot transform group. Method notifyChangeListeners() is called at the end of execution.


getBranchGroup

public javax.media.j3d.BranchGroup getBranchGroup()
Returns root BranchGroup

Returns:
root BG

getLabel

public java.lang.String getLabel()
Returns the label which identifies this object.

Returns:
String containing the label.

setLabel

public void setLabel(java.lang.String s)
Sets the label which identifies this object. Listeners are notified after the change.

Parameters:
s - String containing new label.

detach

public void detach()
Removes the BranchGroup from its parent in Java 3D tree.


getTranslation

public void getTranslation(javax.vecmath.Point3d transP3d)
Returns this object's translation into the Vector3d object passed as input.


getXAngleDeg

public double getXAngleDeg()
Returns the value (degrees) of X angle in absolute coordinate system.


getYAngleDeg

public double getYAngleDeg()
Returns the value (degrees) of Y angle in absolute coordinate system.


getZAngleDeg

public double getZAngleDeg()
Returns the value (degrees) of Z angle in absolute coordinate system.


getXAngleRad

public double getXAngleRad()
Returns the value (radians) of X angle in absolute coordinate system.


getYAngleRad

public double getYAngleRad()
Returns the value (radians) of Y angle in absolute coordinate system.


getZAngleRad

public double getZAngleRad()
Returns the value (radians) of Z angle in absolute coordinate system.


getXTranslation

public double getXTranslation()
Returns the value of translation in X axis direction.


getYTranslation

public double getYTranslation()
Returns the value translation in Y axis direction.


getZTranslation

public double getZTranslation()
Returns the value of translation in Z axis direction.


getXScale

public double getXScale()
Returns the value of scale in X axis direction.


getYScale

public double getYScale()
Returns the value of scale in Y axis direction.

Returns:
Y scale

getZScale

public double getZScale()
Returns the value of scale in Z axis direction.

Returns:
Z scale

updateData

public void updateData()

translateLocal

public void translateLocal(double x,
                           double y,
                           double z)

translate

public void translate(double x,
                      double y,
                      double z)

scaleX

public void scaleX(double scale)
Sets this objects's absolute scale along (local) X axis. The notifyChangeListeners method is called at the end of execution.

Parameters:
scale - new absolute scale

scaleY

public void scaleY(double scale)
Sets this objects's absolute scale along (local) Y axis. The notifyChangeListeners method is called at the end of execution.

Parameters:
scale - new absolute scale

scaleZ

public void scaleZ(double scale)
Sets this objects's absolute scale along (local) Z axis. The notifyChangeListeners method is called at the end of execution.

Parameters:
scale - new absolute scale

scaleXRelative

public void scaleXRelative(double scale)

scaleYRelative

public void scaleYRelative(double scale)

scaleZRelative

public void scaleZRelative(double scale)

setRelativeScale

public void setRelativeScale(double x,
                             double y,
                             double z)

setAbsoluteScale

public void setAbsoluteScale(double x,
                             double y,
                             double z)
Sets absolute scale for this object. The notifyChangeListeners method is called at the end of execution.

Parameters:
x - scale value along local X axis.
y - scale value along local Y axis.
z - scale value along local Z axis.

removeAllChangeListeners

public void removeAllChangeListeners()
Removes all objects currently registered as listeners of changes made to this object.


removeChangeListener

public void removeChangeListener(VcObjectChangeListener chg)
Removes one object currently registered as a listener of changes made to this object.


addChangeListener

public void addChangeListener(VcObjectChangeListener listener)
Adds the specified VcObjectChangeListener to be notified of changes made to this object. The updateData method is called prior to the addition.

Parameters:
listener - Listener to be added

getBoundingBox

public void getBoundingBox(javax.media.j3d.BoundingBox returnBB)
Returns parameters of this object's BoundingBox, in local coordinates. The settings of current BoundingBox are copied into returnBB.


showBoundingBox

public void showBoundingBox()

hideBoundingBox

public void hideBoundingBox()

removeBoundingBox

public void removeBoundingBox()

isLive

public boolean isLive()
Returns a flag indicating whether the object is part of a live scene graph.

Specified by:
isLive in interface RotatableObject
Returns:
true if object is part of a live scene graph, else false

isInvalidData

public boolean isInvalidData()
Returns a flag indicating whether internal data representating state needs updating.


addVcChild

public void addVcChild(VcObject vcObject)
Adds a VcObject as a child to this one. Calling this method will have no effect if the object given as parameter is already a live. Method notifyChangeListeners() is called by the end of execution if the object could be added.

Parameters:
vcObject - object to be added

removeVcChild

public void removeVcChild(VcObject vcObject)
Removes a VcObject from child transform group. Method notifyChangeListeners() is called at the end of execution.

Parameters:
vcObject - object to be removed

removeVcChild

public void removeVcChild(int n)
Removes a VcObject from child transform group. Method notifyChangeListeners() is called at the end of execution.

Parameters:
n - index of object to be removed

getChildrenList

public java.util.List getChildrenList()
Returns a List containing all VcObjects kept as children of this object

Returns:
list of children

setTransform

public void setTransform(javax.media.j3d.Transform3D transform)
Sets this object transform. The Transform3D passed as input is separated into a translational component and a rotation-and-scaling component.


getBoundingBoxInVWorld

public void getBoundingBoxInVWorld(javax.media.j3d.BoundingBox returnBB)
Returns parameters of this object's BoundingBox, in virtual world coordinates. The settings of current BoundingBox are copied into returnBB.


setGlobalAxisVisible

public void setGlobalAxisVisible(boolean visible)

setLocalAxisVisible

public void setLocalAxisVisible(boolean visible)

printTransform

public void printTransform(javax.media.j3d.Transform3D t3d)

setTransformsToIdentity

protected void setTransformsToIdentity()

getInfo

public java.lang.String getInfo()

select

public void select()
By calling this object this object shows himself "selected", what is indicated by some visual modifications.


unselect

public void unselect()

getParentTransTG

public void getParentTransTG(javax.media.j3d.Transform3D t3D)
Returns the transform 3D which keeps the translation part of this object's transform.

Parameters:
t3D - Transform3D which will receive the parent translation transform.

getParentRotScaleTG

public void getParentRotScaleTG(javax.media.j3d.Transform3D t3D)
Returns the transform 3D which keeps the rotation and scaling parts of this object's transform.

Parameters:
t3D - Transform3D which will receive the parent rotation and scale transform.

getTransforms

public void getTransforms(javax.media.j3d.Transform3D transforms)
Returns all accumulated transforms but pivot transforms.


getLocalToVworld

public void getLocalToVworld(javax.media.j3d.Transform3D t3D)
Returns this objects Local to Vworld transform. Does not include pivot transform.

Specified by:
getLocalToVworld in interface RotatableObject
Parameters:
t3D - object into which will be copied the required transform.

setOngoingTransformation

public void setOngoingTransformation(boolean transforming)
Sets flag used to indicate whether this object is undergoing a transformation or not.


underOngoingTransformation

public boolean underOngoingTransformation()
Returns flag that indicates whether this object is undergoing a transformation or not.


setOngoingTransformationMode

public void setOngoingTransformationMode(TransformMode mode)
Sets a specific kind of transformation, useful for the displaying of gizmos, etc.


isSelected

public boolean isSelected()
Returns a flag indicating whether this object is selected or not

Returns:
true if object is selected, false otherwise

scaleRelative

public void scaleRelative(TransformScope scope,
                          double scale)
Description copied from interface: ScalableObject
Scales object relative to its local axis system.

Specified by:
scaleRelative in interface ScalableObject
Parameters:
scope - scope affected by rotation.
scale -

translate

public void translate(javax.vecmath.Vector3d delta)
"Modern" translation method. It is more convenient to call this from inside a translationManipulator

Specified by:
translate in interface TranslatableObject
Parameters:
delta - new location of object.

getIcon

public abstract javax.swing.Icon getIcon()
Returns a small Icon associated with the type of this object.


setIcon

public abstract void setIcon(javax.swing.Icon icon)
Sets the Icon associated with the type of this object.


getTooltipText

public java.lang.String getTooltipText()
Returns a string describing this object.

Returns:
the tool tip

getInstanceCounter

public static int getInstanceCounter()
Returns the number of objects instatiated so far.


setTooltipText

public void setTooltipText(java.lang.String text)
Sets a text string describing this object.

Parameters:
text - the tool tip


Copyright © 2001-2003 F.R. Miranda, C.S. Santos, J.E. Kogler Jr.. All Rights Reserved.