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

Function getPascalTriangleLine

source/MRMesh/MRFreeFormDeformer.cpp:70–80  ·  view source on GitHub ↗

0: 1 1: 1 1 2: 1 2 1 3: 1 3 3 1 4: 1 4 6 4 1 ................. line n pos k value is C(n,k)

Source from the content-addressed store, hash-verified

68// .................
69// line n pos k value is C(n,k)
70std::vector<int> getPascalTriangleLine( int line )
71{
72 assert( line >= 0 );
73 std::vector<int> res( line+1 );
74 res[0] = 1;
75 for ( int i = 1; i <= line / 2; ++i )
76 res[i] = combination( line, i );
77 for ( int i = line; i > line / 2; --i )
78 res[i] = res[line - i];
79 return res;
80}
81
82// simple pow function, not to use slow std::pow
83double cyclePow( double a, int b )

Callers 1

FreeFormBestFitMethod · 0.85

Calls 1

combinationFunction · 0.85

Tested by

no test coverage detected