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

#include <vdgl_ortho_regress.h>

Inheritance diagram for vdgl_ortho_regress:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void reset ()
 vdgl_ortho_regress ()
 ~vdgl_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 21 of file vdgl_ortho_regress.h.


Constructor & Destructor Documentation

vdgl_ortho_regress::vdgl_ortho_regress ( ) [inline]

Definition at line 34 of file vdgl_ortho_regress.h.

vdgl_ortho_regress::~vdgl_ortho_regress ( ) [inline]

Definition at line 36 of file vdgl_ortho_regress.h.


Member Function Documentation

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

Definition at line 38 of file vdgl_ortho_regress.h.

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

Definition at line 14 of file vdgl_ortho_regress.cxx.

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

Definition at line 19 of file vdgl_ortho_regress.cxx.

double vdgl_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 74 of file vdgl_ortho_regress.cxx.

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

Definition at line 58 of file vdgl_ortho_regress.h.

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

Definition at line 79 of file vdgl_ortho_regress.cxx.

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

Definition at line 60 of file vdgl_ortho_regress.h.

bool vdgl_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 106 of file vdgl_ortho_regress.cxx.

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

Definition at line 46 of file vdgl_ortho_regress.h.

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

Definition at line 28 of file vdgl_ortho_regress.h.

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

Definition at line 24 of file vdgl_ortho_regress.cxx.


Member Data Documentation

Definition at line 24 of file vdgl_ortho_regress.h.

Definition at line 25 of file vdgl_ortho_regress.h.

Definition at line 26 of file vdgl_ortho_regress.h.

Definition at line 26 of file vdgl_ortho_regress.h.

Definition at line 25 of file vdgl_ortho_regress.h.

Definition at line 26 of file vdgl_ortho_regress.h.


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