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

Function getPointDegrees

source/MRMesh/MRPrecisePredicates2.cpp:20–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19template<size_t N>
20std::array<PointDegree, N> getPointDegrees( const std::array<PreciseVertCoords2, N> & vs )
21{
22 struct VertN
23 {
24 VertId v;
25 int n = 0;
26 };
27 std::array<VertN, N> as;
28 for ( int i = 0; i < N; ++i )
29 as[i] = { vs[i].id, i };
30 std::sort( begin( as ), end( as ), []( const auto & a, const auto & b ) { return a.v < b.v; } );
31
32 std::array<PointDegree, N> res;
33 int d = 1;
34 for ( int i = 0; i < N; ++i )
35 {
36 assert( i == 0 || as[i-1].v < as[i].v ); // no duplicate vertices are permitted
37 const auto n = as[i].n;
38 res[n] = { vs[n].pt, d };
39 d *= 9;
40 }
41 return res;
42}
43
44// std::int64_t is enough to store all coefficients in ( ccw(sa,s[0])*ccw(sb,s[1]) - ccw(sb,s[0])*ccw(sa,s[1]) ) except for degree 0, which is computed separately.
45template<int M>

Callers 2

smaller2Function · 0.70
segmentIntersectionOrderFunction · 0.70

Calls 2

beginFunction · 0.70
endFunction · 0.70

Tested by

no test coverage detected