#include <linlsq.h>
Definition at line 26 of file linlsq.h.
◆ LLSQ()
◆ add() [1/3]
void LLSQ::add |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
◆ add() [2/3]
void LLSQ::add |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
weight |
|
) |
| |
Definition at line 58 of file linlsq.cpp.
59 total_weight += weight;
62 sigxx += x * x * weight;
63 sigxy += x * y * weight;
64 sigyy += y * y * weight;
◆ add() [3/3]
void LLSQ::add |
( |
const LLSQ & |
other | ) |
|
Definition at line 67 of file linlsq.cpp.
68 total_weight += other.total_weight;
◆ c()
double LLSQ::c |
( |
double |
m | ) |
const |
Definition at line 117 of file linlsq.cpp.
118 if (total_weight > 0.0)
119 return (sigy -
m * sigx) / total_weight;
◆ clear()
◆ count()
inT32 LLSQ::count |
( |
| ) |
const |
|
inline |
Definition at line 41 of file linlsq.h.
42 return static_cast<int>(total_weight + 0.5);
◆ covariance()
double LLSQ::covariance |
( |
| ) |
const |
|
inline |
Definition at line 73 of file linlsq.h.
74 if (total_weight > 0.0)
75 return (sigxy - sigx * sigy / total_weight) / total_weight;
◆ m()
Definition at line 101 of file linlsq.cpp.
105 return covar / x_var;
double covariance() const
double x_variance() const
◆ mean_point()
FCOORD LLSQ::mean_point |
( |
| ) |
const |
Definition at line 167 of file linlsq.cpp.
168 if (total_weight > 0.0) {
169 return FCOORD(sigx / total_weight, sigy / total_weight);
171 return FCOORD(0.0f, 0.0f);
◆ pearson()
double LLSQ::pearson |
( |
| ) |
const |
Definition at line 154 of file linlsq.cpp.
160 if (var_product > 0.0)
161 r = covar / sqrt(var_product);
double covariance() const
double y_variance() const
double x_variance() const
◆ remove()
void LLSQ::remove |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
Definition at line 83 of file linlsq.cpp.
84 if (total_weight <= 0.0)
void error(const char *caller, TessErrorLogCode action, const char *format,...) const
◆ rms()
double LLSQ::rms |
( |
double |
m, |
|
|
double |
c |
|
) |
| const |
Definition at line 131 of file linlsq.cpp.
134 if (total_weight > 0) {
135 error = sigyy +
m * (
m * sigxx + 2 * (
c * sigx - sigxy)) +
c *
136 (total_weight *
c - 2 * sigy);
138 error = sqrt(error / total_weight);
◆ rms_orth()
double LLSQ::rms_orth |
( |
const FCOORD & |
dir | ) |
const |
Definition at line 196 of file linlsq.cpp.
double covariance() const
double y_variance() const
bool normalise()
Convert to unit vec.
double x_variance() const
◆ vector_fit()
FCOORD LLSQ::vector_fit |
( |
| ) |
const |
Definition at line 252 of file linlsq.cpp.
256 double theta = 0.5 * atan2(2.0 * covar, x_var - y_var);
257 FCOORD result(cos(theta), sin(theta));
double covariance() const
double y_variance() const
double x_variance() const
◆ x_variance()
double LLSQ::x_variance |
( |
| ) |
const |
|
inline |
Definition at line 79 of file linlsq.h.
80 if (total_weight > 0.0)
81 return (sigxx - sigx * sigx / total_weight) / total_weight;
◆ y_variance()
double LLSQ::y_variance |
( |
| ) |
const |
|
inline |
Definition at line 85 of file linlsq.h.
86 if (total_weight > 0.0)
87 return (sigyy - sigy * sigy / total_weight) / total_weight;
The documentation for this class was generated from the following files: