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 "tessclas.h" 00029 #include <math.h> 00030 00031 /*---------------------------------------------------------------------- 00032 M a c r o s 00033 ----------------------------------------------------------------------*/ 00034 /********************************************************************** 00035 * point_diff 00036 * 00037 * Return the difference from point (p1) to point (p2). Put the value 00038 * into point (p). 00039 **********************************************************************/ 00040 00041 #define point_diff(p,p1,p2) \ 00042 ((p).x = (p1).x - (p2).x, \ 00043 (p).y = (p1).y - (p2).y, \ 00044 (p)) 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 /* 00079 #if defined(__STDC__) || defined(__cplusplus) || MAC_OR_DOS 00080 # define _ARGS(s) s 00081 #else 00082 # define _ARGS(s) () 00083 #endif*/ 00084 00085 /* vecfuncs.c 00086 int direction 00087 _ARGS((EDGEPT *point)); 00088 00089 #undef _ARGS 00090 */ 00091 #endif