Loading

Protate


processing
Since v1.0.0
Available on all platforms
See also

Rotates the amount specified by the angle parameter. Angles must be specified in radians (values from 0 to 2 PI).

The coordinates are always rotated around their relative position to the origin. Positive numbers rotate objects in a clockwise direction and negative numbers rotate in the couterclockwise direction. Transformations apply to everything that happens afterward, and subsequent calls to the function compound the effect. For example, calling pi 2.0 / Protate once and then calling pi 2.0 / Protate a second time is the same as a single pi Protate.

Technically, Protate multiplies the current transformation matrix by a rotation matrix. This function can be further controlled by PpushMatrix and PpopMatrix.

Link to original Processing doc

Signature

Examples

// @preview image <% //draw smiley macro 'centerY' STORE 'centerX' STORE 'CENTER' PellipseMode $centerX $centerY 30 30 Pellipse 0 Pfill $centerX 7 - $centerY 5 - 5 8 Pellipse $centerX 7 + $centerY 5 - 5 8 Pellipse PnoFill $centerX $centerY 22 22 0.5 1.5 Parc %> 'drawsmiley' STORE 200 200 '2D3' PGraphics 255 Pbackground 0 0 @drawsmiley //top left corner 40 0 @drawsmiley 100 100 Ptranslate 0 0 @drawsmiley 40 0 @drawsmiley 0 30 Ptranslate //try to invert this line with the next one pi 4 / Protate 0 0 @drawsmiley 40 0 @drawsmiley PresetMatrix 200 200 @drawsmiley //bottom right corner Pencode