Skip to content
Draft
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
4 changes: 2 additions & 2 deletions src/Misc/DynamicPatcher/Helpers/CircleDifferentiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

std::vector<CoordStruct> CircleDifferentiator::DivideArcByTolerance(const CoordStruct& center, int radius, int tolerance, const Vector3D<float>& upVector)
{
tolerance = MinImpl(tolerance, (int)(Math::SQRT_TWO) * radius));
tolerance = MinImpl(tolerance, (int)(Math::SQRT_TWO * radius));

// start from nearest count n that satisfy: d = sqrt(2) * r * sin(a) <= tolerance, a = 2 * pi / n
double maxRad = Math::asin(tolerance / (Math::SQRT_TWO) * radius));
double maxRad = Math::asin(tolerance / (Math::SQRT_TWO * radius));
int n = (int)(Math::TWO_BY_PI / maxRad);

// find n that satisfy d <= length, d = sqrt(2) * r * sin(a), a = 2 * pi / n
Expand Down
2 changes: 1 addition & 1 deletion src/Misc/Hooks.Otamaa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7426,7 +7426,7 @@ class NOVTABLE FakeIonBlastClass : public IonBlastClass
const float uz = deltax * sinA - deltay * cosA;
const float uy = deltaz;

float proj = Math::sqrtux * ux + uz * uz + uy * uy);
float proj = Math::sqrt(ux * ux + uz * uz + uy * uy);
const float align = cosA * ux - sinA * proj;

if (Math::abs(align - deltax) > 0.0002f || Math::abs(cosA * proj + sinA * ux - deltay) > 0.0002f)
Expand Down
44 changes: 22 additions & 22 deletions src/Phobos.Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ struct PhobosMath
return std::atan2(a1, a2);
}

static float __cdecl cosd(double a1)
static double __cdecl cosd(double a1)
{
return (float)std::cos(a1);
return std::cos(a1);
}

static float __cdecl sind(double a1)
static double __cdecl sind(double a1)
{
return (float)std::sin(a1);
return std::sin(a1);
}

static float __cdecl sqrtd(double a1)
static double __cdecl sqrtd(double a1)
{
return (float)std::sqrt(a1);
return std::sqrt(a1);
}

static double __cdecl tand(double a1)
Expand All @@ -44,43 +44,43 @@ struct PhobosMath
}

//===================================
static double __cdecl acosf(float a1)
static float __cdecl acosf(float a1)
{
return std::acos(a1);
return (float)std::acos(a1);
}

static double __stdcall asinf(float a1)
static float __cdecl asinf(float a1)
{
return std::asin(a1);
return (float)std::asin(a1);
}

static double __stdcall atanf(float a1)
static float __cdecl atanf(float a1)
{
return std::atan(a1);
return (float)std::atan(a1);
}

static double __stdcall atan2f(float a1, float a2)
static float __cdecl atan2f(float a1, float a2)
{
return std::atan2(a1, a2);
return (float)std::atan2(a1, a2);
}

static double __cdecl cosf(float a1)
static float __cdecl cosf(float a1)
{
return std::cos(a1);
return (float)std::cos(a1);
}

static double __cdecl sinf(float a1)
static float __cdecl sinf(float a1)
{
return std::sin(a1);
return (float)std::sin(a1);
}

static double __cdecl sqrtf(float a1)
static float __cdecl sqrtf(float a1)
{
return std::sqrt(a1);
return (float)std::sqrt(a1);
}

static double __cdecl tanf(float a1)
static float __cdecl tanf(float a1)
{
return std::tan(a1);
return (float)std::tan(a1);
}
};