Polar Stick Functions

Polar helpers express a stick as an angle and radius. They are useful when a direction is easier to calculate than separate X and Y axes.

Function Use
get_polar(stick, component) Read the current scripted stick output
get_ipolar(stick, component) Read the physical stick input
set_polar(stick, angle, radius) Write a real stick from polar values
set_polar2(POLAR_GHOST, angle, radius) Calculate virtual X/Y values without changing a real stick
get_info(ACTIVE_CONFIG) Read the active mouse-translation profile (0 Hip, 1 ADS)

Use POLAR_LS or POLAR_RS for the stick and POLAR_ANGLE or POLAR_RADIUS for the component. Angles are integer degrees from 0 through 359; full stick radius is 32767.

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

    if (radius > 8000) {
        set_polar(POLAR_RS, angle, min(radius + 2000, 32767));
    }
}

Ghost Stick

set_polar2() stores a calculated vector that can be read with ANALOG_GHOSTX and ANALOG_GHOSTY.

gpc
main {
    set_polar2(POLAR_GHOST, 90, 10000);
    int x = get_val(ANALOG_GHOSTX);
    int y = get_val(ANALOG_GHOSTY);
}

All polar and profile constants are predefined; no include is required.