]> git.mxchange.org Git - simgear.git/blobdiff - simgear/math/leastsqs.hxx
Add a function to calculate the normalmap from a regular texture.
[simgear.git] / simgear / math / leastsqs.hxx
index 7c8e21d32aeeaf027129d163ddcae62817fedb59..2f994c65d2729b59611c324891b89727476191b7 100644 (file)
@@ -5,7 +5,7 @@
 
 // Written by Curtis Olson, started September 1997.
 //
-// Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
+// Copyright (C) 1997  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -42,12 +42,12 @@ Classical least squares fit:
 \f]
 
 \f[
-    b_1 = \frac{n * \sum_0^i (x_i*y_i) - \sum_0^i x_i* \sum_0^i y_i}
-          {n*\sum_0^i x_i^2 - (\sum_0^i x_i)^2}
+    b_1 = \frac{n * \sum_0^{i-1} (x_i*y_i) - \sum_0^{i-1} x_i* \sum_0^{i-1} y_i}
+          {n*\sum_0^{i-1} x_i^2 - (\sum_0^{i-1} x_i)^2}
 \f]
 
 \f[
-    b_0 = \frac{\sum_0^i y_i}{n} - b_1 * \frac{\sum_0^i x_i}{n}
+    b_0 = \frac{\sum_0^{i-1} y_i}{n} - b_1 * \frac{\sum_0^{i-1} x_i}{n}
 \f]
 */
 void least_squares(double *x, double *y, int n, double *m, double *b);