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

Method calcPreciseBoundingBox

src/cinder/Shape2d.cpp:209–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209Rectf Shape2d::calcPreciseBoundingBox() const
210{
211 auto result = Rectf( vec2(), vec2() );
212
213 // find the first point and initialize the result with that
214 for( vector<Path2d>::const_iterator contIt = mContours.begin(); contIt != mContours.end(); ++contIt ) {
215 if( ! contIt->mPoints.empty() ) {
216 result = Rectf( contIt->mPoints[0], contIt->mPoints[0] );
217 break;
218 }
219 }
220
221 // now iterate all the contours and expand the result to include their points
222 for( vector<Path2d>::const_iterator contIt = mContours.begin(); contIt != mContours.end(); ++contIt ) {
223 result.include( contIt->calcPreciseBoundingBox() );
224 }
225
226 return result;
227}
228
229float Shape2d::calcDistance( const vec2 &pt ) const
230{

Callers

nothing calls this directly

Calls 4

beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
includeMethod · 0.45

Tested by

no test coverage detected