Cinder  0.9.1
Public Member Functions | List of all members
cinder::Shape2d Class Reference

#include <Shape2d.h>

Public Member Functions

void moveTo (const vec2 &p)
 
void moveTo (float x, float y)
 
void lineTo (const vec2 &p)
 
void lineTo (float x, float y)
 
void quadTo (const vec2 &p1, const vec2 &p2)
 
void quadTo (float x1, float y1, float x2, float y2)
 
void curveTo (const vec2 &p1, const vec2 &p2, const vec2 &p3)
 
void curveTo (float x1, float y1, float x2, float y2, float x3, float y3)
 
void arc (const vec2 &center, float radius, float startRadians, float endRadians, bool forward=true)
 
void arc (float centerX, float centerY, float radius, float startRadians, float endRadians, bool forward=true)
 
void arcTo (const vec2 &p, const vec2 &t, float radius)
 
void arcTo (float x, float y, float tanX, float tanY, float radius)
 
void close ()
 
bool empty () const
 
void clear ()
 
size_t getNumContours () const
 
const Path2dgetContour (size_t i) const
 
Path2dgetContour (size_t i)
 
const std::vector< Path2d > & getContours () const
 
std::vector< Path2d > & getContours ()
 
const vec2 & getCurrentPoint () const
 
void append (const Shape2d &shape)
 
void appendContour (const Path2d &contour)
 
void removeContour (size_t i)
 
void scale (const vec2 &amount, vec2 scaleCenter=vec2())
 
void transform (const mat3 &matrix)
 
Shape2d transformed (const mat3 &matrix) const
 
Rectf calcBoundingBox () const
 
Rectf calcPreciseBoundingBox () const
 
bool contains (const vec2 &pt) const
 
template<typename IT >
void iterate (IT &it)
 

Member Function Documentation

void cinder::Shape2d::moveTo ( const vec2 &  p)
void cinder::Shape2d::moveTo ( float  x,
float  y 
)
void cinder::Shape2d::lineTo ( const vec2 &  p)
void cinder::Shape2d::lineTo ( float  x,
float  y 
)
void cinder::Shape2d::quadTo ( const vec2 &  p1,
const vec2 &  p2 
)
void cinder::Shape2d::quadTo ( float  x1,
float  y1,
float  x2,
float  y2 
)
void cinder::Shape2d::curveTo ( const vec2 &  p1,
const vec2 &  p2,
const vec2 &  p3 
)
void cinder::Shape2d::curveTo ( float  x1,
float  y1,
float  x2,
float  y2,
float  x3,
float  y3 
)
void cinder::Shape2d::arc ( const vec2 &  center,
float  radius,
float  startRadians,
float  endRadians,
bool  forward = true 
)
void cinder::Shape2d::arc ( float  centerX,
float  centerY,
float  radius,
float  startRadians,
float  endRadians,
bool  forward = true 
)
void cinder::Shape2d::arcTo ( const vec2 &  p,
const vec2 &  t,
float  radius 
)
void cinder::Shape2d::arcTo ( float  x,
float  y,
float  tanX,
float  tanY,
float  radius 
)
void cinder::Shape2d::close ( )
bool cinder::Shape2d::empty ( ) const
void cinder::Shape2d::clear ( )
size_t cinder::Shape2d::getNumContours ( ) const
const Path2d& cinder::Shape2d::getContour ( size_t  i) const
Path2d& cinder::Shape2d::getContour ( size_t  i)
const std::vector<Path2d>& cinder::Shape2d::getContours ( ) const
std::vector<Path2d>& cinder::Shape2d::getContours ( )
const vec2& cinder::Shape2d::getCurrentPoint ( ) const
void cinder::Shape2d::append ( const Shape2d shape)

Appends the contours of shape to this shape.

void cinder::Shape2d::appendContour ( const Path2d contour)
void cinder::Shape2d::removeContour ( size_t  i)
void cinder::Shape2d::scale ( const vec2 &  amount,
vec2  scaleCenter = vec2() 
)

Scales the Shape2d by amount.x on X and amount.y on Y around the center scaleCenter.

void cinder::Shape2d::transform ( const mat3 &  matrix)

Transforms the Shape2d by matrix.

Shape2d cinder::Shape2d::transformed ( const mat3 &  matrix) const

Returns a copy transformed by matrix.

Rectf cinder::Shape2d::calcBoundingBox ( ) const

Returns the bounding box of the Shape's control points. Note that this is not necessarily the bounding box of the path's shape.

Rectf cinder::Shape2d::calcPreciseBoundingBox ( ) const

Returns the precise bounding box of the Shape's curves. Slower to calculate than calcBoundingBox().

bool cinder::Shape2d::contains ( const vec2 &  pt) const

Returns whether the point pt is contained within the boundaries of the shape.

template<typename IT >
void cinder::Shape2d::iterate ( IT &  it)

Iterates all of the contours and points of a Shape2d.

Expects a template parameter that implements

bool operator()( Path2d::SegmentType type, vec2 *points, vec2 *previousPoint )

. Functor should return false to cease iteration. A SegmentType of type CLOSE receives &mPoints[0] for its points parameters.


The documentation for this class was generated from the following files: