Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ UnsignedInt PathfindCell::costToGoal( PathfindCell *goal )
Int dy = m_info->m_pos.y - goal->getYIndex();
#define NO_REAL_DIST
#ifdef REAL_DIST
Int cost = COST_ORTHOGONAL*WWMath::Sqrt(dx*dx + dy*dy);
Int cost = COST_ORTHOGONAL*WWMath::Sqrt((float)(dx*dx + dy*dy));
#else
if (dx<0) dx = -dx;
if (dy<0) dy = -dy;
Expand All @@ -2096,7 +2096,7 @@ UnsignedInt PathfindCell::costToHierGoal( PathfindCell *goal )
}
Int dx = m_info->m_pos.x - goal->getXIndex();
Int dy = m_info->m_pos.y - goal->getYIndex();
Int cost = REAL_TO_INT_FLOOR(COST_ORTHOGONAL*WWMath::Sqrt(dx*dx + dy*dy) + 0.5f);
Int cost = REAL_TO_INT_FLOOR(COST_ORTHOGONAL*WWMath::Sqrt((float)(dx*dx + dy*dy)) + 0.5f);
return cost;
}

Expand Down Expand Up @@ -6444,7 +6444,7 @@ Int Pathfinder::examineNeighboringCells(PathfindCell *parentCell, PathfindCell *
} else {
dx = newCellCoord.x - goalCell->getXIndex();
dy = newCellCoord.y - goalCell->getYIndex();
costRemaining = COST_ORTHOGONAL*WWMath::Sqrt(dx*dx + dy*dy);
costRemaining = COST_ORTHOGONAL*WWMath::Sqrt((float)(dx*dx + dy*dy));
costRemaining -= attackDistance/2;
if (costRemaining<0)
costRemaining=0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void CameraShakeSystemClass::CameraShakerClass::Compute_Rotations(const Vector3
** omega(t) = start_omega + (end_omega - start_omega) * t
** phi = random(0..start_omega)
*/
float intensity = Intensity * (1.0f - WWMath::Sqrt_Legacy(len2) / Radius) * (1.0f - ElapsedTime / Duration);
float intensity = Intensity * (1.0f - WWMath::Sqrt(len2) / Radius) * (1.0f - ElapsedTime / Duration);
for (int i=0; i<3; i++) {
float omega = Omega[i] + (END_OMEGA - Omega[i]) * ElapsedTime;
(*set_angles)[i] += AXIS_ROTATION[i] * intensity * WWMath::Sinf_Legacy(omega * ElapsedTime + Phi[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ void W3DMouse::draw()
{
offset = TheInGameUI->getScrollAmount();
offset.normalize();
Real theta = atan2(-offset.y, offset.x);
Real theta = WWMath::Atan2(-offset.y, offset.x);
theta -= (Real)WWMATH_HALF_PI;
tm.Rotate_Z(theta);
}
Expand Down
12 changes: 6 additions & 6 deletions Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2792,7 +2792,7 @@ void W3DView::rotateCameraTowardPosition(const Coord3D *pLoc, Int milliseconds,
Vector2 dir(pLoc->x-curPos.x, pLoc->y-curPos.y);
const Real dirLength = dir.Length();
if (dirLength<0.1f) return;
Real angle = WWMath::Acos_Legacy(dir.X/dirLength);
Real angle = WWMath::Acos(dir.X/dirLength);
if (dir.Y<0.0f) {
angle = -angle;
}
Expand Down Expand Up @@ -2935,7 +2935,7 @@ void W3DView::cameraModLookToward(Coord3D *pLoc)
Vector2 dir(pLoc->x-result.x, pLoc->y-result.y);
const Real dirLength = dir.Length();
if (dirLength<0.1f) continue;
Real angle = WWMath::Acos_Legacy(dir.X/dirLength);
Real angle = WWMath::Acos(dir.X/dirLength);
if (dir.Y<0.0f) {
angle = -angle;
}
Expand Down Expand Up @@ -3016,7 +3016,7 @@ void W3DView::cameraModFinalLookToward(Coord3D *pLoc)
Vector2 dir(pLoc->x-result.x, pLoc->y-result.y);
const Real dirLength = dir.Length();
if (dirLength<0.1f) continue;
Real angle = WWMath::Acos_Legacy(dir.X/dirLength);
Real angle = WWMath::Acos(dir.X/dirLength);
if (dir.Y<0.0f) {
angle = -angle;
}
Expand Down Expand Up @@ -3197,7 +3197,7 @@ void W3DView::setupWaypointPath(Bool orient)
m_mcwpInfo.waySegLength[i] = dirLength;
m_mcwpInfo.totalDistance += m_mcwpInfo.waySegLength[i];
if (orient && dirLength >= 0.1f) {
angle = WWMath::Acos_Legacy(dir.X/dirLength);
angle = WWMath::Acos(dir.X/dirLength);
if (dir.Y<0.0f) {
angle = -angle;
}
Expand Down Expand Up @@ -3273,7 +3273,7 @@ static Real makeQuadraticS(Real t)
tPrime = 0.5 * (2*t*2*t);
} else {
tPrime = (t-0.5)*2;
tPrime = WWMath::Sqrt_Legacy(tPrime);
tPrime = WWMath::Sqrt(tPrime);
tPrime = 0.5 + 0.5*(tPrime);
}
return tPrime*0.5 + t*0.5;
Expand Down Expand Up @@ -3307,7 +3307,7 @@ void W3DView::rotateCameraOneFrame()
const Real dirLength = dir.Length();
if (dirLength>=0.1f)
{
Real angle = WWMath::Acos_Legacy(dir.X/dirLength);
Real angle = WWMath::Acos(dir.X/dirLength);
if (dir.Y<0.0f) {
angle = -angle;
}
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ void PolygonClass::Compute_Plane()
ay /= (double)NumVerts;
az /= (double)NumVerts;

double len = WWMath::Sqrt_Legacy(nx*nx + ny*ny + nz*nz);
double len = WWMath::Sqrt((float)(nx*nx + ny*ny + nz*nz));
nx /= len;
ny /= len;
nz /= len;
Expand Down
4 changes: 2 additions & 2 deletions Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,8 @@ bool TexProjectClass::Compute_Perspective_Projection

float tan_hfov2 = WWMath::Fabsf_Legacy(box.Extent.X / (box.Center.Z + box.Extent.Z));
float tan_vfov2 = WWMath::Fabsf_Legacy(box.Extent.Y / (box.Center.Z + box.Extent.Z));
float hfov = 2.0f * WWMath::Atan_Legacy(tan_hfov2);
float vfov = 2.0f * WWMath::Atan_Legacy(tan_vfov2);
float hfov = 2.0f * WWMath::Atan(tan_hfov2);
float vfov = 2.0f * WWMath::Atan(tan_vfov2);

/*
** Plug in the results.
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWAudio/SoundPseudo3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ SoundPseudo3DClass::Update_Pseudo_Pan ()
//
// Calculate a normalized pan from 0 (hard left) to 1.0F (hard right)
//
float angle = WWMath::Atan2_Legacy (rel_sound_pos.Y, rel_sound_pos.X);
float angle = WWMath::Atan2 (rel_sound_pos.Y, rel_sound_pos.X);
float pan = -WWMath::Fast_Sin (angle);
pan = (pan / 2.0F) + 0.5F;

Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ bool CollisionMath::Collide(const LineSegClass & line,const SphereClass & sphere
if (disc < 0.0f) {
return false;
} else {
float d = WWMath::Sqrt_Legacy(disc);
float d = WWMath::Sqrt(disc);
float frac = (clen - d) / line.Get_Length();
if (frac<0.0f)
frac = (clen + d) / line.Get_Length();
Expand Down
24 changes: 12 additions & 12 deletions Core/Libraries/Source/WWVegas/WWMath/euler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,35 +180,35 @@ void EulerAnglesClass::From_Matrix(const Matrix3D & M, int order)
_euler_unpack_order(order,i,j,k,h,n,s,f);

if (s == EULER_REPEAT_YES) {
double sy = WWMath::Sqrt(M[i][j]*M[i][j] + M[i][k]*M[i][k]);
float sy = WWMath::Sqrt(M[i][j]*M[i][j] + M[i][k]*M[i][k]);

if (sy > 16*FLT_EPSILON) {

Angle[0] = WWMath::Atan2_Legacy(M[i][j],M[i][k]);
Angle[1] = WWMath::Atan2_Legacy(sy,M[i][i]);
Angle[2] = WWMath::Atan2_Legacy(M[j][i],-M[k][i]);
Angle[0] = WWMath::Atan2(M[i][j],M[i][k]);
Angle[1] = WWMath::Atan2(sy,M[i][i]);
Angle[2] = WWMath::Atan2(M[j][i],-M[k][i]);

} else {

Angle[0] = WWMath::Atan2_Legacy(-M[j][k],M[j][j]);
Angle[1] = WWMath::Atan2_Legacy(sy,M[i][i]);
Angle[0] = WWMath::Atan2(-M[j][k],M[j][j]);
Angle[1] = WWMath::Atan2(sy,M[i][i]);
Angle[2] = 0.0;
}

} else {

double cy = WWMath::Sqrt(M[i][i]*M[i][i] + M[j][i]*M[j][i]);
float cy = WWMath::Sqrt(M[i][i]*M[i][i] + M[j][i]*M[j][i]);

if (cy > 16*FLT_EPSILON) {

Angle[0] = WWMath::Atan2_Legacy(M[k][j],M[k][k]);
Angle[1] = WWMath::Atan2_Legacy(-M[k][i],cy);
Angle[2] = WWMath::Atan2_Legacy(M[j][i],M[i][i]);
Angle[0] = WWMath::Atan2(M[k][j],M[k][k]);
Angle[1] = WWMath::Atan2(-M[k][i],cy);
Angle[2] = WWMath::Atan2(M[j][i],M[i][i]);

} else {

Angle[0] = WWMath::Atan2_Legacy(-M[j][k],M[j][j]);
Angle[1] = WWMath::Atan2_Legacy(-M[k][i],cy);
Angle[0] = WWMath::Atan2(-M[j][k],M[j][j]);
Angle[1] = WWMath::Atan2(-M[k][i],cy);
Angle[2] = 0;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Core/Libraries/Source/WWVegas/WWMath/matrix3.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ WWINLINE Matrix3x3& Matrix3x3::operator /= (float d)
WWINLINE float Matrix3x3::Get_X_Rotation() const
{
Vector3 v = (*this) * Vector3(0.0,1.0,0.0);
return WWMath::Atan2_Legacy(v[2], v[1]);
return WWMath::Atan2(v[2], v[1]);
}

/***********************************************************************************************
Expand All @@ -607,7 +607,7 @@ WWINLINE float Matrix3x3::Get_X_Rotation() const
WWINLINE float Matrix3x3::Get_Y_Rotation() const
{
Vector3 v = (*this) * Vector3(0.0,0.0,1.0);
return WWMath::Atan2_Legacy(v[0],v[2]);
return WWMath::Atan2(v[0],v[2]);
}

/***********************************************************************************************
Expand All @@ -625,7 +625,7 @@ WWINLINE float Matrix3x3::Get_Y_Rotation() const
WWINLINE float Matrix3x3::Get_Z_Rotation() const
{
Vector3 v = (*this) * Vector3(1.0,0.0,0.0);
return WWMath::Atan2_Legacy(v[1],v[0]);
return WWMath::Atan2(v[1],v[0]);
}

WWINLINE Vector3 Matrix3x3::Get_X_Vector() const
Expand Down
8 changes: 4 additions & 4 deletions Core/Libraries/Source/WWVegas/WWMath/matrix3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void Matrix3D::Set_Rotation(const Quaternion & q)
*=============================================================================================*/
float Matrix3D::Get_X_Rotation() const
{
return WWMath::Atan2_Legacy(Row[2][1], Row[1][1]);
return WWMath::Atan2(Row[2][1], Row[1][1]);
}


Expand All @@ -266,7 +266,7 @@ float Matrix3D::Get_X_Rotation() const
*=============================================================================================*/
float Matrix3D::Get_Y_Rotation() const
{
return WWMath::Atan2_Legacy(Row[0][2], Row[2][2]);
return WWMath::Atan2(Row[0][2], Row[2][2]);
}


Expand All @@ -284,7 +284,7 @@ float Matrix3D::Get_Y_Rotation() const
*=============================================================================================*/
float Matrix3D::Get_Z_Rotation() const
{
return WWMath::Atan2_Legacy(Row[1][0], Row[0][0]);
return WWMath::Atan2(Row[1][0], Row[0][0]);
}


Expand Down Expand Up @@ -372,7 +372,7 @@ void Matrix3D::Look_At_Dir(const Vector3 &pos, const Vector3 &dir, float roll)
float dz = dir.Z;

// length of projection onto XY plane
float len2 = (float)WWMath::Sqrt_Legacy(dx*dx + dy*dy);
float len2 = (float)WWMath::Sqrt(dx*dx + dy*dy);

// pitch
sinp = dz;
Expand Down
12 changes: 6 additions & 6 deletions Core/Libraries/Source/WWVegas/WWMath/quat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Quaternion Trackball(float x0, float y0, float x1, float y1, float sphsize)
// Avoid problems with out of control values
if (t > 1.0f) t = 1.0f;
if (t < -1.0f) t = -1.0f;
phi = 2.0f * WWMath::Asin_Legacy(t);
phi = 2.0f * WWMath::Asin(t);

return Axis_To_Quat(a, phi);
}
Expand Down Expand Up @@ -324,7 +324,7 @@ void __cdecl Fast_Slerp(Quaternion& res, const Quaternion & p,const Quaternion &
// ----------------------------------------------------------------------------
// normal slerp!
// else {
// theta = WWMath::Acos_Legacy(cos_t);
// theta = WWMath::Acos(cos_t);
// sin_t = WWMath::Sinf_Legacy(theta);
// oo_sin_t = 1.0 / sin_t;
// beta = WWMath::Sinf_Legacy(theta - alpha*theta) * oo_sin_t;
Expand Down Expand Up @@ -512,7 +512,7 @@ void Slerp(Quaternion& res, const Quaternion & p,const Quaternion & q,float alph
} else {

// normal slerp!
theta = WWMath::Acos_Legacy(cos_t);
theta = WWMath::Acos(cos_t);
float sin_t = WWMath::Sinf_Legacy(theta);
oo_sin_t = 1.0f / sin_t;
beta = WWMath::Sinf_Legacy(theta - alpha*theta) * oo_sin_t;
Expand Down Expand Up @@ -567,7 +567,7 @@ void Slerp_Setup(const Quaternion & p,const Quaternion & q,SlerpInfoStruct * sle
} else {

slerpinfo->Linear = false;
slerpinfo->Theta = WWMath::Acos_Legacy(cos_t);
slerpinfo->Theta = WWMath::Acos(cos_t);
slerpinfo->SinT = WWMath::Sinf_Legacy(slerpinfo->Theta);

}
Expand Down Expand Up @@ -868,10 +868,10 @@ float project_to_sphere(float r, float x, float y)
{
const float SQRT2 = 1.41421356f;
float t, z;
float d = WWMath::Sqrt_Legacy(x * x + y * y);
float d = WWMath::Sqrt(x * x + y * y);

if (d < r * (SQRT2/(2.0f))) // inside sphere
z = WWMath::Sqrt_Legacy(r * r - d * d);
z = WWMath::Sqrt(r * r - d * d);
else { // on hyperbola
t = r / SQRT2;
z = t * t / d;
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWMath/quat.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Quaternion
WWINLINE float Length2() const { return (X*X + Y*Y + Z*Z + W*W); }

// Magnitude of the quaternion
WWINLINE float Length() const { return WWMath::Sqrt_Legacy(Length2()); }
WWINLINE float Length() const { return WWMath::Sqrt(Length2()); }

// Make the quaternion unit length
void Normalize();
Expand Down
4 changes: 2 additions & 2 deletions Core/Libraries/Source/WWVegas/WWMath/vector2.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ WWINLINE Vector2 Normalize(const Vector2 & vec)
*========================================================================*/
WWINLINE float Vector2::Length() const
{
return (float)WWMath::Sqrt_Legacy(Length2());
return (float)WWMath::Sqrt(Length2());
}

/**************************************************************************
Expand Down Expand Up @@ -638,7 +638,7 @@ WWINLINE float Distance(float x1, float y1, float x2, float y2)
float x_diff = x1 - x2;
float y_diff = y1 - y2;

return (WWMath::Sqrt_Legacy((x_diff * x_diff) + (y_diff * y_diff)));
return (WWMath::Sqrt((x_diff * x_diff) + (y_diff * y_diff)));
}


Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWMath/vector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ WWINLINE Vector3 Normalize(const Vector3 & vec)
*========================================================================*/
WWINLINE float Vector3::Length() const
{
return WWMath::Sqrt_Legacy(Length2());
return WWMath::Sqrt(Length2());
}

/**************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WWMath/vector4.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ WWINLINE Vector4 Normalize(const Vector4 & vec)
*========================================================================*/
WWINLINE float Vector4::Length() const
{
return WWMath::Sqrt_Legacy(Length2());
return WWMath::Sqrt(Length2());
}

/**************************************************************************
Expand Down
10 changes: 5 additions & 5 deletions Core/Libraries/Source/WWVegas/WWMath/vehiclecurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ Find_Tangent
// Determine the offset angle (from the line between the point and center)
// where the 2 tangent points lie.
//
float angle_offset = WWMath::Acos_Legacy (radius / dist);
float base_angle = WWMath::Atan2_Legacy (delta_x, -delta_y);
float angle_offset = WWMath::Acos (radius / dist);
float base_angle = WWMath::Atan2 (delta_x, -delta_y);
base_angle = WWMath::Wrap (base_angle, 0, DEG_TO_RADF (360));

//
Expand Down Expand Up @@ -185,10 +185,10 @@ Find_Turn_Arc
// the point halfway between the angles formed by the (prev-curr) and
// (next-curr) vectors.
//
float angle1 = ::WWMath::Atan2_Legacy ((prev_pt.Y - curr_pt.Y), prev_pt.X - curr_pt.X);
float angle1 = ::WWMath::Atan2 ((prev_pt.Y - curr_pt.Y), prev_pt.X - curr_pt.X);
angle1 = WWMath::Wrap (angle1, 0, DEG_TO_RADF (360));

float angle2 = ::WWMath::Atan2_Legacy ((next_pt.Y - curr_pt.Y), next_pt.X - curr_pt.X);
float angle2 = ::WWMath::Atan2 ((next_pt.Y - curr_pt.Y), next_pt.X - curr_pt.X);
angle2 = WWMath::Wrap (angle2, 0, DEG_TO_RADF (360));

float avg_angle = (angle1 + angle2) * 0.5F;
Expand Down Expand Up @@ -252,7 +252,7 @@ Find_Tangents
//
// Find the angle where the current position lies on the turn arc
//
(*point_angle) = ::WWMath::Atan2_Legacy (curr_pt.X - arc_center.X, -(curr_pt.Y - arc_center.Y));
(*point_angle) = ::WWMath::Atan2 (curr_pt.X - arc_center.X, -(curr_pt.Y - arc_center.Y));
(*point_angle) = WWMath::Wrap ((*point_angle), 0, DEG_TO_RADF (360));

//
Expand Down
Loading