Skip to main content

The "rot_prefetch" Function

Syntax#

rot_prefetch(deg);
ArgumentTypeDescription
degrealThe angle to calculate sine and cosine, in degrees

Description#

Pre-calculates the sine and cosine of an angle in degrees, which can then be used by future angle functions without calculating them again. This is highly useful for improving performance when calculating multiple points based on the same rotation.

Other angle functions will also prefetch rotation, if supplied, in which case running this script separately is not necessary. However, prefetching rotation manually can still be quite useful in some scenarios (such as calculations spread across multiple events) or simply maintaining clean code.

tip

See the included interactive demo for a visual example of this function!

Example#

rot_prefetch(90);
x = rot_point_x(5, 10);
y = rot_point_y(5, 10);