{{ message }}

Instantly share code, notes, and snippets.

# MrThatKid/squaredigital.md

Last active Jul 15, 2017
Porting from nITG Square & Digital to SM5 and vice versa.

## Reasoning

In order to make Square and Digital have the same period as Zigzag and Sawtooth in SM5, the period had to be changed. This means that syncing these modifiers using the same period precentage in SM5 is easy to do.

However, this also means that some math needs to be done when porting files that use Square & Digital to/from nITG.

Since the x position mods and z position mods used two different periods, two sets of equations are needed.

## Equation notes

Note that -80% period would be input as -0.8. Getting 1.95 as a result is equivalent to 195%. ARROW_SIZE is usually 64, so use that in calculations. These equations also apply to the tangent version of Digital.

## From nITG to SM5

Square & Digital: PeriodSM5 = ( PI * ( 60 + ( 60 * PeriodnITG ) ) - ARROW_SIZE ) / ARROW_SIZE

SquareZ & DigitalZ: PeriodSM5 = PI * ( 1 + PeriodnITG ) - 1

## From SM5 to nITG

Square & Digital: PeriodnITG = ( ( ARROW_SIZE + ( ARROW_SIZE * PeriodSM5 ) ) / ( 60 * PI ) ) - 1

SquareZ & DigitalZ: PeriodnITG = ( ( 1 + PeriodSM5 ) / PI ) - 1