A collection of interconnected 2D points used to express an arbitrary 2D shape. More...
#include <shape.h>
Public Types | |
typedef IntersectionContainer::const_iterator | ConstIntersectionIterator |
Const Iterator type for Intersections stored in this class. | |
typedef std::vector< IntersectionInShape > | IntersectionContainer |
Basic container type for the storage of Intersections in this class. | |
typedef IntersectionContainer::iterator | IntersectionIterator |
Iterator type for Intersections stored in this class. | |
Public Member Functions | |||
Shape () | |||
Class constructor. | |||
~Shape () | |||
Class destructor. | |||
void | _AppendToManualObject (Ogre::ManualObject *Object) const | ||
Appends the shape vertices to a manual object being edited. More... | |||
Shape & | AddPoint (const Vector2 &Point) | ||
Adds a point to the shape. More... | |||
Shape & | AddPoint (const Real X, const Real Y) | ||
Adds a point to the shape. More... | |||
Shape & | AddPointRel (const Vector2 &Point) | ||
Adds a point to the shape, relative to the last position added. More... | |||
Shape & | AddPointRel (const Real X, const Real Y) | ||
Adds a point to the shape, relative to the last position added. More... | |||
Shape & | AppendShape (const Shape &Other) | ||
Appends all the points from another shape to this shape. More... | |||
Shape & | AppendShapeRel (const Shape &Other) | ||
Appends all the points from another shape to this shape with their positions relative to the position of the last point in this shape. More... | |||
template<template< class > class Interpolator> | |||
void | AppendTrack (const Track< Interpolator< Vector2 > > &Curve, const Whole NumPoints) | ||
Appends the contents of a 2D track to this shape. More... | |||
MultiShape | BooleanDifference (const Shape &Other) const | ||
Computes the difference between this shape and another one. More... | |||
MultiShape | BooleanIntersect (const Shape &Other) const | ||
Computes the intersection between this shape and another one. More... | |||
MultiShape | BooleanUnion (const Shape &Other) const | ||
Computes the union between this shape and another one. More... | |||
Shape & | Close () | ||
Makes this a closed shape, connecting the last point to the first point. More... | |||
Path | ConvertToPath () const | ||
Converts the shape to a 3D path. More... | |||
Shape | ExtractSubShape (const Whole First, const Whole Last) | ||
Extracts a part of the shape as a new shape. More... | |||
Real | FindBoundingRadius () const | ||
Computes the radius of a bounding circle centered on the origin of this shape. More... | |||
Procedural::ShapeSide | FindRealOutSide () const | ||
On a closed shape, find if the outside is located on the right or on the left. More... | |||
Mesh * | GenerateMesh (const String &Name, const String &Group) const | ||
Outputs a mesh representing this shape. More... | |||
Vector2 | GetAvgDirection (const Whole Index) const | ||
Gets the averaged direction from the specified point to both the next and previous points in the sequence. More... | |||
Vector2 | GetAvgNormal (const Whole Index) const | ||
Gets the averaged normal of the segments before and after the specified point. More... | |||
Whole | GetBoundedIndex (const Integer Index) const | ||
Converts a potentially unsafe Integer index into a safe Whole index. More... | |||
Vector2 | GetDirectionAfter (const Whole Index) const | ||
Gets the direction of a point to the next point in the sequence. More... | |||
Vector2 | GetDirectionBefore (const Whole Index) const | ||
Gets the direction from a point to the previous point in the sequence. More... | |||
Vector2 | GetNormalAfter (const Whole Index) const | ||
Gets the normal of the segment after the specified point. More... | |||
Vector2 | GetNormalBefore (const Whole Index) const | ||
Gets the normal of the segment before the specified point. More... | |||
Procedural::ShapeSide | GetOutSide () const | ||
Gets which side is the OutSide of this shape. More... | |||
const Vector2 & | GetPoint (const Integer Index) const | ||
Gets a point by index which can be out of bounds and will wrap. More... | |||
Whole | GetPointCount () const | ||
Gets the number of points in this shape. More... | |||
Point2DContainer | GetPoints () const | ||
Gets a copy of raw vector data of this shape. More... | |||
Point2DContainer & | GetPointsReference () | ||
Gets raw vector data of this shape as a non-const reference. More... | |||
const Point2DContainer & | GetPointsReference () const | ||
Gets raw vector data of this shape as a const reference. More... | |||
Vector2 | GetPosition (const Whole Index, const Real Coord) const | ||
Gets the position on a segment.
| |||
Vector2 | GetPosition (Real Coord) const | ||
Gets the position at the specified length along the shape.
| |||
Whole | GetSegCount () const | ||
Gets the number of segments in this shape. More... | |||
Real | GetTotalLength () const | ||
Gets the total length of all segments in this shape. More... | |||
Shape & | InsertPoint (const Whole Index, const Real X, const Real Y) | ||
Inserts a point to the shape. More... | |||
Shape & | InsertPoint (const Whole Index, const Vector2 &Point) | ||
Inserts a point to the shape. More... | |||
Boole | IsClosed () const | ||
Gets whether or not this shape is closed. More... | |||
Boole | IsOutsideRealOutside () const | ||
Gets whether the currently set OutSide is the real Outside. More... | |||
Boole | IsPointInside (const Vector2 &Point) const | ||
Tells whether a point is inside a shape or not. More... | |||
Shape & | Mirror (Boole Flip=false) | ||
Create a symetric copy of the points in this shape at the origin point. More... | |||
Shape & | MirrorAroundAxis (const Vector2 &Axis, Boole Flip=false) | ||
Create a symetric copy of the points in this shape at an arbitrary axis. More... | |||
Shape & | MirrorAroundPoint (const Real X, const Real Y, Boole Flip=false) | ||
Create a symetric copy of the points in this shape at an arbitrary point. More... | |||
Shape & | MirrorAroundPoint (const Vector2 &Point, Boole Flip=false) | ||
Create a symetric copy of the points in this shape at an arbitrary point. More... | |||
Shape & | Reflect (const Vector2 &Normal) | ||
Reflect all points in this shape against a zero-origined line with a given normal. More... | |||
Shape & | Reset () | ||
Clears all points from this shape. More... | |||
Shape & | Reverse () | ||
Reverses direction/ordering of the segments in this shape. More... | |||
Shape & | Rotate (const Real Angle) | ||
Applies the given rotation to all the points in this shape. More... | |||
Shape & | Scale (const Real Scaling) | ||
Applies the given scale to all the points in this shape. More... | |||
Shape & | Scale (const Real ScaleX, const Real ScaleY) | ||
Applies the given scale to all the points in this shape. More... | |||
Shape & | Scale (const Vector2 &Scaling) | ||
Applies the given scale to all the points in this shape. More... | |||
Shape & | SetOutSide (const Procedural::ShapeSide Side) | ||
Sets which side is the OutSide of this shape. More... | |||
Shape & | SwitchSide () | ||
Toggles the currently set "OutSide". More... | |||
MultiShape | Thicken (const Real Amount) | ||
Applies a "thickness" to a shape, ie a bit like the extruder, but in 2D. More... | |||
Shape & | Translate (const Vector2 &Trans) | ||
Applies the given translation to all the points in this shape. More... | |||
Shape & | Translate (const Real TransX, const Real TransY) | ||
Applies the given translation to all the points in this shape. More... | |||
Protected Member Functions | |
MultiShape | _BooleanOperation (const Shape &Other, const Procedural::BooleanOperation OpType) const |
Performs a boolean operation between this shape and another shape. More... | |
void | _FindAllIntersections (const Shape &Other, IntersectionContainer &Intersections) const |
Finds all detectable intersections between this shape and another shape. More... | |
Boole | _FindWhereToGo (const Shape *InputShapes[], const Procedural::BooleanOperation OpType, const IntersectionInShape &Intersection, UInt8 &ShapeSelector, Char8 &IsIncreasing, Whole &CurrentSegment) const |
Determines which segment to follow when an intersection is encountered. More... | |
Char8 | _IsIncreasing (const Real Dot, const Procedural::BooleanOperation OpType, const Char8 ShapeSelector) const |
Gets whether or not the segment being operated on is to be incremented. More... | |
Boole | _IsLookingForOutside (const Procedural::BooleanOperation OpType, const Char8 ShapeSelector) const |
Gets whether or not the current boolean operation is looking for outside edges of the two shapes being processed. More... | |
Protected Attributes | |
Boole | Closed |
Whether or not the first point and last point should be connected, closing the shape. More... | |
Procedural::ShapeSide | OutSide |
Sets which extreme side of this shape is to be considered the outside of the shape. Useful when a shape is not closed. More... | |
Point2DContainer | Points |
Container storing all of the points that form this shape. More... | |
A collection of interconnected 2D points used to express an arbitrary 2D shape.
void Mezzanine::Graphics::Procedural::Shape::_AppendToManualObject | ( | Ogre::ManualObject * | Object | ) | const |
|
protected |
Performs a boolean operation between this shape and another shape.
Other | The other shape to perform the boolean operation with. |
OpType | The type of boolean operation to perform. |
|
protected |
|
protected |
Determines which segment to follow when an intersection is encountered.
InputShapes | An array of shapes being operated on. |
OpType | The type of boolean operation being performed. |
Intersection | The intersection that was encountered. |
ShapeSelector | A 0 or 1 that is the index of the shape that owns the segment to advance along. |
IsIncreasing | A -1 or 1 indicating whether the segment being operated on is to be incremented. |
CurrentSegment | The index of the line segment in the intersection to advance along. |
|
protected |
Gets whether or not the segment being operated on is to be incremented.
Dot | The Dot Product of the directions from the two points in an intersection. |
OpType | The type of boolean operation being performed. |
ShapeSelector | A 0 or 1 describing which shape the current edge being processed belongs to. |
|
protected |
Gets whether or not the current boolean operation is looking for outside edges of the two shapes being processed.
OpType | The type of boolean operation being performed. |
ShapeSelector | A 0 or 1 describing which shape the current edge being processed belongs to. |
|
inline |
Appends the contents of a 2D track to this shape.
Curve | The 2D curved track of points to append to this shape. |
NumPoints | The number of points along the curve to generate for this shape. |
MultiShape Mezzanine::Graphics::Procedural::Shape::BooleanDifference | ( | const Shape & | Other | ) | const |
Computes the difference between this shape and another one.
This | will throw an exception if either shape is not closed or contains less than 2 points. A INVALID_STATE_EXCEPTION will be thrown if the calling shape is invalid, or a PARAMETERS_EXCEPTION if the parameter shape is invalid. |
Other | The shape against which the diffenrence is computed. |
MultiShape Mezzanine::Graphics::Procedural::Shape::BooleanIntersect | ( | const Shape & | Other | ) | const |
Computes the intersection between this shape and another one.
This | will throw an exception if either shape is not closed or contains less than 2 points. A INVALID_STATE_EXCEPTION will be thrown if the calling shape is invalid, or a PARAMETERS_EXCEPTION if the parameter shape is invalid. |
Other | The shape against which the intersection is computed. |
MultiShape Mezzanine::Graphics::Procedural::Shape::BooleanUnion | ( | const Shape & | Other | ) | const |
Computes the union between this shape and another one.
This | will throw an exception if either shape is not closed or contains less than 2 points. A INVALID_STATE_EXCEPTION will be thrown if the calling shape is invalid, or a PARAMETERS_EXCEPTION if the parameter shape is invalid. |
Other | The shape against which the union is computed. |
Shape & Mezzanine::Graphics::Procedural::Shape::Close | ( | ) |
Path Mezzanine::Graphics::Procedural::Shape::ConvertToPath | ( | ) | const |
Real Mezzanine::Graphics::Procedural::Shape::FindBoundingRadius | ( | ) | const |
Procedural::ShapeSide Mezzanine::Graphics::Procedural::Shape::FindRealOutSide | ( | ) | const |
On a closed shape, find if the outside is located on the right or on the left.
Gets the averaged direction from the specified point to both the next and previous points in the sequence.
Index | The index of the point to retrieve the direction for. |
Procedural::ShapeSide Mezzanine::Graphics::Procedural::Shape::GetOutSide | ( | ) | const |
Whole Mezzanine::Graphics::Procedural::Shape::GetPointCount | ( | ) | const |
Point2DContainer Mezzanine::Graphics::Procedural::Shape::GetPoints | ( | ) | const |
Point2DContainer & Mezzanine::Graphics::Procedural::Shape::GetPointsReference | ( | ) |
const Point2DContainer & Mezzanine::Graphics::Procedural::Shape::GetPointsReference | ( | ) | const |
Vector2 Mezzanine::Graphics::Procedural::Shape::GetPosition | ( | const Whole | Index, |
const Real | Coord | ||
) | const |
Gets the position on a segment.
If | the provided index is out of bounds or the Coord is outside of the range 0-1 then a PARAMETERS_EXCEPTION will be thrown. |
Index | The index of the point starting the segment to retrieve the point from. |
Coord | The relative point on the specified segment to get the position of. |
Gets the position at the specified length along the shape.
If | the shape has less than 2 points then a PARAMETERS_EXCEPTION will be thrown. |
Coord | The length position to get the 2D position of. |
Whole Mezzanine::Graphics::Procedural::Shape::GetSegCount | ( | ) | const |
Real Mezzanine::Graphics::Procedural::Shape::GetTotalLength | ( | ) | const |
Boole Mezzanine::Graphics::Procedural::Shape::IsClosed | ( | ) | const |
Boole Mezzanine::Graphics::Procedural::Shape::IsOutsideRealOutside | ( | ) | const |
Shape & Mezzanine::Graphics::Procedural::Shape::MirrorAroundPoint | ( | const Real | X, |
const Real | Y, | ||
Boole | Flip = false |
||
) |
Create a symetric copy of the points in this shape at an arbitrary point.
X | The position on the X axis to mirror at. |
Y | The position on the Y axis to mirror at. |
Flip | If true then this will process the points in this shape in reverse order. |
Shape & Mezzanine::Graphics::Procedural::Shape::Reset | ( | ) |
Shape & Mezzanine::Graphics::Procedural::Shape::Reverse | ( | ) |
Applies the given rotation to all the points in this shape.
Angle | The amount of rotation to be applied in radians. |
Applies the given scale to all the points in this shape.
Scaling | The amount of scaling to apply to each axis. |
Applies the given scale to all the points in this shape.
ScaleX | The amount of scaling to be applied on the X axis. |
ScaleY | The amount of scaling to be applied on the Y axis. |
Applies the given scale to all the points in this shape.
Scaling | The amount of scaling to apply to each axis. |
Shape & Mezzanine::Graphics::Procedural::Shape::SetOutSide | ( | const Procedural::ShapeSide | Side | ) |
Sets which side is the OutSide of this shape.
Side | A ShapeSide enum value describing which side of this shape is the OutSide. |
Shape & Mezzanine::Graphics::Procedural::Shape::SwitchSide | ( | ) |
MultiShape Mezzanine::Graphics::Procedural::Shape::Thicken | ( | const Real | Amount | ) |
Applies a "thickness" to a shape, ie a bit like the extruder, but in 2D.
Amount | The amount of thickness to be applied to this shape. |
Applies the given translation to all the points in this shape.
Trans | The amount of translation to apply. |
Applies the given translation to all the points in this shape.
TransX | The amount of translation to apply on the X axis. |
TransY | The amount of translation to apply on the Y axis. |
|
protected |
|
protected |
|
protected |