Tesseract  3.02
tesseract-ocr/ccstruct/vecfuncs.h
Go to the documentation of this file.
00001 /* -*-C-*-
00002  ********************************************************************************
00003  *
00004  * File:        vecfuncs.h  (Formerly vecfuncs.h)
00005  * Description:  Vector calculations
00006  * Author:       Mark Seaman, OCR Technology
00007  * Created:      Wed Dec 20 09:37:18 1989
00008  * Modified:     Tue Jul  9 17:44:37 1991 (Mark Seaman) marks@hpgrlt
00009  * Language:     C
00010  * Package:      N/A
00011  * Status:       Experimental (Do Not Distribute)
00012  *
00013  * (c) Copyright 1989, Hewlett-Packard Company.
00014  ** Licensed under the Apache License, Version 2.0 (the "License");
00015  ** you may not use this file except in compliance with the License.
00016  ** You may obtain a copy of the License at
00017  ** http://www.apache.org/licenses/LICENSE-2.0
00018  ** Unless required by applicable law or agreed to in writing, software
00019  ** distributed under the License is distributed on an "AS IS" BASIS,
00020  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00021  ** See the License for the specific language governing permissions and
00022  ** limitations under the License.
00023  *
00024  *********************************************************************************/
00025 #ifndef VECFUNCS_H
00026 #define VECFUNCS_H
00027 
00028 #include <math.h>
00029 #include "blobs.h"
00030 
00031 class EDGEPT;
00032 
00033 /*----------------------------------------------------------------------
00034               M a c r o s
00035 ----------------------------------------------------------------------*/
00036 /**********************************************************************
00037  * point_diff
00038  *
00039  * Return the difference from point (p1) to point (p2).  Put the value
00040  * into point (p).
00041  **********************************************************************/
00042 
00043 #define point_diff(p,p1,p2)  \
00044 ((p).x = (p1).x - (p2).x,        \
00045         (p).y = (p1).y - (p2).y,        \
00046         (p))
00047 
00048 /**********************************************************************
00049  * CROSS
00050  *
00051  * cross product
00052  **********************************************************************/
00053 
00054 #define CROSS(a,b) \
00055 ((a).x * (b).y - (a).y * (b).x)
00056 
00057 /**********************************************************************
00058  * SCALAR
00059  *
00060  * scalar vector product
00061  **********************************************************************/
00062 
00063 #define SCALAR(a,b) \
00064 ((a).x * (b).x + (a).y * (b).y)
00065 
00066 /**********************************************************************
00067  * LENGTH
00068  *
00069  * length of vector
00070  **********************************************************************/
00071 
00072 #define LENGTH(a) \
00073 ((a).x * (a).x + (a).y * (a).y)
00074 
00075 /*----------------------------------------------------------------------
00076               F u n c t i o n s
00077 ----------------------------------------------------------------------*/
00078 int direction(EDGEPT *point); 
00079 
00080 #endif