Shapes 3D
3.0
|
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< Shape3D > | children = new LinkedList<Shape3D>() |
PGraphics | on_canvas |
Simple class to allow a collection of shapes to be moved and rotated as a group.
ShapeGroup shapes3d.ShapeGroup.addChild | ( | Shape3D... | sub_shapes | ) |
Add one or more shapes to the group
sub_shapes | the shapes to add, null values are not added |
Shape3D shapes3d.ShapeGroup.child | ( | int | n | ) |
Get the shape at the given position. If the position is invalid, null is returned.
n | the position of the shape to return |
Shape3D [] shapes3d.ShapeGroup.children | ( | ) |
Gets the shapes making up the group
float [] shapes3d.ShapeGroup.getRotArray | ( | ) |
float [] shapes3d.ShapeGroup.getRotArray | ( | float[] | target | ) |
If target is not null it is used to store the current position.
target |
PVector shapes3d.ShapeGroup.getRotVec | ( | ) |
Get the current rotations as a PVector
PVector shapes3d.ShapeGroup.getRotVec | ( | PVector | target | ) |
target | the PVector to fill, if null create a new PVector |
ShapeGroup shapes3d.ShapeGroup.moveTo | ( | PVector | pos | ) |
Sets the shape's current position.
pos | the new position |
ShapeGroup shapes3d.ShapeGroup.moveTo | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the shape's current position.
x | x coordinate |
y | y coordinate |
z | z coordinate |
ShapeGroup shapes3d.ShapeGroup.moveTo | ( | float[] | xyz | ) |
Sets the shape's current position.
Position is unchanged if the parameter array has less than 3 elements.
xyz | the coordinates in an array |
ShapeGroup shapes3d.ShapeGroup.rotateBy | ( | float | x, |
float | y, | ||
float | z | ||
) |
Rotate shape from its current rotation state by the specified angles (radians)
x | add this angle to the current x rotation angle |
y | add this angle to the current y rotation angle |
z | add this angle to the current z rotation angle |
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.
angle | an array of relative angles |
ShapeGroup shapes3d.ShapeGroup.rotateBy | ( | PVector | angles | ) |
Rotate shape from its current rotation state by the specified angles (radians) in the PVector.
angles | a PVector containing the XYZ relative angles |
ShapeGroup shapes3d.ShapeGroup.rotateByX | ( | float | x | ) |
Change the rotation about the x axis by the specified amount.
x | the angle in radians |
ShapeGroup shapes3d.ShapeGroup.rotateByY | ( | float | y | ) |
Change the rotation about the y axis by the specified amount.
y | the angle in radians |
ShapeGroup shapes3d.ShapeGroup.rotateByZ | ( | float | z | ) |
Change the rotation about the z axis by the specified amount.
z | the angle in radians |
ShapeGroup shapes3d.ShapeGroup.rotateTo | ( | PVector | angles | ) |
Set the current rotations.
angles | a PVector containing the x/y/z rotations in radians. |
ShapeGroup shapes3d.ShapeGroup.rotateTo | ( | float[] | angles | ) |
Set the current rotations. Ignored if the array has less than 3 elements.
angles | an array containing the x/y/z rotations in radians. |
ShapeGroup shapes3d.ShapeGroup.rotateTo | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the current rotations.
x | rotation about x axis |
y | rotation about y axis |
z | rotation about z axis |
ShapeGroup shapes3d.ShapeGroup.rotateToX | ( | float | x | ) |
Set the rotation about the x axis
x | the angle in radians |
ShapeGroup shapes3d.ShapeGroup.rotateToY | ( | float | y | ) |
Set the rotation about the y axis
y | the angle in radians |
ShapeGroup shapes3d.ShapeGroup.rotateToZ | ( | float | z | ) |
Set the rotation about the z axis
z | the angle in radians |
ShapeGroup shapes3d.ShapeGroup.visible | ( | boolean | visible | ) |
Makes this shape group visible or invisible.
visible | true if you want to see this shape |