MCPcopy Create free account
hub / github.com/andrewwillmott/splines-lib / MakeMonotonic

Method MakeMonotonic

Splines.cpp:408–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406}
407
408void SL::MakeMonotonic(int n, Spline1 splines[], bool closed)
409{
410 if (n >= 2)
411 {
412 if (closed)
413 splines[0] = Monotonic(splines[n - 1].x, splines[0], splines[1].w);
414 else
415 splines[0] = MonotonicRight(splines[0], splines[1].w);
416 }
417 else if (n >= 1)
418 splines[0] = splines[0];
419
420 for (int i = 1; i < n - 1; i++)
421 splines[i] = Monotonic(splines[i - 1].x, splines[i], splines[i + 1].w);
422
423 if (n >= 2)
424 {
425 if (closed)
426 splines[n - 1] = Monotonic(splines[n - 2].x, splines[n - 1], splines[0].w);
427 else
428 splines[n - 1] = MonotonicLeft(splines[n - 2].x, splines[n - 1]);
429 }
430}
431
432Vec2f SL::FastBounds(const Spline1& s)
433//Returns bounds of the convex hull

Callers

nothing calls this directly

Calls 3

MonotonicFunction · 0.85
MonotonicRightFunction · 0.85
MonotonicLeftFunction · 0.85

Tested by

no test coverage detected