RaidZeroLib
Coroutine robot framework for VEX V5
Toggle main menu visibility
Loading...
Searching...
No Matches
Math.hpp
1
#pragma once
2
#include <optional>
3
#include <utility>
4
5
#include "RaidZeroLib/api/Units/Units.hpp"
6
7
namespace
rz
{
8
14
template
<
typename
T>
15
[[nodiscard]]
constexpr
int
sgn
(T val)
noexcept
{
16
const
T zero = val * 0;
17
return
(zero < val) - (val < zero);
18
}
19
21
[[nodiscard]]
double
constrainAngle360
(
double
angle)
noexcept
;
22
24
[[nodiscard]]
double
constrainAngle180
(
double
angle)
noexcept
;
25
27
[[nodiscard]]
Angle
constrainAngle360
(
Angle
angle)
noexcept
;
28
30
[[nodiscard]]
Angle
constrainAngle180
(
Angle
angle)
noexcept
;
31
33
[[nodiscard]]
double
sinc
(
double
x)
noexcept
;
34
39
[[nodiscard]] std::optional<std::pair<double, double>>
quadraticFormula
(
double
a,
double
b,
double
c)
noexcept
;
40
41
}
// namespace rz
rz::Angle
au::QuantityD< au::Radians > Angle
Definition
Units.hpp:13
rz::constrainAngle180
double constrainAngle180(double angle) noexcept
Wraps an angle in degrees to [-180, 180).
rz::constrainAngle360
double constrainAngle360(double angle) noexcept
Wraps an angle in degrees to [0, 360).
rz::sinc
double sinc(double x) noexcept
sin(x) / x, numerically stable near zero.
rz::sgn
constexpr int sgn(T val) noexcept
Sign of a value: 1 if positive, -1 if negative, 0 if zero.
Definition
Math.hpp:15
rz::quadraticFormula
std::optional< std::pair< double, double > > quadraticFormula(double a, double b, double c) noexcept
Real roots of ax² + bx + c = 0, smallest first.
rz
Definition
DriverControl.hpp:11
RaidZeroLib
api
Utility
Math.hpp
Generated by
1.18.0