math: add cycle180 and cycle360
parent
9e12dbb10e
commit
e53796415a
|
@ -88,6 +88,8 @@ typedef float mat44[16];
|
|||
float simplex4( vec4 xyzw );
|
||||
float deg (float radians);
|
||||
float rad (float degrees);
|
||||
float cycle180 (float angle);
|
||||
float cycle360 (float angle);
|
||||
int mini (int a, int b);
|
||||
int maxi (int a, int b);
|
||||
int absi (int a );
|
||||
|
|
2
depot
2
depot
|
@ -1 +1 @@
|
|||
Subproject commit 3abeaa482c1c2f88db6bf5816456d5e2e1faa6fb
|
||||
Subproject commit 6d764dd6019192b1efbf1018bc685bb2a8e495c3
|
|
@ -14944,6 +14944,9 @@ API float simplex4( vec4 xyzw );
|
|||
API float deg (float radians);
|
||||
API float rad (float degrees);
|
||||
|
||||
API float cycle180 (float angle);
|
||||
API float cycle360 (float angle);
|
||||
|
||||
API int mini (int a, int b);
|
||||
API int maxi (int a, int b);
|
||||
API int absi (int a );
|
||||
|
@ -377201,6 +377204,19 @@ float simplex4( vec4 v ) { return snoise4(v.x,v.y,v.z,v.w); }
|
|||
float deg (float radians) { return radians / C_PI * 180.0f; }
|
||||
float rad (float degrees) { return degrees * C_PI / 180.0f; }
|
||||
|
||||
float cycle180 (float angle) {
|
||||
angle = fmod(angle, 360.0f);
|
||||
if (angle > 180.0f) angle -= 360.0f;
|
||||
if (angle < -180.0f) angle += 360.0f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
float cycle360 (float angle) {
|
||||
angle = fmod(angle, 360.0f);
|
||||
if (angle < 0.0f) angle += 360.0f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
int mini (int a, int b) { return a < b ? a : b; }
|
||||
int maxi (int a, int b) { return a > b ? a : b; }
|
||||
int absi (int a ) { return a < 0 ? -a : a; }
|
||||
|
|
|
@ -78,6 +78,19 @@ float simplex4( vec4 v ) { return snoise4(v.x,v.y,v.z,v.w); }
|
|||
float deg (float radians) { return radians / C_PI * 180.0f; }
|
||||
float rad (float degrees) { return degrees * C_PI / 180.0f; }
|
||||
|
||||
float cycle180 (float angle) {
|
||||
angle = fmod(angle, 360.0f);
|
||||
if (angle > 180.0f) angle -= 360.0f;
|
||||
if (angle < -180.0f) angle += 360.0f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
float cycle360 (float angle) {
|
||||
angle = fmod(angle, 360.0f);
|
||||
if (angle < 0.0f) angle += 360.0f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
int mini (int a, int b) { return a < b ? a : b; }
|
||||
int maxi (int a, int b) { return a > b ? a : b; }
|
||||
int absi (int a ) { return a < 0 ? -a : a; }
|
||||
|
|
|
@ -52,6 +52,9 @@ API float simplex4( vec4 xyzw );
|
|||
API float deg (float radians);
|
||||
API float rad (float degrees);
|
||||
|
||||
API float cycle180 (float angle);
|
||||
API float cycle360 (float angle);
|
||||
|
||||
API int mini (int a, int b);
|
||||
API int maxi (int a, int b);
|
||||
API int absi (int a );
|
||||
|
|
13
engine/v4k.c
13
engine/v4k.c
|
@ -12231,6 +12231,19 @@ float simplex4( vec4 v ) { return snoise4(v.x,v.y,v.z,v.w); }
|
|||
float deg (float radians) { return radians / C_PI * 180.0f; }
|
||||
float rad (float degrees) { return degrees * C_PI / 180.0f; }
|
||||
|
||||
float cycle180 (float angle) {
|
||||
angle = fmod(angle, 360.0f);
|
||||
if (angle > 180.0f) angle -= 360.0f;
|
||||
if (angle < -180.0f) angle += 360.0f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
float cycle360 (float angle) {
|
||||
angle = fmod(angle, 360.0f);
|
||||
if (angle < 0.0f) angle += 360.0f;
|
||||
return angle;
|
||||
}
|
||||
|
||||
int mini (int a, int b) { return a < b ? a : b; }
|
||||
int maxi (int a, int b) { return a > b ? a : b; }
|
||||
int absi (int a ) { return a < 0 ? -a : a; }
|
||||
|
|
|
@ -1011,6 +1011,9 @@ API float simplex4( vec4 xyzw );
|
|||
API float deg (float radians);
|
||||
API float rad (float degrees);
|
||||
|
||||
API float cycle180 (float angle);
|
||||
API float cycle360 (float angle);
|
||||
|
||||
API int mini (int a, int b);
|
||||
API int maxi (int a, int b);
|
||||
API int absi (int a );
|
||||
|
|
Loading…
Reference in New Issue