LYGIA Shader Library

rotate2d (lygia/v1.1.6/math/rotate2d)

returns a 2x2 rotation matrix

Use:

rotate2d(<float> radians)

Check it on Github


#ifndef FNC_ROTATE2D
#define FNC_ROTATE2D
mat2 rotate2d(in float r){
    float c = cos(r);
    float s = sin(r);
    return mat2(c, -s, s, c);
}
#endif

Use:

rotate2d(<float> radians)

Check it on Github


#ifndef FNC_ROTATE2D
#define FNC_ROTATE2D
float2x2 rotate2d(in float radians){
    float c = cos(radians);
    float s = sin(radians);
    return float2x2(c, -s, s, c);
}
#endif

Check it on Github

fn rotate2d(radians: f32) -> mat2x2<f32> {
    let c = cos(radians);
    let s = sin(radians);
    return mat2x2<f32>(c, -s, s, c);
}

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository