return; // Complete rectangle, nothing more needed.
}
- float co = cos(f * 2 * M_PI);
- float si = sin(f * 2 * M_PI);
+ float co = cos(f * (2 * M_PI));
+ float si = sin(f * (2 * M_PI));
float q = fabs(co) + fabs(si);
co /= q;
si /= q;
if((height <= 0) || (lasttime <= 0) || (fadetime <= 0) || ((time - lasttime) >= fadetime))
return false;
- float alpha = cos(((time - lasttime) / fadetime) * 90 * DEG2RAD); // fade non-linear like the physics panel does
+ float alpha = cos(((time - lasttime) / fadetime) * M_PI_2); // fade non-linear like the physics panel does
vector size = panel_size;
size.y = height;
velocityzoom = 1;
float frustumx, frustumy, fovx, fovy;
- frustumy = tan(fov * M_PI / 360.0) * 0.75 * current_viewzoom * velocityzoom;
+ frustumy = tan(fov * (M_PI / 360)) * 0.75 * current_viewzoom * velocityzoom;
frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
- fovx = atan2(frustumx, 1) / M_PI * 360.0;
- fovy = atan2(frustumy, 1) / M_PI * 360.0;
+ fovx = atan2(frustumx, 1) * (360 / M_PI);
+ fovy = atan2(frustumy, 1) * (360 / M_PI);
return '1 0 0' * fovx + '0 1 0' * fovy;
}
vector GetViewLocationFOV(float fov)
{
- float frustumy = tan(fov * M_PI / 360.0) * 0.75;
+ float frustumy = tan(fov * (M_PI / 360)) * 0.75;
float frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
- float fovx = atan2(frustumx, 1) / M_PI * 360.0;
- float fovy = atan2(frustumy, 1) / M_PI * 360.0;
+ float fovx = atan2(frustumx, 1) * (360 / M_PI);
+ float fovy = atan2(frustumy, 1) * (360 / M_PI);
return '1 0 0' * fovx + '0 1 0' * fovy;
}
for(i = 0; i < 16; ++i)
{
iteration_scale -= i / 16;
- theta = random() * 2 * M_PI;
+ theta = random() * (2 * M_PI);
loc_y = sin(theta);
loc_x = cos(theta);
loc_z = 0;
{
float angle;
do
- angle = random()*M_PI*2;
+ angle = random() * (2 * M_PI);
while ( fabs(sin(angle)) < 0.17 || fabs(cos(angle)) < 0.17 );
ball.velocity_x = cos(angle)*autocvar_sv_minigames_pong_ball_speed;
ball.velocity_y = sin(angle)*autocvar_sv_minigames_pong_ball_speed;
randomr = random();
randomr = exp(-5 * randomr * randomr) * autocvar_g_nades_nade_radius;
float randomw;
- randomw = random() * M_PI * 2;
+ randomw = random() * (2 * M_PI);
vector randomp;
randomp.x = randomr * cos(randomw);
randomp.y = randomr * sin(randomw);
randomr = random();
randomr = exp(-5 * randomr * randomr) * autocvar_g_nades_nade_radius;
float randomw;
- randomw = random() * M_PI * 2;
+ randomw = random() * (2 * M_PI);
vector randomp;
randomp.x = randomr * cos(randomw);
randomp.y = randomr * sin(randomw);
}
else
{
- q = .19634954084936207740 * q;
- p = .19634954084936207740 * p - 1.57079632679489661922;
+ q = M_PI / 16 * q;
+ p = M_PI / 16 * p - M_PI_2;
out.x = cos(q) * cos(p);
out.y = sin(q) * cos(p);
out.z = -sin(p);
error("BOGUS vectoangles");
//print("angles: ", vtos(ang), "\n");
- p = floor(0.5 + (ang.x + 90) * 16 / 180) & 15; // -90..90 to 0..14
+ p = floor(0.5 + (ang.x + 90) * (16 / 180)) & 15; // -90..90 to 0..14
if(p == 0)
{
if(vec.z < 0)
y = 30;
}
else
- y = floor(0.5 + ang.y * 32 / 360) & 31; // 0..360 to 0..32
+ y = floor(0.5 + ang.y * (32 / 360)) & 31; // 0..360 to 0..32
len = invertLengthLog(vlen(vec));
//print("compressed: p:", ftos(p)); print(" y:", ftos(y)); print(" len:", ftos(len), "\n");
}
else
{
- float a = random() * 2 * M_PI;
+ float a = random() * (2 * M_PI);
float b = sqrt(-2 * log(random()));
gsl_ran_gaussian_lastvalue = cos(a) * b;
gsl_ran_gaussian_lastvalue_set = 1;
float cosangle = normalize(m0) * normalize(m1);
if(cosangle >= 0)
return 0;
- return 0.5 - 0.5 * cos(cosangle * cosangle * 4 * M_PI);
+ return 0.5 - 0.5 * cos(cosangle * cosangle * (4 * M_PI));
// returns 0 for: -1, -sqrt(0.5), 0 (angles that commonly happen with kbd)
}
if (autocvar_g_waypointeditor_symmetrical == -1)
map_center = autocvar_g_waypointeditor_symmetrical_origin;
- new_org = Rotate(org - map_center, 360 * DEG2RAD / ctf_flags) + map_center;
+ new_org = Rotate(org - map_center, 2 * M_PI / ctf_flags) + map_center;
}
else if (fabs(autocvar_g_waypointeditor_symmetrical) == 2)
{