MCPcopy Create free account
hub / github.com/cinder/Cinder / makePath

Method makePath

samples/CairoBasic/src/CairoBasicApp.cpp:25–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 {}
24
25 void makePath( cairo::Context &ctx ) const
26 {
27 for( int petal = 0; petal < mNumPetals; ++petal ) {
28 ctx.newSubPath();
29 float petalAngle = ( petal / (float)mNumPetals ) * 2 * M_PI;
30 vec2 outsideCircleCenter = mLoc + vec2( 1, 0 ) * (float)cos( petalAngle ) * mRadius + vec2( 0, 1 ) * (float)sin( petalAngle ) * mRadius;
31 vec2 insideCircleCenter = mLoc + vec2( 1, 0 ) * (float)cos( petalAngle ) * mPetalInsideRadius + vec2( 0, 1 ) * (float)sin( petalAngle ) * mPetalInsideRadius;
32 ctx.arc( outsideCircleCenter, mPetalOutsideRadius, petalAngle + M_PI / 2 + M_PI, petalAngle + M_PI / 2 );
33 ctx.arc( insideCircleCenter, mPetalInsideRadius, petalAngle + M_PI / 2, petalAngle + M_PI / 2 + M_PI );
34 ctx.closePath();
35 }
36 }
37
38 void draw( cairo::Context &ctx ) const
39 {

Callers

nothing calls this directly

Calls 5

cosFunction · 0.85
sinFunction · 0.85
newSubPathMethod · 0.80
closePathMethod · 0.80
arcMethod · 0.45

Tested by

no test coverage detected