#include <BodyBuilder.h>
Public Member Functions | |
| BodyBuilder (bool debug=false) | |
| BodyBuilder (Body2D< Element2D > *body, bool beziersAllowed=false, bool debug=false) | |
| ~BodyBuilder () | |
| void | resetFocus (Body2D< Element2D > *body, bool beziersAllowed=false) |
| void | addVector (Vector2D *vector2d) |
| void | addVectorAbs (double x, double y) |
| void | addVectorRel (double x, double y) |
| void | addVectorAbsHor (double x) |
| void | addVectorRelHor (double x) |
| void | addVectorAbsVer (double y) |
| void | addVectorRelVer (double y) |
| void | close () |
| void | addBezier (Bezier2D *bezier2d) |
| void | addBezierAbs (double p1X, double p1Y, double p2X, double p2Y, double p3X, double p3Y) |
| void | addBezierRel (double p1X, double p1Y, double p2X, double p2Y, double p3X, double p3Y) |
| void | addBezierAbsSmooth (double p2X, double p2Y, double p3X, double p3Y) |
| void | addBezierRelSmooth (double p2X, double p2Y, double p3X, double p3Y) |
| void | printElements () |
Used to build Body2D objects made out of Vector2D or Bezier2D elements. Consists mainly of handy methods to add Beziers and Vectors using relative coordinates. Compare to drawing a path in a program like Adobe Illustrator. There is a specific method for every operation needed to create a path using the commands defined within the 'd' attribute in the SVG standard concerning path elements.
filename: BodyBuilder.h
| sonus::BodyBuilder::BodyBuilder | ( | bool | debug = false |
) |
Constructor.
| debug | If set to true, there will be various outputs to the Visual Studio console for debugging purposes - is set to
|
| sonus::BodyBuilder::BodyBuilder | ( | Body2D< Element2D > * | body, | |
| bool | beziersAllowed = false, |
|||
| bool | debug = false | |||
| ) |
Constructor.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| body | The body on which the BodyBuilder will focus when creating Bezier2D or Vector2D objects - they will be added to this Body2D. | |
| beziersAllowed | Defines if Bezier2D objects are allowed in this Body2D object, meaning that if you have a Body2D typed only to Vector2D objects, you should set 'beziersAllowed' to 'false'. | |
| debug | If set to true, there will be various outputs to the Visual Studio console for debugging purposes - is set to
|
| sonus::BodyBuilder::~BodyBuilder | ( | ) |
Destructor.
This function resets the focus of the BodyBuilder to another Body2D object.
| void sonus::BodyBuilder::addVector | ( | Vector2D * | vector2d | ) |
| void sonus::BodyBuilder::addVectorAbs | ( | double | x, | |
| double | y | |||
| ) |
| void sonus::BodyBuilder::addVectorRel | ( | double | x, | |
| double | y | |||
| ) |
| void sonus::BodyBuilder::addVectorAbsHor | ( | double | x | ) |
Adds a Vector2D object to the Body2D in focus. The given coordinate is absolute, meaning world or global coordinates. The other coordinate is automatically equal to the last added point, creating a horizontal line from the last point to the new X coordinate.
| x | X coordinate of the Vector2D that is to be added. |
| void sonus::BodyBuilder::addVectorRelHor | ( | double | x | ) |
Adds a Vector2D object to the Body2D in focus. The given coordinate is relative, meaning a local coordinate relative to the last added point. The other coordinate is automatically equal to the last added point, creating a horizontal line from the last point to the new X coordinate.
| x | X coordinate of the Vector2D that is to be added. |
| void sonus::BodyBuilder::addVectorAbsVer | ( | double | y | ) |
Adds a Vector2D object to the Body2D in focus. The given coordinate is absolute, meaning world or global coordinates. The other coordinate is automatically equal to the last added point, creating a vertical line from the last point to the new Y coordinate.
| y | Y coordinate of the Vector2D that is to be added. |
| void sonus::BodyBuilder::addVectorRelVer | ( | double | y | ) |
Adds a Vector2D object to the Body2D in focus. The given coordinate is relative, meaning a local coordinate relative to the last added point. The other coordinate is automatically equal to the last added point, creating a vertical line from the last point to the new Y coordinate.
| y | Y coordinate of the Vector2D that is to be added. |
| void sonus::BodyBuilder::close | ( | ) |
Closes the path that is being drawn; equivalent to the 'z' command in the SVG standard.
| void sonus::BodyBuilder::addBezier | ( | Bezier2D * | bezier2d | ) |
| void sonus::BodyBuilder::addBezierAbs | ( | double | p1X, | |
| double | p1Y, | |||
| double | p2X, | |||
| double | p2Y, | |||
| double | p3X, | |||
| double | p3Y | |||
| ) |
Adds a Bezier2D object to the Body2D in focus. The given coordinates are absolute, meaning world or global coordinates. The first point (p0) is drawn where the last point in the Body2D in focus has been added.
| p1X | X coordinate of the first control point of the type Vector2D that is to be added. | |
| p1Y | Y coordinate of the first control point of the type Vector2D that is to be added. | |
| p2X | X coordinate of the second control point of the type Vector2D that is to be added. | |
| p2Y | Y coordinate of the second control point of the type Vector2D that is to be added. | |
| p3X | X coordinate of the second point of the type Vector2D that is to be added. | |
| p3Y | Y coordinate of the second point of the type Vector2D that is to be added. |
| void sonus::BodyBuilder::addBezierRel | ( | double | p1X, | |
| double | p1Y, | |||
| double | p2X, | |||
| double | p2Y, | |||
| double | p3X, | |||
| double | p3Y | |||
| ) |
Adds a Bezier2D object to the Body2D in focus. The given coordinates are relative, meaning a local coordinate relative to the last added point. The first point (p0) is drawn where the last point in the Body2D in focus has been added.
| p1X | X coordinate of the first control point of the type Vector2D that is to be added. | |
| p1Y | Y coordinate of the first control point of the type Vector2D that is to be added. | |
| p2X | X coordinate of the second control point of the type Vector2D that is to be added. | |
| p2Y | Y coordinate of the second control point of the type Vector2D that is to be added. | |
| p3X | X coordinate of the second point of the type Vector2D that is to be added. | |
| p3Y | Y coordinate of the second point of the type Vector2D that is to be added. |
| void sonus::BodyBuilder::addBezierAbsSmooth | ( | double | p2X, | |
| double | p2Y, | |||
| double | p3X, | |||
| double | p3Y | |||
| ) |
Adds a Bezier2D object to the Body2D in focus. The given coordinates are absolute, meaning world or global coordinates. The first point (p0) is drawn where the last point in the Body2D in focus has been added. The first control point (p1) is calculated by mirroring the second control point of the previous Bezier2D along p0.
| p2X | X coordinate of the second control point of the type Vector2D that is to be added. | |
| p2Y | Y coordinate of the second control point of the type Vector2D that is to be added. | |
| p3X | X coordinate of the second point of the type Vector2D that is to be added. | |
| p3Y | Y coordinate of the second point of the type Vector2D that is to be added. |
| void sonus::BodyBuilder::addBezierRelSmooth | ( | double | p2X, | |
| double | p2Y, | |||
| double | p3X, | |||
| double | p3Y | |||
| ) |
Adds a Bezier2D object to the Body2D in focus. The given coordinates are relative, meaning a local coordinate relative to the last added point. The first point (p0) is drawn where the last point in the Body2D in focus has been added. The first control point (p1) is calculated by mirroring the second control point of the previous Bezier2D along p0.
| p2X | X coordinate of the second control point of the type Vector2D that is to be added. | |
| p2Y | Y coordinate of the second control point of the type Vector2D that is to be added. | |
| p3X | X coordinate of the second point of the type Vector2D that is to be added. | |
| p3Y | Y coordinate of the second point of the type Vector2D that is to be added. |
| void sonus::BodyBuilder::printElements | ( | ) |
Print all elements of the Body2D. This function uses the Visual Studio method called
1.5.4