| 93 | } |
| 94 | |
| 95 | void Path2dApp::draw() |
| 96 | { |
| 97 | gl::clear( Color( 0.0f, 0.1f, 0.2f ) ); |
| 98 | |
| 99 | // draw the control points |
| 100 | gl::color( Color( 1, 1, 0 ) ); |
| 101 | for( size_t p = 0; p < mPath.getNumPoints(); ++p ) |
| 102 | gl::drawSolidCircle( mPath.getPoint( p ), 2.5f ); |
| 103 | |
| 104 | // draw the precise bounding box |
| 105 | if( mPath.getNumSegments() > 1 ) { |
| 106 | gl::color( ColorA( 0, 1, 1, 0.2f ) ); |
| 107 | gl::drawSolidRect( mPath.calcPreciseBoundingBox() ); |
| 108 | } |
| 109 | |
| 110 | // draw the curve itself |
| 111 | gl::color( Color( 1.0f, 0.5f, 0.25f ) ); |
| 112 | gl::draw( mPath ); |
| 113 | |
| 114 | if( mPath.getNumSegments() > 1 ) { |
| 115 | // draw some tangents |
| 116 | gl::color( Color( 0.2f, 0.9f, 0.2f ) ); |
| 117 | for( float t = 0; t < 1; t += 0.2f ) |
| 118 | gl::drawLine( mPath.getPosition( t ), mPath.getPosition( t ) + normalize( mPath.getTangent( t ) ) * 80.0f ); |
| 119 | |
| 120 | // draw circles at 1/4, 2/4 and 3/4 the length |
| 121 | gl::color( ColorA( 0.2f, 0.9f, 0.9f, 0.5f ) ); |
| 122 | for( float t = 0.25f; t < 1.0f; t += 0.25f ) |
| 123 | gl::drawSolidCircle( mPath.getPosition( mPath.calcNormalizedTime( t ) ), 5.0f ); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | |
| 128 | CINDER_APP( Path2dApp, RendererGl ) |
nothing calls this directly
no test coverage detected