mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpiutil] Deprecate wpi::math constants in favor of wpi::numbers (#3383)
The constants were moved from std::math to std::numbers before ratification in C++20.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
#include <wpi/math>
|
||||
#include <wpi/numbers>
|
||||
|
||||
#include "glass/Context.h"
|
||||
#include "glass/DataSource.h"
|
||||
@@ -55,11 +55,11 @@ void glass::DisplayDrive(DriveModel* m) {
|
||||
draw->AddTriangleFilled(
|
||||
arrowPos,
|
||||
arrowPos + ImRotate(ImVec2(0.0f, 7.5f),
|
||||
std::cos(angle + wpi::math::pi / 4),
|
||||
std::sin(angle + wpi::math::pi / 4)),
|
||||
std::cos(angle + wpi::numbers::pi / 4),
|
||||
std::sin(angle + wpi::numbers::pi / 4)),
|
||||
arrowPos + ImRotate(ImVec2(0.0f, 7.5f),
|
||||
std::cos(angle - wpi::math::pi / 4),
|
||||
std::sin(angle - wpi::math::pi / 4)),
|
||||
std::cos(angle - wpi::numbers::pi / 4),
|
||||
std::sin(angle - wpi::numbers::pi / 4)),
|
||||
color);
|
||||
};
|
||||
|
||||
@@ -88,20 +88,21 @@ void glass::DisplayDrive(DriveModel* m) {
|
||||
if (rotation != 0) {
|
||||
float radius = 60.0f;
|
||||
double a1 = 0.0;
|
||||
double a2 = wpi::math::pi / 2 * rotation;
|
||||
double a2 = wpi::numbers::pi / 2 * rotation;
|
||||
|
||||
draw->PathArcTo(center, radius, a1, a2, 20);
|
||||
draw->PathStroke(color, false);
|
||||
draw->PathArcTo(center, radius, a1 + wpi::math::pi, a2 + wpi::math::pi, 20);
|
||||
draw->PathArcTo(center, radius, a1 + wpi::numbers::pi,
|
||||
a2 + wpi::numbers::pi, 20);
|
||||
draw->PathStroke(color, false);
|
||||
|
||||
double adder = rotation < 0 ? wpi::math::pi : 0;
|
||||
double adder = rotation < 0 ? wpi::numbers::pi : 0;
|
||||
|
||||
auto arrowPos =
|
||||
center + ImVec2(radius * -std::cos(a2), radius * -std::sin(a2));
|
||||
drawArrow(arrowPos, a2 + adder);
|
||||
|
||||
a2 += wpi::math::pi;
|
||||
a2 += wpi::numbers::pi;
|
||||
arrowPos = center + ImVec2(radius * -std::cos(a2), radius * -std::sin(a2));
|
||||
drawArrow(arrowPos, a2 + adder);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user