## rotateZ (`lygia`/`space`/`rotateZ`)

rotate a 2D space by a radian angle

Dependencies:

Use:

``````rotateZ(<vec3|vec4> pos, float radian [, vec3 center])
``````

Check it on Github

``````

#ifndef FNC_ROTATEZ
#define FNC_ROTATEZ
vec4 rotateZ(in vec4 v, in float r, in vec4 c) {
return rotate4dZ(r) * (v - c) + c;
}

vec4 rotateZ(in vec4 v, in float r) {
#ifdef CENTER_4D
return rotate4dZ(r) * (v - CENTER_3D) + CENTER_3D;
#else
return rotate4dZ(r) * v;
#endif
}

vec3 rotateZ(in vec3 v, in float r, in vec3 c) {
return (rotate4dZ(r) * vec4(v - c, 0.0) ).xyz + c;
}

vec3 rotateZ(in vec3 v, in float r) {
#ifdef CENTER_3D
return (rotate4dZ(r) * vec4(v - CENTER_3D, 0.0)).xyz + CENTER_3D;
#else
return (rotate4dZ(r) * vec4(v, 0.0)).xyz;
#endif
}
#endif

``````

Dependencies:

Use:

``````rotateZ(<float3|float4> pos, float radian [, float3 center])
``````

Check it on Github

``````

#ifndef FNC_ROTATEZ
#define FNC_ROTATEZ
float3 rotateZ(in float3 pos, in float radian, in float3 center) {
return mul(rotate4dZ(radian), float4(pos - center, 0.) ).xyz + center;
}

float3 rotateZ(in float3 pos, in float radian) {
#ifdef CENTER_3D
#else
return rotateZ(pos, radian, float3(0.0, 0.0, 0.0));
#endif
}
#endif

``````