51 double center_x,
double center_y,
double radius,
52 double start_angle,
double end_angle,
55 std::string large_arc;
56 if( start_angle > end_angle ) {
57 large_arc = ( end_angle - start_angle <=
utils::PI ?
"1" :
"0" );
59 large_arc = ( end_angle - start_angle <=
utils::PI ?
"0" :
"1" );
62 double start_x = center_x + ( radius * std::cos( end_angle ));
63 double start_y = center_y + ( radius * std::sin( end_angle ));
64 double end_x = center_x + ( radius * std::cos( start_angle ));
65 double end_y = center_y + ( radius * std::sin( start_angle ));
67 std::ostringstream os;
69 os <<
"M " << center_x <<
" " << center_y <<
" ";
70 os <<
"L " << start_x <<
" " << start_y <<
" ";
72 os <<
"M " << start_x <<
" " << start_y <<
" ";
74 os <<
"A " << radius <<
" " << radius <<
" ";
75 os << 0 <<
" " << large_arc <<
" " << 0 <<
" ";
76 os << end_x <<
" " << end_y;
78 os <<
" L " << center_x <<
" " << center_y <<
" ";
88 std::vector<SvgPoint>
const& points
90 if( points.size() == 0 ) {
98 auto minmax_x = std::minmax_element(
99 points.begin(), points.end(),
102 auto minmax_y = std::minmax_element(
103 points.begin(), points.end(),
107 SvgPoint( minmax_x.first->x, minmax_y.first->y ),
108 SvgPoint( minmax_x.second->x, minmax_y.second->y )
113 std::vector<SvgPoint>
const& points,
116 if( points.size() == 0 ) {
124 auto min_x = std::numeric_limits<double>::infinity();
125 auto max_x = - std::numeric_limits<double>::infinity();
126 auto min_y = std::numeric_limits<double>::infinity();
127 auto max_y = - std::numeric_limits<double>::infinity();
130 for(
auto const& p : points ) {
131 auto const tr_point = transform.
apply( p );
132 min_x = std::min( min_x, tr_point.x );
133 max_x = std::max( max_x, tr_point.x );
134 min_y = std::min( min_y, tr_point.y );
135 max_y = std::max( max_y, tr_point.y );