lygia
/space
/rotateY
)rotate a 2D space by a radian angle
Dependencies:
Use:
rotateY(<vec3> pos, float radian [, vec4 center])
#ifndef FNC_ROTATEY
#define FNC_ROTATEY
vec4 rotateY(in vec4 v, in float r, in vec4 c) {
return rotate4dY(r) * (v - c) + c;
}
vec4 rotateY(in vec4 v, in float r) {
#ifdef CENTER_4D
return rotate4dY(r) * (v - CENTER_4D) + CENTER_4D;
#else
return rotate4dY(r) * v;
#endif
}
vec3 rotateY(in vec3 v, in float r, in vec3 c) {
return (rotate4dY(r) * vec4(v - c, 1.)).xyz + c;
}
vec3 rotateY(in vec3 v, in float r) {
#ifdef CENTER_3D
return (rotate4dY(r) * vec4(v - CENTER_3D, 1.)).xyz + CENTER_3D;
#else
return (rotate4dY(r) * vec4(v, 1.)).xyz;
#endif
}
#endif
Dependencies:
Use:
rotateY(<float3> pos, float radian [, float4 center])
#ifndef FNC_ROTATEY
#define FNC_ROTATEY
float3 rotateY(in float3 pos, in float radian, in float3 center) {
return mul(rotate4dY(radian), float4((pos - center), 1.)).xyz + center;
}
float3 rotateY(in float3 pos, in float radian) {
#ifdef CENTER_3D
return rotateY(pos, radian, CENTER_3D);
#else
return rotateY(pos, radian, float3(0.0, 0.0, 0.0));
#endif
}
#endif
Dependencies:
Use:
rotateY(<float3> pos, float radian [, float4 center])
#ifndef FNC_ROTATEY
#define FNC_ROTATEY
float4 rotateY(float4 v, float r, float4 c) {
return rotate4dY(r) * (v - c) + c;
}
float4 rotateY(float4 v, float r) {
#ifdef CENTER_4D
return rotate4dY(r) * (v - CENTER_4D) + CENTER_4D;
#else
return rotate4dY(r) * v;
#endif
}
float3 rotateY(float3 v, float r, float3 c) {
return (rotate4dY(r) * float4(v - c, 1.)).xyz + c;
}
float3 rotateY(float3 v, float r) {
#ifdef CENTER_3D
return (rotate4dY(r) * float4(v - CENTER_3D, 1.)).xyz + CENTER_3D;
#else
return (rotate4dY(r) * float4(v, 1.)).xyz;
#endif
}
#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