public abstract class Shape3D
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Shape3D
contains attributes which include its name (a String),
separate transformations for translation, rotation, and scaling (all Matrix3D's).
Material, Texture, and shaderID removed 7/20/15 by Scott Gordon.
OpenGL-specific drawing methods and enums removed 7/20/15 by Scott Gordon.Constructor and Description |
---|
Shape3D()
Creates and initializes this Shape3D object.
|
Shape3D(java.lang.String name)
Creates and initializes this Shape3D object.
|
Shape3D(java.lang.String name,
Matrix3D translation,
Matrix3D rotation,
Matrix3D scale)
Creates a Shape as specified by the given attributes.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone (copy) of this shape.
|
java.lang.String |
getName()
Returns a String containing the name of this Shape3D object.
|
Matrix3D |
getRotation()
Get the rotation
Matrix3D associated with this object. |
Matrix3D |
getScale()
Get the scaling
Matrix3D associated with this object. |
Matrix3D |
getTransform()
Returns a single
Matrix3D which contains the concatenation of the current
translation, rotation, and scaling transforms of this Shape3D , with
the concatenation done in that order (translation, then rotation, then scaling). |
Matrix3D |
getTranslation()
Get the translation
Matrix3D associated with this object. |
void |
rotate(double xAngle,
double yAngle,
double zAngle)
Concatenates onto this shape's rotation transformation matrix a rotation about the
X, Y, and Z axes by the specified angles, which are assumed
to be in degrees.
|
void |
rotate(double angle,
Vector3D axis)
Concatenates onto this shape's rotation transformation matrix a
rotation of
angle
degrees about the specified axis . |
void |
scale(double sx,
double sy,
double sz)
Concatenates a scaling by amounts sx, sy, and sz in the X, Y, and Z directions
respectively onto the scaling transformation matrix for this shape.
|
void |
setName(java.lang.String name)
Sets the specified string as the name of this Shape3D object.
|
void |
setRotation(Matrix3D mat)
Set the rotation matrix for this Shape3D.
|
void |
setScale(Matrix3D mat)
Set the scaling matrix for this Shape3D.
|
void |
setTranslation(Matrix3D mat)
Set the translation matrix for this Shape3D.
|
void |
translate(double tx,
double ty,
double tz)
Concatenates a translation of amounts tx, ty, and tz in the X, Y, and Z directions
respectively onto the translation matrix for this shape.
|
public Shape3D()
Note that this constructor cannot be invoked directly since the class is abstract; it can only be invoked from a subclass.
public Shape3D(java.lang.String name)
Note that this constructor cannot be invoked directly since the class is abstract; it can only be invoked from a subclass.
name
- A String giving the name to be assigned to the shape.public java.lang.String getName()
public Matrix3D getTranslation()
Matrix3D
associated with this object.public Matrix3D getRotation()
Matrix3D
associated with this object.public Matrix3D getScale()
Matrix3D
associated with this object.public Matrix3D getTransform()
Matrix3D
which contains the concatenation of the current
translation, rotation, and scaling transforms of this Shape3D
, with
the concatenation done in that order (translation, then rotation, then scaling).
Calling this method is equivalent to calling getTranslation()
,
getRotation()
, and getScale()
and then concatenating the returned Matrix3D
s
together. Note that the effect of the concatenation order is such that if the
returned Matrix3D
is used as a composite transform, the order of application
of the transforms of this Shape3D
will be scaling first, then
rotation, then translation last.public void setName(java.lang.String name)
name
- A String giving the name to be assigned to the shape.public void setTranslation(Matrix3D mat)
Matrix3D
.mat
- A Matrix3D
specifying the values to which this shape's translation
should be set.public void setRotation(Matrix3D mat)
Matrix3D
.mat
- A Matrix3D
specifying the values to which this shape's rotation
should be set.public void setScale(Matrix3D mat)
Matrix3D
.mat
- A Matrix3D
specifying the values to which this shape's scale
should be set.public void translate(double tx, double ty, double tz)
getTranslation().translate(tx,ty,tz)
.tx
- The translation amount in the X directionty
- The translation amount in the Y directiontz
- The translation amount in the Z directionpublic void scale(double sx, double sy, double sz)
getScale().scale(sx,sy,sz)
.sx
- The scale amount in the X directionsy
- The scale amount in the Y directionsz
- The scale amount in the Z directionpublic void rotate(double xAngle, double yAngle, double zAngle)
getRotation().rotate(xAngle, yAngle, zAngle)
;
that is,
the specified rotations are put into the matrix such that
they are effectively performed in the order Y, then
X, then Z.xAngle
- The angle of rotation, in degrees, about the X axisyAngle
- The angle of rotation, in degrees, about the Y axiszAngle
- The angle of rotation, in degrees, about the Z axispublic void rotate(double angle, Vector3D axis)
angle
degrees about the specified axis
.
Calling this method is equivalent to
calling getRotation().rotate(angle,axis)
.angle
- The angle of rotation in degrees.axis
- The axis about which the rotation occurs.public java.lang.Object clone()
clone
in class java.lang.Object