Loading

Pconstrain

processing

Constrains a value to not exceed a maximum and minimum value. Also known as clamping a value.

It could be done with warpscript MIN MAX functions, see example.

Link to original Processing doc

Pconstrain is available since version 1.0.0.

Signatures

Examples

//clamping inside Pgraphics [ [ -2.0 -1.5001 -1.5 -1.0 0.0 1.0 1.5 1.50001 2.0 ] <% 10 10 '2D' PGraphics SWAP -1.5 1.5 Pconstrain SWAP DROP //drop the PGRAPHIC object. %> FOREACH ] //warpscript native way to clamp [ [ -2.0 -1.5001 -1.5 -1.0 0.0 1.0 1.5 1.50001 2.0 ] <% -1.5 MAX 1.5 MIN %> FOREACH ]