Public Member Functions | Public Attributes | Protected Member Functions
osl_ortho_regress Class Reference

#include <osl_ortho_regress.h>

Inheritance diagram for osl_ortho_regress:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void reset ()
 osl_ortho_regress ()
 ~osl_ortho_regress ()
void add_point (double x, double y)
void add_points (double const *, double const *, unsigned)
void add_points (float const *, float const *, unsigned)
void remove_point (double x, double y)
void remove_points (double const *, double const *, unsigned)
void remove_points (float const *, float const *, unsigned)
double cost (double a, double b, double c) const
 The problem is to minimize total squared distance to the line u.x + d = 0, ie.
double rms_cost (double a, double b, double c) const
bool fit (double *a, double *b, double *c) const
bool fit_constrained (double x, double y, double *a, double *b, double *c) const

Public Attributes

unsigned S1
double Sx
double Sy
double Sxx
double Sxy
double Syy

Protected Member Functions

bool fit (double &a, double &b, double &c) const
bool fit_constrained (double x, double y, double &a, double &b, double &c) const
 The problem is to minimize total squared distance from a line passing through a given point x_0 :

Detailed Description

Definition at line 25 of file osl_ortho_regress.h.


Constructor & Destructor Documentation

osl_ortho_regress::osl_ortho_regress ( ) [inline]

Definition at line 38 of file osl_ortho_regress.h.

osl_ortho_regress::~osl_ortho_regress ( ) [inline]

Definition at line 40 of file osl_ortho_regress.h.


Member Function Documentation

void osl_ortho_regress::add_point ( double  x,
double  y 
) [inline]

Definition at line 42 of file osl_ortho_regress.h.

void osl_ortho_regress::add_points ( double const *  x,
double const *  y,
unsigned  n 
)

Definition at line 15 of file osl_ortho_regress.cxx.

void osl_ortho_regress::add_points ( float const *  x,
float const *  y,
unsigned  n 
)

Definition at line 20 of file osl_ortho_regress.cxx.

double osl_ortho_regress::cost ( double  a,
double  b,
double  c 
) const

The problem is to minimize total squared distance to the line u.x + d = 0, ie.

: minimize | u.x_i + d |^2 subject to |u|=1

Writing x_i = xbar + y_i, where xbar is the centroid of the point set, the sum becomes | u.(x_i - xbar) |^2 + S1 | u.xbar + d |^2 , so that the optimal line must pass through the centroid. To find u, we find the eigenvector of the scatter matrix M = (x_i - xbar)*(x_i - xbar)^t which has least eigenvalue.

Definition at line 75 of file osl_ortho_regress.cxx.

bool osl_ortho_regress::fit ( double *  a,
double *  b,
double *  c 
) const [inline]

Definition at line 62 of file osl_ortho_regress.h.

bool osl_ortho_regress::fit ( double &  a,
double &  b,
double &  c 
) const [protected]

Definition at line 80 of file osl_ortho_regress.cxx.

bool osl_ortho_regress::fit_constrained ( double  x,
double  y,
double *  a,
double *  b,
double *  c 
) const [inline]

Definition at line 64 of file osl_ortho_regress.h.

bool osl_ortho_regress::fit_constrained ( double  x,
double  y,
double &  a,
double &  b,
double &  c 
) const [protected]

The problem is to minimize total squared distance from a line passing through a given point x_0 :

minimize | u.x_i + d |^2 subject to |u|=1 u.x_0 + d = 0

But u.x_i + d = u.(x_i - x_0), so that we have to minimize u^t M u , where M = (x_i - x_0)*(x_i - x_0)^t. This is solved by taking the eigenvector of M of least eigenvalue.

Definition at line 107 of file osl_ortho_regress.cxx.

void osl_ortho_regress::remove_point ( double  x,
double  y 
) [inline]

Definition at line 50 of file osl_ortho_regress.h.

void osl_ortho_regress::remove_points ( double const *  ,
double const *  ,
unsigned   
)
void osl_ortho_regress::remove_points ( float const *  ,
float const *  ,
unsigned   
)
void osl_ortho_regress::reset ( ) [inline]

Definition at line 32 of file osl_ortho_regress.h.

double osl_ortho_regress::rms_cost ( double  a,
double  b,
double  c 
) const

Definition at line 25 of file osl_ortho_regress.cxx.


Member Data Documentation

Definition at line 28 of file osl_ortho_regress.h.

Definition at line 29 of file osl_ortho_regress.h.

Definition at line 30 of file osl_ortho_regress.h.

Definition at line 30 of file osl_ortho_regress.h.

Definition at line 29 of file osl_ortho_regress.h.

Definition at line 30 of file osl_ortho_regress.h.


The documentation for this class was generated from the following files: