41103C 26/27
Documentation for 41103C 1/3 for the 2026/2027 Vex V5 Season Override
Toggle main menu visibility
Loading...
Searching...
No Matches
helpers.hpp
1
#pragma once
2
#include <string>
3
#include <sstream>
4
#include <cstdint>
5
#include <cmath>
6
#include <iostream>
7
8
typedef
uint8_t pros_adi_port;
9
typedef
int8_t pros_standard_port;
10
typedef
void (*SimpleCallback)();
11
12
template
<
typename
T>
13
std::string to_string(T value)
14
{
15
std::ostringstream os;
16
os << value;
17
return
os.str();
18
}
19
20
class
Vector2 {
21
public
:
22
float
X;
23
float
Y;
24
25
Vector2(
void
);
26
Vector2(
float
x,
float
y);
27
28
Vector2 operator+(
const
Vector2& other);
29
Vector2 operator-(
const
Vector2& other);
30
Vector2 operator*(
const
float
& other);
31
Vector2 operator/(
const
float
& other);
32
Vector2 operator=(
const
Vector2& other);
33
34
Vector2 operator+=(
const
Vector2& other);
35
Vector2 operator-=(
const
Vector2& other);
36
Vector2 operator*=(
const
float
& other);
37
Vector2 operator/=(
const
float
& other);
38
39
// Unary minus
40
Vector2 operator-();
41
42
43
float
MagSquared(
void
);
44
float
Mag(
void
);
45
float
DistanceSquared(Vector2 other);
46
float
Distance(Vector2 other);
47
48
float
Dot(Vector2 other);
49
float
Cross2(Vector2 other);
50
51
static
float
Arg(Vector2 vec);
52
static
float
ArgD(Vector2 vec);
// Pls don't use, try always use rads
53
54
float
AngleBetween(Vector2 vec);
55
56
std::string ToString(
void
);
57
};
58
59
const
float
IN_TO_MM = 2.54f;
60
const
float
MM_TO_IN = 1 / IN_TO_MM;
61
62
const
float
PI = 3.142f;
63
const
float
SQRT2 = 1.414f;
64
65
const
float
MILLISECONDS_TO_SECONDS = 0.001f;
66
const
float
SECONDS_TO_MILLISECONDS = 1000.0f;
67
68
const
float
sin90 = 1.0f;
69
const
float
cos90 = 0.0f;
70
71
float
Clamp(
float
value,
float
low,
float
high);
72
float
FloatModulus(
float
value,
float
moduland);
73
bool
Within(
float
value,
float
target,
float
plusMinus);
74
float
SignedHeadingDifference(
float
value,
float
target);
75
bool
WithinHeading(
float
value,
float
target,
float
plusMinus);
include
helpers.hpp
Generated by
1.17.0