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

#include <Path2d.h>

Public Member Functions

 Path2dCalcCache (const Path2d &path)
 
const Path2dgetPath2d () const
 
float getLength () const
 
float calcNormalizedTime (float relativeTime, bool wrap=true, float tolerance=1.0e-03f, int maxIterations=16) const
 
float calcTimeForDistance (float distance, bool wrap=true, float tolerance=1.0e-03f, int maxIterations=16) const
 
vec2 getPosition (float t) const
 

Detailed Description

Accelerates the calculation of various operations on Path2d. Useful if doing repeated calculations, otherwise just use Path2d member functions.

Constructor & Destructor Documentation

cinder::Path2dCalcCache::Path2dCalcCache ( const Path2d path)

Member Function Documentation

const Path2d& cinder::Path2dCalcCache::getPath2d ( ) const
float cinder::Path2dCalcCache::getLength ( ) const
float cinder::Path2dCalcCache::calcNormalizedTime ( float  relativeTime,
bool  wrap = true,
float  tolerance = 1.0e-03f,
int  maxIterations = 16 
) const

Calculates the t-value corresponding to relativeTime in the range [0,1) within epsilon of tolerance. For example, relativeTime of 0.5f returns the t-value corresponding to half the length. maxIterations dictates the number of refinement loop iterations allowed, setting an upper bound for worst-case performance.

float cinder::Path2dCalcCache::calcTimeForDistance ( float  distance,
bool  wrap = true,
float  tolerance = 1.0e-03f,
int  maxIterations = 16 
) const

Calculates a t-value corresponding to arc length distance. If wrap then the t-value loops inside the 0-1 range as distance exceeds the arc length.

vec2 cinder::Path2dCalcCache::getPosition ( float  t) const

Returns the point on the curve at parameter t, which lies in the range [0,1]


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