|
tesseract 3.04.01
|
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 00030 struct EDGEPT; 00031 00032 /*---------------------------------------------------------------------- 00033 M a c r o s 00034 ----------------------------------------------------------------------*/ 00035 /********************************************************************** 00036 * point_diff 00037 * 00038 * Return the difference from point (p1) to point (p2). Put the value 00039 * into point (p). 00040 **********************************************************************/ 00041 00042 #define point_diff(p,p1,p2) \ 00043 ((p).x = (p1).x - (p2).x, \ 00044 (p).y = (p1).y - (p2).y) 00045 00046 /********************************************************************** 00047 * CROSS 00048 * 00049 * cross product 00050 **********************************************************************/ 00051 00052 #define CROSS(a,b) \ 00053 ((a).x * (b).y - (a).y * (b).x) 00054 00055 /********************************************************************** 00056 * SCALAR 00057 * 00058 * scalar vector product 00059 **********************************************************************/ 00060 00061 #define SCALAR(a,b) \ 00062 ((a).x * (b).x + (a).y * (b).y) 00063 00064 /********************************************************************** 00065 * LENGTH 00066 * 00067 * length of vector 00068 **********************************************************************/ 00069 00070 #define LENGTH(a) \ 00071 ((a).x * (a).x + (a).y * (a).y) 00072 00073 /*---------------------------------------------------------------------- 00074 F u n c t i o n s 00075 ----------------------------------------------------------------------*/ 00076 int direction(EDGEPT *point); 00077 00078 #endif