rotate()

Transform

Description

Rotates a shape by the angle parameter. Angles are in radians.

Syntax

void rotate(float angle)

Parameters

NameTypeDescription
anglefloatangle in radians

Returns

void

Related

Under the Hood

From Processing.h:

PVector& rotate(float t) { float c=std::cos(t),s=std::sin(t),nx=x*c-y*s,ny=x*s+y*c; x=nx; y=ny; return *this; } void translate(float x, float y); void rotate(float a); void rotate(float); inline void rotate(A a){ _api::rotate((float)a); void rotate(float angle); template<typename A,typename=std::enable_if_t<std::is_arithmetic_v<A>>> void rotate(A a){ rotate((float)a); inline void rotate(float a){ if(PApplet::g_papplet) PApplet::g_papplet->rotate(a); } inline void PGraphics::rotate(float a) { if(PApplet::g_papplet) PApplet::g_papplet->rotate(a); }

Under the Hood

From Processing.cpp:

void PApplet::rotate(float a) {glRotatef(a*180.0f/PI,0,0,1);}