sonus::BodyBuilder Class Reference

#include <BodyBuilder.h>

List of all members.

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 ()


Detailed Description

sonus::BodyBuilder

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

Date:
2007/12/28 12:43
Author:
Raphael Estrada
Version:
1.0

Constructor & Destructor Documentation

sonus::BodyBuilder::BodyBuilder ( bool  debug = false  ) 

Constructor.

Parameters:
debug If set to true, there will be various outputs to the Visual Studio console for debugging purposes - is set to
  • false be default.

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.

Parameters:
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
  • false be default.

sonus::BodyBuilder::~BodyBuilder (  ) 

Destructor.


Member Function Documentation

void sonus::BodyBuilder::resetFocus ( Body2D< Element2D > *  body,
bool  beziersAllowed = false 
)

This function resets the focus of the BodyBuilder to another Body2D object.

Parameters:
body The Body2D object on which the BodyBuilder will focus on.
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.

void sonus::BodyBuilder::addVector ( Vector2D vector2d  ) 

Adds a Vector2D object to the Body2D in focus.

Parameters:
vector2d Pointer to the Vector2D object to be added.

void sonus::BodyBuilder::addVectorAbs ( double  x,
double  y 
)

Adds a Vector2D object to the Body2D in focus. The given coordinates are absolute, meaning world or global coordinates.

Parameters:
x X coordinate of the Vector2D that is to be added.
y Y coordinate of the Vector2D that is to be added.
Note:
Corresponding SVG notation:

void sonus::BodyBuilder::addVectorRel ( double  x,
double  y 
)

Adds a Vector2D object to the Body2D in focus. The given coordinates are relative, meaning local coordinates relative to the last added point.

Parameters:
x X coordinate of the Vector2D that is to be added.
y Y coordinate of the Vector2D that is to be added.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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  ) 

Adds a Bezier2D object to the Body2D in focus.

Parameters:
bezier2d Pointer to the Bezier2D object to be added.

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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


The documentation for this class was generated from the following file:
Generated on Tue Aug 26 12:26:54 2008 for sonus by  doxygen 1.5.4