mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Update Circle.cpp
This commit is contained in:
parent
2fb0f851c0
commit
a36e85d9b7
@ -476,16 +476,16 @@ Array Circle::ToPointsArray(SQInteger num_segments) const
|
||||
if (i >= num_segments) return false;
|
||||
// Get the current angle
|
||||
#ifdef SQUSEDOUBLE
|
||||
SQFloat theta = 2.0d * SQMOD_PI64 * static_cast< SQFloat >(i) / static_cast< SQFloat >(num_segments);
|
||||
SQFloat theta = 2.0 * SQMOD_PI64 * static_cast< SQFloat >(i) / static_cast< SQFloat >(num_segments);
|
||||
#else
|
||||
SQFloat theta = 2.0f * SQMOD_PI * static_cast< SQFloat >(i) / static_cast< SQFloat >(num_segments);
|
||||
#endif // SQUSEDOUBLE
|
||||
// Calculate the x component
|
||||
SQFloat x = (rad * cosf(theta)) + pos.x;
|
||||
SQFloat x = (rad * SQMOD_DOUBLE_OR(cos, cosf)(theta)) + pos.x;
|
||||
// Calculate the y component
|
||||
SQFloat y = (rad * sinf(theta)) + pos.y;
|
||||
SQFloat y = (rad * SQMOD_DOUBLE_OR(sin, sinf)(theta)) + pos.y;
|
||||
// Push the Vector2 instance on the stack
|
||||
Var< Vector2 >::push(vm, Vector2{x, y});
|
||||
Var< Vector2 >::push(vm, Vector2{static_cast< Vector2::Value >(x), static_cast< Vector2::Value >(y)});
|
||||
// Insert the element on the stack into the array
|
||||
return true;
|
||||
}, num_segments);
|
||||
|
Loading…
Reference in New Issue
Block a user