curvePoint()

Shape / Curves

Description

Evaluates the Catmull-Rom curve at parameter t.

Syntax

float curvePoint(float a, float b, float c, float d, float t)

Parameters

NameTypeDescription
afloatcoordinate of first control point
bfloatcoordinate of first point
cfloatcoordinate of second point
dfloatcoordinate of second control point
tfloatvalue between 0 and 1

Returns

float

Related

Under the Hood

From Processing.h:

float curvePoint(float a, float b, float c, float d, float t);

Under the Hood

From Processing.cpp:

float PApplet::curvePoint(float a,float b,float c,float d,float t){float t2=t*t,t3=t2*t,s=curveTightnessVal;return 0.5f*((-s*t3+2*s*t2-s*t)*a+((2-s)*t3+(s-3)*t2+1)*b+((s-2)*t3+(3-2*s)*t2+s*t)*c+(s*t3-s*t2)*d);}