circle of n points (closed: first == last)
| 87 | |
| 88 | // circle of n points (closed: first == last) |
| 89 | Contour2d benchCircle( int n, double r, const Vector2d& center ) |
| 90 | { |
| 91 | Contour2d cont; |
| 92 | cont.reserve( n + 1 ); |
| 93 | for ( int i = 0; i < n; ++i ) |
| 94 | { |
| 95 | const double a = 2.0 * PI * i / n; |
| 96 | cont.push_back( center + Vector2d( r * std::cos( a ), r * std::sin( a ) ) ); |
| 97 | } |
| 98 | cont.push_back( cont.front() ); |
| 99 | return cont; |
| 100 | } |
| 101 | |
| 102 | // star polygon {n/step} as a single self-intersecting closed contour (needs gcd(n,step)==1) |
| 103 | Contour2d benchStar( int n, int step, double r, const Vector2d& center ) |