Tesseract  3.02
Go to the documentation of this file.
```00001 /**********************************************************************
00003  * Description: Code for the QUAD_COEFFS class.
00004  * Author:              Ray Smith
00005  * Created:             Tue Oct 08 17:24:40 BST 1991
00006  *
00007  * (C) Copyright 1991, Hewlett-Packard Ltd.
00009  ** you may not use this file except in compliance with the License.
00010  ** You may obtain a copy of the License at
00012  ** Unless required by applicable law or agreed to in writing, software
00014  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  ** See the License for the specific language governing permissions and
00016  ** limitations under the License.
00017  *
00018  **********************************************************************/
00019
00022
00023 #include          "points.h"
00024
00026 {
00027   public:
00029     }                            //empty constructor
00031                 double xsq,  //coefficients
00032                 float x,
00033                 float constant) {
00034       a = xsq;
00035       b = x;
00036       c = constant;
00037     }
00038
00039     float y(                  //evaluate
00040             float x) const {  //at x
00041       return (float) ((a * x + b) * x + c);
00042     }
00043
00044     void move(               // reposition word
00045               ICOORD vec) {  // by vector
00046       /************************************************************
00047         y - q = a (x - p)^2 + b (x - p) + c
00048         y - q = ax^2 - 2apx + ap^2 + bx - bp + c
00049           y = ax^2 + (b - 2ap)x + (c - bp + ap^2 + q)
00050       ************************************************************/
00051       inT16 p = vec.x ();
00052       inT16 q = vec.y ();
00053
00054       c = (float) (c - b * p + a * p * p + q);
00055       b = (float) (b - 2 * a * p);
00056     }
00057
00058     double a;                    //x squared
00059     float b;                     //x
00060     float c;                     //constant
00061   private:
00062 };
00063 #endif
```