For the complete documentation index, see llms.txt. This page is also available as Markdown.

6. Intermediate: polar pass-through with controlled rotation

Difficulty: Intermediate

polar-pass-through-with-controlled-rotation.gpc
define ROTATION_DEGREES = 15;

int angle;
int radius;

main {
    angle = get_ipolar(POLAR_RS, POLAR_ANGLE);
    radius = get_ipolar(POLAR_RS, POLAR_RADIUS);

    if(get_ival(PS5_L2)) {
        angle = angle + ROTATION_DEGREES;
        if(angle >= 360) angle = angle - 360;
    }

    set_polar(POLAR_RS, angle, radius);
}

What it teaches: raw polar input, angle normalization, exactly one final polar write.

Last updated