Calculates the tangent of a point on a curve. There's a good definition of tangent on Wikipedia.

Link to original Processing doc

PcurveTangent is available since version 1.0.0.

See also



// @preview image //draw tangents along the curve 300 200 '2D3' PGraphics 255 Pbackground 4 PstrokeWeight 16 PtextSize 50 'x1' STORE 100 'x2' STORE 150 'x3' STORE 200 'x4' STORE 250 'x5' STORE 300 'x6' STORE 100 'y1' STORE 130 'y2' STORE 80 'y3' STORE 85 'y4' STORE 130 'y5' STORE 100 'y6' STORE $x1 $y1 Ppoint $x2 $y2 Ppoint $x3 $y3 Ppoint $x4 $y5 Ppoint 2 PstrokeWeight 0xffff0000 Pstroke $x1 $y1 $x2 $y2 $x3 $y3 $x4 $y4 Pcurve 0 10 <% 10.0 / 't' STORE $x1 $x2 $x3 $x4 $t PcurvePoint 'x' STORE $y1 $y2 $y3 $y4 $t PcurvePoint 'y' STORE $x1 $x2 $x3 $x4 $t PcurveTangent 'tx' STORE $y1 $y2 $y3 $y4 $t PcurveTangent 'ty' STORE $ty $tx ATAN2 PI 2.0 / - 'angle' STORE 0xff009f00 Pstroke $x $y $x $angle COS 8 * + $y $angle SIN 8 * + Pline $x $y Ppoint %> FOR Pencode