#include <shape.h>
Inherits sparkle::SceneObject.
Inherited by sparkle::Square.
Collaboration diagram for sparkle::Shape:

Public Member Functions | |
ctors/dtor | |
| Shape () | |
| ~Shape () | |
Modifiers | |
| virtual int | addNode (double x, double y) |
| virtual int | removeNode (Node *nodeToRemove) |
| virtual int | addEdge (int nodeIndex1, int nodeIndex2) |
| void | setName (std::string newName) |
| void | setGroup (Group *newGroup) |
| void | resetVolatileVars () |
| void | addForce (double xNodeForce, double yNodeForce, Node *childNode) |
| void | applyUniformForce (double xForce, double yForce) |
| void | updateStaticVars (double deltaTime) |
Getters | |
Not necessarily const | |
| Node * | nodeAt (int index) |
| virtual int | numOfNodes () const |
| virtual int | numOfEdges () const |
| double | getMass () const |
| double | getComX () const |
| double | getComY () const |
| VecXY | getCom () const |
| Vector< double > | getComVector () const |
| double | getMomentOfInertia () |
| std::string | name () const |
| Group * | group () const |
Protected Member Functions | |
| void | calculateCOM () |
| void | updateAttributes () |
Protected Attributes | |
| std::vector< Node > | nodes |
| std::vector< Edge > | edges |
| Group * | ownerGroup |
| std::string | shapeName |
| double | mass |
| double | momentOfInertia |
| sparkle::VecXY | linearVelocity |
| sparkle::VecXY | com |
| double | angularVelocity |
| double | angle |
| sparkle::VecXY | force |
| double | torque |
A basic convex polygon grouping of nodes with an associated mass
|
|
Creates a shape with no nodes |
|
|
Deconstructor |
|
||||||||||||
|
Add node to shape to x,y
Reimplemented in sparkle::Square. |
|
|
Remove node from shape
Reimplemented in sparkle::Square. |
|
||||||||||||
|
Create an edge between the nodes at the two indices
Reimplemented in sparkle::Square. |
|
|
Set the name of the shape
|
|
|
Set the group of the shape
|
|
|
Resets instantaneous variables which must be reset between ticks
|
|
||||||||||||||||
|
When a force is applid to a node, it will call this function to calculate the effect it will have on the shape
|
|
||||||||||||
|
Apply a force to whole shape so only linear momentum is changed
|
|
|
Once the forces have been applied to all the node, this will calculate what actually happens to the shape.
|
|
|
|
|
|
Reimplemented in sparkle::Square. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Will recalculate the moment of inertia before returning
|
|
|
|
|
|
Get the group of the shape. If it is not in a group, it will return
|
|
|
Calculate the CoM of the shape |
|
|
Recalculate the CoM and Moment of inertia of the shape |
|
|
The nodes owned by the shape |
|
|
The Edges connecting the nodes |
|
|
If this shape is in a group, it will be referenced here |
|
|
Name of shape |
|
|
Mass in kilogrammes of the shape |
|
|
Moment of inertia of the shape. Must be calculated through sparkle::momentOfInertia(...) |
|
|
Current linear velocity of shape |
|
|
Current CoM of shape |
|
|
Current angular velocity of shape |
|
|
Current angle of shape relative to starting position |
|
|
Tick-cumulative force |
|
|
Tick-cumulative torque |