core
vnl
algo
vnl_fit_parabola.h
Go to the documentation of this file.
1
// This is core/vnl/algo/vnl_fit_parabola.h
2
#ifndef vnl_fit_parabola_h_
3
#define vnl_fit_parabola_h_
4
5
//:
6
// \file
7
// \brief Function to fit a parabola to three point to predict the centre line
8
// \author Tim Cootes
9
// \date Feb 2007
10
//
11
// \verbatim
12
// Modifications
13
// \endverbatim
14
15
//: Fit a parabola so as to estimate the position of the centre line
16
// The centre (maxima or minima) lies at xb + p/q.
17
// If q is near zero, then the parabola is nearly flat
18
inline
void
vnl_fit_parabola
(
double
xa,
double
xb,
double
xc,
19
double
fa,
double
fb,
double
fc,
20
double
& p,
double
& q)
21
{
22
// Effectively shift origin to (xb,fb)
23
// Parabola is then y=a*x*x+b*x
24
// Centre is then at -b/2a = p/q in the following
25
double
x1=xa-xb, f1 = fa-fb;
26
double
x2=xc-xb, f2 = fc-fb;
27
p = x2*x2*f1-x1*x1*f2;
28
q = 2*(x2*f1-x1*f2);
29
}
30
31
#endif // vnl_fit_parabola_h_
vnl_fit_parabola
void vnl_fit_parabola(double xa, double xb, double xc, double fa, double fb, double fc, double &p, double &q)
Fit a parabola so as to estimate the position of the centre line.
Definition:
vnl_fit_parabola.h:18
Generated by
1.8.15