RIT VEXU Core API
Toggle main menu visibility
Loading...
Searching...
No Matches
util.h
1
#pragma once
2
3
#include "vex/vex.h"
4
#include "Eigen/Dense"
5
#include "core/math/geometry/translation2d.h"
6
7
#include <math.h>
8
#include <vector>
9
17
inline
constexpr
double
clamp(
double
value,
double
low,
double
high) {
18
return
(value < low) ? low : (value > high) ? high : value;
19
}
20
27
inline
constexpr
double
lerp(
double
a,
double
b,
double
t) {
28
return
a * (1.0 - t) + b * t;
29
}
30
37
inline
constexpr
double
sign(
double
x) {
38
return
(x > 0) - (x < 0);
39
}
40
47
double
variance(std::vector<double>
const
& values,
double
mean);
48
53
double
mean(std::vector<double>
const
& values);
54
62
double
covariance(std::vector<std::pair<double, double>>
const
& points,
double
meanx,
double
meany);
63
69
std::pair<double, double> calculate_linear_regression(
70
std::vector<std::pair<double, double>>
const
& points
71
);
72
73
double
estimate_path_length(
const
std::vector<Translation2d>& points);
include
core
math
util.h
Generated by
1.18.0