Loading

PcurveTightness


processing
Since v1.0.0
Available on all platforms
See also

Modifies the quality of forms created with Pcurve and PcurveVertex. The parameter tightness determines how the curve fits to the vertex points. The value 0.0 is the default value for tightness (this value defines the curves to be Catmull-Rom splines) and the value 1.0 connects all the points with straight lines. Values within the range -5.0 and 5.0 will deform the curves but will leave them recognizable and as values increase in magnitude, they will continue to deform.

Link to original Processing doc

Signature

Examples

// @preview image 400 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 $y4 Ppoint $x5 $y5 Ppoint $x6 $y6 Ppoint <% PnoFill 'POLYGON' PbeginShape $x1 $y1 PcurveVertex $x1 $y1 PcurveVertex $x2 $y2 PcurveVertex $x3 $y3 PcurveVertex $x4 $y4 PcurveVertex $x5 $y5 PcurveVertex $x6 $y6 PcurveVertex $x6 $y6 PcurveVertex 'OPEN' PendShape %> 'drawcurvemacro' STORE 2 PstrokeWeight 0xffff0000 Pstroke @drawcurvemacro //default tightness 0xffff0000 Pfill 'Tightness 0.0' 10 20 Ptext -1.2 'tightness' STORE //set the tightness here $tightness PcurveTightness 0xff009f00 Pstroke @drawcurvemacro //same drawing with a -1.0 tightness 0xff009f00 Pfill 'Tightness ' $tightness TOSTRING + 10 45 Ptext Pencode