59 total_weight += weight;
62 sigxx +=
x *
x * weight;
63 sigxy +=
x *
y * weight;
64 sigyy +=
y *
y * weight;
68 total_weight += other.total_weight;
83 if (total_weight <= 0.0) {
104 return covar / x_var;
117 if (total_weight > 0.0) {
118 return (sigy -
m * sigx) / total_weight;
133 if (total_weight > 0) {
134 error = sigyy +
m * (
m * sigxx + 2 * (
c * sigx - sigxy)) +
c * (total_weight *
c - 2 * sigy);
136 error = std::sqrt(error / total_weight);
158 if (var_product > 0.0) {
159 r = covar / std::sqrt(var_product);
167 if (total_weight > 0.0) {
168 return FCOORD(sigx / total_weight, sigy / total_weight);
170 return FCOORD(0.0f, 0.0f);
254 double theta = 0.5 * atan2(2.0 * covar, x_var - y_var);
255 FCOORD result(cos(theta), sin(theta));
constexpr ERRCODE EMPTY_LLSQ("Can't delete from an empty LLSQ")
void add(double x, double y)
void remove(double x, double y)
double covariance() const
double x_variance() const
double rms_orth(const FCOORD &dir) const
FCOORD mean_point() const
double rms(double m, double c) const
double y_variance() const
FCOORD vector_fit() const
bool normalise()
Convert to unit vec.
void error(const char *caller, TessErrorLogCode action, const char *format,...) const __attribute__((format(gnu_printf