MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / InterpolateLinearCurve

Function InterpolateLinearCurve

src/KeyFrame.cpp:36–41  ·  view source on GitHub ↗

Linear interpolation between two points

Source from the content-addressed store, hash-verified

34
35 // Linear interpolation between two points
36 double InterpolateLinearCurve(Point const & left, Point const & right, double const target) {
37 double const diff_Y = right.co.Y - left.co.Y;
38 double const diff_X = right.co.X - left.co.X;
39 double const slope = diff_Y / diff_X;
40 return left.co.Y + slope * (target - left.co.X);
41 }
42
43 // Bezier interpolation between two points
44 double InterpolateBezierCurve(Point const & left, Point const & right, double const target, double const allowed_error) {

Callers 1

InterpolateBetweenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected