PolyLine2f calcConvexHull( const Shape2d &shape ) { polygon poly; for( auto contourIt = shape.getContours().begin(); contourIt != shape.getContours().end(); ++contourIt ) includePathExtremeties( *contourIt, &poly ); polygon result; boost::geometry::convex_hull( poly, result ); return toPolyLine<float>( result ); }
vector<PolyLine2f> PolygonBooleanApp::makeLetterA() const { vector<PolyLine2f> result; Font arial( "Arial", 512 ); Shape2d shape = arial.getGlyphShape( arial.getGlyphChar( 'a' ) ); for( vector<Path2d>::const_iterator pathIt = shape.getContours().begin(); pathIt != shape.getContours().end(); ++pathIt ) { PolyLine2f contour( pathIt->subdivide() ); contour.offset( vec2( 200, 260 ) ); result.push_back( contour ); } return result; }
void Triangulator::addShape( const Shape2d &shape, float approximationScale ) { size_t numContours = shape.getContours().size(); for( size_t p = 0; p < numContours; ++p ) { addPath( shape.getContour(p), approximationScale ); } }
void Shape2d::append( const Shape2d &shape ) { for( vector<Path2d>::const_iterator pathIt = shape.getContours().begin(); pathIt != shape.getContours().end(); ++pathIt ) appendContour( *pathIt ); }