Skip to content

Transformations

Syyrion edited this page Oct 30, 2022 · 8 revisions

A explaination for how lambda transformation functions work.


Introduction

Transformations provide a method to completely customize the behavior of walls. There are three types: polar, cartesian, and color. Polar and cartesian transformations are positional transformations and modify the geometry and movement of walls. Color transformations are their own category and modify the colors of verticies.

Positional Transformations

Positional transformations take a vertex as an input and output a modified vertex. There are two types: polar and cartesian. These transformations work with their respective coordinate systems.

IMPORTANT: When walls are being animated, only one of each transformation is applied to each vertex of each wall.

IMPORTANT: Polar transformations are always applied before cartesian transformations.

Polar Transformations

Polar transformations take two inputs: a radius and an angle in that order, and output a radius and an angle in that order. The function must only output a radius and an angle and nothing else.

Below is the no-operation polar tranformation. It takes the input radius <r> and angle <a> and outputs the same radius and angle.

function(r, a) return r, a end

Cartesian Transformations

Cartesian transformations take two inputs, an x and y coordinate in that order, and output an x and y coordinate in that order. The function must only output an x and y coordinate and nothing else.

Below is the no-operation polar transformation. It takes the coordinates <x> and <y> and outputs the same coordinates.

function(x, y) return x, y end

Color Transformations

Color transformations take in four inputs: the red, green, blue, and alpha channels of a color in that order, and output the red, green, blue, and alpha channels of a color in that order. The function must output four color channels and nothing else.

Below is the no-operation color transformation. It takes the color channels <r>, <g>, <b>, and <a> and outputs the same color channels.

function(r, g, b, a) return r, g, b, a end

If the run function is being used, polar and cartesian coordinate information is passed to the color transformation as shown below. This allows for the color of a wall vertex to change depending on its location.

function(r, g, b, a, radius, angle, x, y) return r, g, b, a end

Note: If the fill function is used, these extra parameters are not provided.