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

Method Join

Splines.cpp:550–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550bool SL::Join(const Spline1& s0, const Spline1& s1, Spline1* sOut)
551{
552 if (s0.w != s1.x) // early out
553 return false;
554
555 // backwards solve from left
556 float x0 = s0.x;
557 float y0 = 2 * s0.y - x0;
558 float z0 = 4 * s0.z - x0 - 2 * y0;
559 float w0 = 8 * s0.w - x0 - 3 * (y0 + z0);
560
561 // backwards solve from right
562 float w1 = s1.w;
563 float z1 = 2 * s1.z - w1;
564 float y1 = 4 * s1.y - w1 - 2 * z1;
565 float x1 = 8 * s1.x - w1 - 3 * (y1 + z1);
566
567 *sOut = Spline1(x0, y0, z1, w1); // use most stable terms
568
569 float e2 = sqr(x0 - x1) + sqr(y0 - y1) + sqr(z0 - z1) + sqr(w0 - w1);
570
571 return e2 <= 1e-4f * sqr(s0.x - s1.w); // sq error relative to overall size
572}
573
574bool SL::Join(const Spline1& s0, const Spline1& s1, float t, Spline1* s)
575{

Callers

nothing calls this directly

Calls 1

sqrFunction · 0.85

Tested by

no test coverage detected