scale()

Transform

Description

Increases or decreases the size of shapes by expanding and contracting vertices.

Syntax

void scale(float s) void scale(float sx, float sy)

Parameters

NameTypeDescription
sfloatpercentage to scale uniformly
sxfloatx-axis scale factor
syfloaty-axis scale factor

Returns

void

Related

Under the Hood

From Processing.h:

void translate(float x, float y); void rotate(float a); void scale(float s); void scale(float,float); void scale(float s) { for(auto& v:verts){ v.x*=s;v.y*=s;v.z*=s; } } void scale(float sx, float sy) { for(auto& v:verts){ v.x*=sx;v.y*=sy; } } inline void scale(A s1,B s2){ _api::scale((float)s1,(float)s2); void scale(float s); void scale(float sx, float sy); template<typename A,typename=std::enable_if_t<std::is_arithmetic_v<A>>> void scale(A s){ scale((float)s); template<typename A,typename B,typename=std::enable_if_t<std::is_arithmetic_v<A>&&std::is_arithmetic_v<B>>> void scale(A sx,B sy){ scale((float)sx,(float)sy); inline void scale(float s1,float s2){ if(PApplet::g_papplet) PApplet::g_papplet->scale(s1,s2); } inline void PGraphics::scale(float s) { if(PApplet::g_papplet) PApplet::g_papplet->scale(s); }

Under the Hood

From Processing.cpp:

void PApplet::scale(float s) {glScalef(s,s,1);} void PApplet::scale(float sx,float sy) {glScalef(sx,sy,1);}