00001 /* LIBGUL - Geometry Utility Library 00002 * Copyright (C) 1998-1999 Norbert Irmer 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef CGUL_H 00021 #define CGUL_H 00022 00023 #if defined(__MINGW32__) || defined(_MSC_VER) 00024 #define GULDECL __declspec(dllimport) 00025 #define GULCALL __cdecl 00026 #define CCALL __cdecl 00027 #else 00028 #define GULDECL 00029 #define GULCALL 00030 #define CCALL 00031 #endif 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 /*------------------------------------------------------------------ 00038 data types 00039 -------------------------------------------------------------------*/ 00040 00041 typedef struct 00042 { 00043 double x,y,z; 00044 } 00045 GULpoint; 00046 00047 typedef struct 00048 { 00049 double x,y; 00050 } 00051 GULpoint2; 00052 00053 /*--------------------------------------------------------------------- 00054 with this function you can change the functions which are used for 00055 malloc/free of return arrays (for example necessary when using 'dbg_malloc' 00056 in the application, since in the dll the normal malloc is used) 00057 ----------------------------------------------------------------------*/ 00058 00059 GULDECL void GULCALL GUL_set_malloc_func( void *(CCALL *func)(size_t) ); 00060 GULDECL void GULCALL GUL_set_free_func( void (CCALL *func)(void *) ); 00061 00062 /*-------------------------------------------------------------------*//** 00063 executes the MBA algorithm and constructs a 3-dimensional surface 00064 from the results (x,y are linear mappings of u and v ). 00065 when 'minimize' is set, the base rectangle in the xy-plane is 00066 chosen so that its area is minimal 00067 00068 input arrays: 00069 00070 datPoints : array of data-points 00071 StdDevs : standard deviations of the data points (if useStdDevs = 0, 00072 all assumed as beeing one) 00073 00074 output arrays are reserved by the function and have the dimensions: 00075 00076 retU : nu + pu + 2 00077 retV : nv + pv + 2 00078 retPw : nv + 1 00079 retPw[i] : nu + 1 (i=0,..,nv) 00080 */ 00081 /* ---------------------------------------------------------------------*/ 00082 00083 GULDECL void GULCALL GUL_SurfaceOverXYPlane( 00084 int nDatPoints, GULpoint *datPoints, 00085 int useStdDevs, double *StdDevs, 00086 int minimize, int nIter, 00087 int pu, int pv, 00088 int *ret_nu, double **retU, 00089 int *ret_nv, double **retV, 00090 GULpoint ***retPw ); 00091 00092 /*-------------------------------------------------------------------*//** 00093 creates a surface with the MBA algorithm. 'Dat' contains the 3d 00094 values and 'Dom' the locations in the parametric domain 00095 (output arrays are reserved automatically) */ 00096 /* ---------------------------------------------------------------------*/ 00097 GULDECL void GULCALL GUL_MBASurface( 00098 int nDatPoints, GULpoint *datPoints, GULpoint2 *domPoints, 00099 int nIter, int pu, int pv, 00100 int *ret_nu, double **retU, 00101 int *ret_nv, double **retV, 00102 GULpoint ***retPw ); 00103 00104 00105 /*------------------------------------------------------------------- 00106 Calculates a matrix wich transforms points given in a local coordinate 00107 system at a point 'B' into the world coordinate system. 00108 An additional point is required (both in world coordinates 00109 (=P) and local coordinates (=Pb)). 'Ab' must contain the coordinates 00110 of the origin in the local coordinate system at 'B'. 00111 Both coordinate systems must be orthonormal, and memory for 'T' (a 4x4 00112 matrix) must be reserved by the caller. 00113 -------------------------------------------------------------------*/ 00114 GULDECL void GULCALL GUL_CommonCoordinateSystem( 00115 GULpoint B, GULpoint P, GULpoint Ab, GULpoint Pb, 00116 double **T ); 00117 00118 00119 00120 #ifdef __cplusplus 00121 } 00122 #endif 00123 00124 #endif 00125