/usr/include/ossim/base/ossimLeastSquaresPlane.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts (gpotts@imagelinks.com
//
// Description: Source code produced by Dave Knopp
//
//*******************************************************************
// $Id: ossimLeastSquaresPlane.h 23167 2015-02-24 22:07:14Z okramer $
#ifndef ossimLeastSquaresPlane_INCLUDE
#define ossimLeastSquaresPlane_INCLUDE
#include <ossim/base/ossimConstants.h>
#include <ossim/matrix/newmat.h>
/**
* @brief Provide 2D Least Squares Plane model fitting
* The math model is that of a plane of the form:
@code
z(x,y) = ax + b*y + c
@endcode
* The getLSParms() method returns parameter values which are the least
* squares solution associated with the samples added via addSample(). Note
* that it is necessary to add at least three sample to obtain a solution.
*/
class OSSIMDLLEXPORT ossimLeastSquaresPlane
{
public:
ossimLeastSquaresPlane(const ossimLeastSquaresPlane &);
/**
* Instantiate as zero surface.
*/
ossimLeastSquaresPlane();
ossimLeastSquaresPlane & operator = (const ossimLeastSquaresPlane &);
/**
* Free internal storage.
*/
virtual ~ossimLeastSquaresPlane();
/**
* Will clear everything and set it up to
* for another solve. Just add points
* and call the solve method.
*/
virtual void clear();
/**
* add a single data sample.
*
* @param x coordinate of sample location.
* @param y coordinate of sample location.
* @param zmea sample value measured at (x,y)
*/
virtual void addSample(double x, double y, double z_mea);
/**
* return LS solution parameters.
*
* @param pa set to x coefficient.
* @param pb set to y coefficient
* @param pc set to constant term
*/
virtual bool getLSParms(double& pa, double& pb, double& pc) const;
/**
* @param pa set to x coefficient.
* @param pb set to y coefficient
* @param pc set to constant term
*/
virtual void setLSParams(double pa, double pb, double pc);
/**
* interpolate LS-fit value at location (xx,yy) - returns z(xx,yy).
*
* @param xx "x" coordinate at which to interpolate.
* @param yy "y" "y" coordinate at which to interpolate.
*
*/
virtual inline double lsFitValue(double xx, double yy) const { return (m_a*xx + m_b*yy + m_c); }
/**
* compute least squares parameter solution - true if succesfull.
*/
bool solveLS();
private:
/**
* linear-X term.
*/
double m_a;
/**
* linear-Y term.
*/
double m_b;
/**
* constant term.
*/
double m_c;
/**
* Normal system coefficient matrix.
*/
NEWMAT::Matrix* AtA;
/**
* Normal system RHS vector
*/
NEWMAT::Matrix* Atb;
ossim_uint32 m_numSamples;
};
#endif
|