lygia
/v1.2.0
/math
/mod2
)Two dimensional modulus, returns the remainder of a division of two vectors. Found at in Mercury's library https://mercury.sexy/hg_sdf/
Use:
<vec2> mod2(<vec2> x, <vec2> size)
#ifndef FNC_MOD2
#define FNC_MOD2
vec2 mod2(inout vec2 p, float s) {
vec2 c = floor((p + s*0.5)/s);
p = mod(p + s*0.5,s) - s*0.5;
return c;
}
vec2 mod2(inout vec2 p, vec2 s) {
vec2 c = floor((p + s*0.5)/s);
p = mod(p + s*0.5,s) - s*0.5;
return c;
}
#endif
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.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository