RIT VEXU Core API
Toggle main menu visibility
Loading...
Searching...
No Matches
math_util.h
1
#pragma once
2
#include "Eigen/Dense"
3
#include "core/utils/geometry.h"
4
#include "math.h"
5
#include "vex.h"
6
#include <vector>
7
#include "core/utils/math/geometry/translation2d.h"
8
16
double
clamp(
double
value,
double
low,
double
high);
17
24
double
lerp(
double
a,
double
b,
double
t);
31
double
sign(
double
x);
32
33
double
wrap_angle_deg(
double
input);
34
double
wrap_angle_rad(
double
input);
35
36
/*
37
Calculates the variance of a set of numbers (needed for linear regression)
38
https://en.wikipedia.org/wiki/Variance
39
@param values the values for which the variance is taken
40
@param mean the average of values
41
*/
42
double
variance(std::vector<double>
const
&values,
double
mean);
43
44
/*
45
Calculates the average of a vector of doubles
46
@param values the list of values for which the average is taken
47
*/
48
double
mean(std::vector<double>
const
&values);
49
50
/*
51
Calculates the covariance of a set of points (needed for linear regression)
52
https://en.wikipedia.org/wiki/Covariance
53
54
@param points the points for which the covariance is taken
55
@param meanx the mean value of all x coordinates in points
56
@param meany the mean value of all y coordinates in points
57
*/
58
double
covariance(std::vector<std::pair<double, double>>
const
&points,
double
meanx,
double
meany);
59
60
/*
61
Calculates the slope and y intercept of the line of best fit for the data
62
@param points the points for the data
63
*/
64
std::pair<double, double> calculate_linear_regression(std::vector<std::pair<double, double>>
const
&points);
65
66
double
estimate_path_length(
const
std::vector<Translation2d> &points);
include
core
utils
math_util.h
Generated by
1.17.0