MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / benchCircle

Function benchCircle

source/MRTest/MR2DContoursTriangulationTests.cpp:89–100  ·  view source on GitHub ↗

circle of n points (closed: first == last)

Source from the content-addressed store, hash-verified

87
88// circle of n points (closed: first == last)
89Contour2d 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)
103Contour2d benchStar( int n, int step, double r, const Vector2d& center )

Callers 1

TESTFunction · 0.85

Calls 2

push_backMethod · 0.80
reserveMethod · 0.45

Tested by

no test coverage detected