Shapes 3D  3.0
 All Classes Functions Variables Pages
shapes3d.ShapeGroup Class Reference
Inheritance diagram for shapes3d.ShapeGroup:

Public Member Functions

ShapeGroup addChild (Shape3D...sub_shapes)
 
Shape3D[] children ()
 
Shape3D child (int n)
 
ShapeGroup visible (boolean visible)
 
ShapeGroup moveTo (PVector pos)
 
ShapeGroup moveTo (float x, float y, float z)
 
ShapeGroup moveTo (float[] xyz)
 
PVector getRotVec ()
 
PVector getRotVec (PVector target)
 
float[] getRotArray ()
 
float[] getRotArray (float[] target)
 
ShapeGroup rotateTo (PVector angles)
 
ShapeGroup rotateTo (float[] angles)
 
ShapeGroup rotateTo (float x, float y, float z)
 
ShapeGroup rotateToX (float x)
 
ShapeGroup rotateToY (float y)
 
ShapeGroup rotateToZ (float z)
 
ShapeGroup rotateBy (float x, float y, float z)
 
ShapeGroup rotateBy (float[] angle)
 
ShapeGroup rotateBy (PVector angles)
 
ShapeGroup rotateByX (float x)
 
ShapeGroup rotateByY (float y)
 
ShapeGroup rotateByZ (float z)
 
void draw (PGraphics pg)
 

Protected Attributes

PVector pos = new PVector(0,0,0)
 
PVector rot = new PVector(0,0,0)
 
LinkedList< Shape3Dchildren = new LinkedList<Shape3D>()
 
PGraphics on_canvas
 

Detailed Description

Simple class to allow a collection of shapes to be moved and rotated as a group.

Author
Peter Lager

Member Function Documentation

ShapeGroup shapes3d.ShapeGroup.addChild ( Shape3D...  sub_shapes)

Add one or more shapes to the group

Parameters
sub_shapesthe shapes to add, null values are not added
Returns
this shape group
Shape3D shapes3d.ShapeGroup.child ( int  n)

Get the shape at the given position. If the position is invalid, null is returned.

Parameters
nthe position of the shape to return
Returns
the shape or null if the position does not exist
Shape3D [] shapes3d.ShapeGroup.children ( )

Gets the shapes making up the group

Returns
an array of the shapes making up the group
float [] shapes3d.ShapeGroup.getRotArray ( )
Returns
the current rotations as an array.
float [] shapes3d.ShapeGroup.getRotArray ( float[]  target)

If target is not null it is used to store the current position.

Parameters
target
Returns
the current rotations as an array.
PVector shapes3d.ShapeGroup.getRotVec ( )

Get the current rotations as a PVector

PVector shapes3d.ShapeGroup.getRotVec ( PVector  target)
Parameters
targetthe PVector to fill, if null create a new PVector
Returns
the current rotations as a PVector
ShapeGroup shapes3d.ShapeGroup.moveTo ( PVector  pos)

Sets the shape's current position.

Parameters
posthe new position
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.moveTo ( float  x,
float  y,
float  z 
)

Sets the shape's current position.

Parameters
xx coordinate
yy coordinate
zz coordinate
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.moveTo ( float[]  xyz)

Sets the shape's current position.
Position is unchanged if the parameter array has less than 3 elements.

Parameters
xyzthe coordinates in an array
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateBy ( float  x,
float  y,
float  z 
)

Rotate shape from its current rotation state by the specified angles (radians)

Parameters
xadd this angle to the current x rotation angle
yadd this angle to the current y rotation angle
zadd this angle to the current z rotation angle
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateBy ( float[]  angle)

Rotate shape from its current rotation state by the specified angles (radians) in the array.
Ignored if the array has less than 3 elements.

Parameters
anglean array of relative angles
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateBy ( PVector  angles)

Rotate shape from its current rotation state by the specified angles (radians) in the PVector.

Parameters
anglesa PVector containing the XYZ relative angles
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateByX ( float  x)

Change the rotation about the x axis by the specified amount.

Parameters
xthe angle in radians
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateByY ( float  y)

Change the rotation about the y axis by the specified amount.

Parameters
ythe angle in radians
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateByZ ( float  z)

Change the rotation about the z axis by the specified amount.

Parameters
zthe angle in radians
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateTo ( PVector  angles)

Set the current rotations.

Parameters
anglesa PVector containing the x/y/z rotations in radians.
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateTo ( float[]  angles)

Set the current rotations. Ignored if the array has less than 3 elements.

Parameters
anglesan array containing the x/y/z rotations in radians.
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateTo ( float  x,
float  y,
float  z 
)

Set the current rotations.

Parameters
xrotation about x axis
yrotation about y axis
zrotation about z axis
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateToX ( float  x)

Set the rotation about the x axis

Parameters
xthe angle in radians
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateToY ( float  y)

Set the rotation about the y axis

Parameters
ythe angle in radians
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.rotateToZ ( float  z)

Set the rotation about the z axis

Parameters
zthe angle in radians
Returns
this shape
ShapeGroup shapes3d.ShapeGroup.visible ( boolean  visible)

Makes this shape group visible or invisible.

Parameters
visibletrue if you want to see this shape
Returns
this shape

The documentation for this class was generated from the following file: