2D Geometric Shapes
fort::myrmidon::Shape
-
class Shape
Base class for geometric Shape.
Base class for geometruc Shape such as Circle, Capsule and Polygon. This class allows to construct heterogenous Shape::List for ZoneDefinition
Subclassed by fort::myrmidon::Capsule, fort::myrmidon::Circle, fort::myrmidon::Polygon
fort::myrmidon::Capsule
-
class Capsule : public fort::myrmidon::Shape
A capsule.
A Capsule is defined as two circle and the region in between those two circles.
Their main purpose is to define Ant virtual body parts.
Public Functions
-
Capsule(const Eigen::Vector2d &c1, const Eigen::Vector2d &c2, double r1, double r2)
Public constructor.
- Parameters:
c1 – the first center
c2 – the second center
r1 – the radius at c1
r2 – the radius at c2
-
void SetC1(const Eigen::Vector2d &c1)
Sets the first circle’s center.
- Parameters:
c1 – the center of the first circle
-
void SetC2(const Eigen::Vector2d &c2)
Sets the second circle’s center.
- Parameters:
c2 – the center of the second circle
-
inline const Eigen::Vector2d &C1() const
Gets the first circle’s center.
- Returns:
the center of the first circle
-
inline const Eigen::Vector2d &C2() const
Gets the second circle’s center.
- Returns:
the center of the second circle
-
void SetR1(double r1)
Sets the first circle’s radius.
- Parameters:
r1 – the radius of the first circle
-
void SetR2(double r2)
Sets the second circle’s radius.
- Parameters:
r2 – the radius of the first circle
-
inline double R1() const
Gets the first circle’s radius.
- Returns:
the radius of the first circle
-
inline double R2() const
Gets the second circle’s radius.
- Returns:
the radius of the second circle
-
Capsule(const Eigen::Vector2d &c1, const Eigen::Vector2d &c2, double r1, double r2)
fort::myrmidon::Circle
-
class Circle : public fort::myrmidon::Shape
Represent a 2D circle.
Public Functions
-
Circle(const Eigen::Vector2d ¢er, double radius)
public constructor
- Parameters:
center – the center of the circle
radius – the radius of the circle
-
void SetCenter(const Eigen::Vector2d ¢er)
Sets the center of the circle.
- Parameters:
center – the center of the circle
-
const Eigen::Vector2d &Center() const
Gets the center of the circle.
- Returns:
the circle center
-
void SetRadius(double radius)
Sets the radius of the circle.
- Parameters:
radius – the radius of the circle
-
double Radius() const
Gets the radius of the circle.
- Parameters:
radius – the radius of the circle
-
Circle(const Eigen::Vector2d ¢er, double radius)
fort::myrmidon::Polygon
-
class Polygon : public fort::myrmidon::Shape
A closed polygon.
A polygon is defined by a collection of Vertex(). Polygon in
fort-myrmidon
are always closed, meaning that there is no need to manually close it by settingVertex(Size()-1) == Vertex(0)
.Note that order matters as {(-1,-1),(1,-1),(1,1),(-1,1)} is a square, and {(-1,-1),(1,-1),(-1,1),(1,1)} is an hourglass.
Public Functions
-
Polygon(const Vector2dList &vertices)
Public constructor.
- Parameters:
vertices – the vertices of the polygon
-
const Vector2dList &Vertices() const
Gets the Polygon’s vertices.
- Returns:
a Vector2dList of the polygon vertices
-
void SetVertices(const Vector2dList &vertices)
Sets the Polygon’s vertices.
- Parameters:
vertices – a Vector2dList of the polygon vertices
-
size_t Size() const
Gets the number of vertices in the polygon.
- Returns:
the number of vertices in the Polygon
-
const Eigen::Vector2d &Vertex(size_t i) const
Gets a polygon vertex.
-
Polygon(const Vector2dList &vertices)