MCPcopy Create free account
hub / github.com/BIMCoderLiang/LNLib / InsertMidKnotCore

Function InsertMidKnotCore

src/LNLib/Algorithm/KnotVectorUtils.cpp:21–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace LNLib
20{
21 void InsertMidKnotCore(std::vector<double>& unqiueKnotVector, std::vector<double>& insert, int limitNumber)
22 {
23 if (insert.size() == limitNumber)
24 {
25 return;
26 }
27 else
28 {
29 double standard = Constants::DoubleEpsilon;
30 int index = -1;
31 for (int i = 0; i < unqiueKnotVector.size() - 1; i++)
32 {
33 double delta = unqiueKnotVector[i + 1] - unqiueKnotVector[i];
34 if (MathUtils::IsGreaterThan(delta, standard))
35 {
36 standard = delta;
37 index = i;
38 }
39 }
40 double current = unqiueKnotVector[index] + standard / 2.0;
41 unqiueKnotVector.emplace_back(current);
42 std::sort(unqiueKnotVector.begin(), unqiueKnotVector.end());
43 insert.emplace_back(current);
44
45 InsertMidKnotCore(unqiueKnotVector, insert, limitNumber);
46 }
47 }
48}
49
50int LNLib::KnotVectorUtils::GetContinuity(int degree, const std::vector<double>& knotVector, double knot)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected