eg2holef.h

Go to the documentation of this file.
00001 
00002 /* ///////////////////////////////////////////////////////////////////////// */
00003 /* This file is a part of the BSTools package                                */
00004 /* written by Przemyslaw Kiciak                                              */
00005 /* ///////////////////////////////////////////////////////////////////////// */
00006 /* (C) Copyright by Przemyslaw Kiciak, 2005, 2010                            */
00007 /* this package is distributed under the terms of the                        */
00008 /* Lesser GNU Public License, see the file COPYING.LIB                       */
00009 /* ///////////////////////////////////////////////////////////////////////// */
00010 
00011 /* this header file is for application use */
00012 
00013 #ifndef EG2HOLEF_H
00014 #define EG2HOLEF_H
00015 
00016 #ifndef EGHOLEF_H
00017 #include "egholef.h"
00018 #endif
00019 
00020 #ifdef __cplusplus   
00021 extern "C" {
00022 #endif
00023 
00024 #ifndef CONST_  /* a dirty trick to suppress many compiler warning messages */
00025 #define CONST_ const
00026 #endif
00027 
00028 #define G2H_FINALDEG  9
00029 
00030 #define G2H_OMCDEG 7  /* degree of common boundary curves */
00031 
00032 /* the following constants are related with the spline basis */
00033 #define G2H_S_MAX_NK  4
00034 #define G2H_S_MAX_M1  3
00035 #define G2H_S_MAX_M2  7
00036 
00037 /* ///////////////////////////////////////////////////////////////////////// */
00038 /* Below are the possible queries and answers for the option procedure. */
00039 /* It is always safe to return the "default" answer with no data. */
00040 
00041 #define G2H_DEFAULT                    0 /* default answer for all queries */
00042 
00043 #define G2HQUERY_CENTRAL_POINT         1
00044 #define G2H_CENTRAL_POINT_ALT          1
00045 #define G2H_CENTRAL_POINT_GIVEN        2
00046 
00047 #define G2HQUERY_CENTRAL_DERIVATIVES1  2
00048 #define G2H_CENRTAL_DERIVATIVES1_ALT   1
00049 #define G2H_CENTRAL_DERIVATIVES1_GIVEN 2
00050 
00051 #define G2HQUERY_DOMAIN_CURVES         3
00052 #define G2H_DOMAIN_CURVES_DEG4         1
00053 
00054 #define G2HQUERY_BASIS                 4
00055 #define G2H_USE_RESTRICTED_BASIS       1
00056 
00057 #define G2HQUERY_QUADRATURE            5
00058 #define G2H_QUADRATURE_GAUSS_LEGENDRE  1
00059 
00060 /* ///////////////////////////////////////////////////////////////////////// */
00061 /* core procedures */
00062 
00063 void g2h_SetOptionProcf ( GHoleDomainf *domain,
00064     int (*OptionProc)( GHoleDomainf *domain, int query, int qn,
00065                        int *ndata, int **idata, float **fdata ) );
00066 
00067 boolean g2h_ComputeBasisf ( GHoleDomainf *domain );
00068 
00069 boolean g2h_ComputeFormMatrixf ( GHoleDomainf *domain );
00070 boolean g2h_DecomposeMatrixf ( GHoleDomainf *domain );
00071 boolean g2h_FillHolef ( GHoleDomainf *domain,
00072                         int spdimen, CONST_ float *hole_cp,
00073                         float *acoeff, void *usrptr,
00074                         void (*outpatch) ( int n, int m, const float *cp,
00075                                            void *usrptr ) );
00076 
00077 boolean g2h_ComputeExtFormMatrixf ( GHoleDomainf *domain );
00078 boolean g2h_DecomposeExtMatrixf ( GHoleDomainf *domain );
00079 boolean g2h_ExtFillHolef ( GHoleDomainf *domain,
00080                            int spdimen, CONST_ float *hole_cp,
00081                            float *acoeff, void *usrptr,
00082                            void (*outpatch) ( int n, int m, const float *cp,
00083                                               void *usrptr ) );
00084 
00085 int g2h_V0SpaceDimf ( GHoleDomainf *domain );
00086 int g2h_ExtV0SpaceDimf ( GHoleDomainf *domain );
00087 boolean g2h_GetBPDerivativesf ( GHoleDomainf *domain, int cno, float *val );
00088 boolean g2h_GetBFuncPatchf ( GHoleDomainf *domain, int fn, int pn, float *bp );
00089 
00090 boolean g2h_SetConstraintMatrixf ( GHoleDomainf *domain,
00091                                    int nconstr, const float *cmat );
00092 boolean g2h_FillHoleConstrf ( GHoleDomainf *domain,
00093                               int spdimen, CONST_ float *hole_cp,
00094                               int nconstr, CONST_ float *constr,
00095                               float *acoeff, void *usrptr,
00096                               void (*outpatch) ( int n, int m, const float *cp,
00097                                                  void *usrptr ) );
00098 
00099 boolean g2h_SetAltConstraintMatrixf ( GHoleDomainf *domain, int spdimen,
00100                                       int nconstr, const float *cmat );
00101 boolean g2h_FillHoleAltConstrf ( GHoleDomainf *domain,
00102                               int spdimen, CONST_ float *hole_cp,
00103                               int naconstr, CONST_ float *constr,
00104                               float *acoeff, void *usrptr,
00105                               void (*outpatch) ( int n, int m, const float *cp,
00106                                                  void *usrptr ) );
00107 
00108 boolean g2h_SetExtConstraintMatrixf ( GHoleDomainf *domain,
00109                                       int nconstr, const float *cmat );
00110 boolean g2h_ExtFillHoleConstrf ( GHoleDomainf *domain,
00111                          int spdimen, CONST_ float *hole_cp,
00112                          int nconstr, CONST_ float *constr,
00113                          float *acoeff, void *usrptr,
00114                          void (*outpatch) ( int n, int m, const float *cp,
00115                                             void *usrptr ) );
00116 
00117 boolean g2h_SetExtAltConstraintMatrixf ( GHoleDomainf *domain, int spdimen,
00118                                       int naconstr, const float *acmat );
00119 boolean g2h_ExtFillHoleAltConstrf ( GHoleDomainf *domain,
00120                          int spdimen, CONST_ float *hole_cp,
00121                          int naconstr, CONST_ float *constr,
00122                          float *acoeff, void *usrptr,
00123                          void (*outpatch) ( int n, int m, const float *cp,
00124                                             void *usrptr ) );
00125 
00126 float g2h_FunctionalValuef ( GHoleDomainf *domain, int spdimen,
00127                              CONST_ float *hole_cp, CONST_ float *acoeff );
00128 float g2h_ExtFunctionalValuef ( GHoleDomainf *domain, int spdimen,
00129                                 CONST_ float *hole_cp, CONST_ float *acoeff );
00130 boolean g2h_NLFunctionalValuef ( GHoleDomainf *domain,   
00131                                  const point3f *hole_cp, const vector3f *acoeff,
00132                                  float *funcval );
00133 boolean g2h_NLExtFunctionalValuef ( GHoleDomainf *domain,
00134                                     const point3f *hole_cp, const vector3f *acoeff,
00135                                     float *funcval );
00136 
00137 /* ///////////////////////////////////////////////////////////////////////// */
00138 boolean g2h_ComputeNLNormalf ( GHoleDomainf *domain, 
00139                                const point3f *hole_cp,
00140                                vector3f *anv );
00141 
00142 boolean g2h_NLFillHolef ( GHoleDomainf *domain, const point3f *hole_cp,
00143                           float *acoeff, void *usrptr,
00144                           void (*outpatch) ( int n, int m, const point3f *cp,
00145                                              void *usrptr ) );
00146 boolean g2h_NLFillHoleConstrf ( GHoleDomainf *domain, const point3f *hole_cp,   
00147                     int nconstr, const vector3f *constr,
00148                     float *acoeff, void *usrptr,
00149                     void (*outpatch) ( int n, int m, const point3f *cp,
00150                                        void *usrptr ) );
00151 boolean g2h_NLFillHoleAltConstrf ( GHoleDomainf *domain, const point3f *hole_cp,
00152                     int nconstr, const float *constr,
00153                     float *acoeff, void *usrptr,
00154                     void (*outpatch) ( int n, int m, const point3f *cp,
00155                                        void *usrptr ) );
00156 
00157 boolean g2h_NLExtFillHolef ( GHoleDomainf *domain, const point3f *hole_cp,
00158                              float *acoeff, void *usrptr,
00159                              void (*outpatch) ( int n, int m, const point3f *cp,
00160                                                 void *usrptr ) );
00161 boolean g2h_NLExtFillHoleConstrf ( GHoleDomainf *domain,
00162                      const point3f *hole_cp,
00163                      int nconstr, const vector3f *constr,
00164                      float *acoeff, void *usrptr,
00165                      void (*outpatch) ( int n, int m, const point3f *cp,
00166                                         void *usrptr ) );
00167 boolean g2h_NLExtFillHoleAltConstrf ( GHoleDomainf *domain, const point3f *hole_cp,
00168                          int naconstr, const float *constr,
00169                          float *acoeff, void *usrptr,
00170                          void (*outpatch) ( int n, int m, const point3f *cp,
00171                                             void *usrptr ) ); 
00172 
00173 boolean g2h_NLSplFillHolef ( GHoleDomainf *domain, const point3f *hole_cp,
00174                      float *acoeff, void *usrptr,
00175                      void (*outpatch) ( int n, int lknu, const float *knu,
00176                                         int m, int lknv, const float *knv,
00177                                         const point3f *cp, void *usrptr ) );
00178 boolean g2h_NLSplFillHoleConstrf ( GHoleDomainf *domain, const point3f *hole_cp,
00179                      int nconstr, const vector3f *constr,
00180                      float *acoeff, void *usrptr,
00181                      void (*outpatch) ( int n, int lknu, const float *knu,
00182                                         int m, int lknv, const float *knv,
00183                                         const point3f *cp, void *usrptr ) );
00184 boolean g2h_NLSplFillHoleAltConstrf ( GHoleDomainf *domain, const point3f *hole_cp,
00185                      int nconstr, const float *constr,
00186                      float *acoeff, void *usrptr,
00187                      void (*outpatch) ( int n, int lknu, const float *knu,
00188                                         int m, int lknv, const float *knv,
00189                                         const point3f *cp, void *usrptr ) );
00190 
00191 /* ///////////////////////////////////////////////////////////////////////// */
00192 boolean g2h_GetFinalPatchCurvesf ( GHoleDomainf *domain, int spdimen,
00193                                    CONST_ float *hole_cp, float *acoeff,
00194                                    void (*outcurve) ( int n, const float *cp ) );
00195 boolean g2h_GetExtFinalPatchCurvesf ( GHoleDomainf *domain, int spdimen,
00196                                       CONST_ float *hole_cp, float *acoeff,
00197                                       void (*outcurve) ( int n, const float *cp ) );
00198 boolean g2h_GetSplFinalPatchCurvesf ( GHoleDomainf *domain, int spdimen,
00199                                       CONST_ float *hole_cp, float *acoeff,
00200                                       void (*outcurve) ( int n, int lkn,
00201                                                const float *kn, const float *cp ) );
00202 
00203 /* ///////////////////////////////////////////////////////////////////////// */
00204 /* spline basis procedures */
00205 boolean g2h_ComputeSplBasisf ( GHoleDomainf *domain, int nk, int m1, int m2 );
00206 boolean g2h_ComputeSplFormMatrixf ( GHoleDomainf *domain );
00207 boolean g2h_DecomposeSplMatrixf ( GHoleDomainf *domain );
00208 boolean g2h_SplFillHolef ( GHoleDomainf *domain,
00209                int spdimen, CONST_ float *hole_cp,
00210                float *acoeff, void *usrptr,
00211                void (*outpatch) ( int n, int lknu, const float *knu,
00212                                   int m, int lknv, const float *knv,            
00213                                   const float *cp, void *usrptr ) );
00214 
00215 int g2h_SplV0SpaceDimf ( GHoleDomainf *domain );
00216 boolean g2h_SetSplConstraintMatrixf ( GHoleDomainf *domain,
00217                                       int nconstr, const float *cmat );
00218 boolean g2h_SplFillHoleConstrf ( GHoleDomainf *domain,
00219                int spdimen, CONST_ float *hole_cp,
00220                int nconstr, CONST_ float *constr,
00221                float *acoeff, void *usrptr,
00222                void (*outpatch) ( int n, int lknu, const float *knu,
00223                                   int m, int lknv, const float *knv,
00224                                   const float *cp, void *usrptr ) );
00225 
00226 boolean g2h_SetSplAltConstraintMatrixf ( GHoleDomainf *domain, int spdimen,
00227                                          int naconstr, const float *acmat );
00228 boolean g2h_SplFillHoleAltConstrf ( GHoleDomainf *domain,
00229                int spdimen, CONST_ float *hole_cp,
00230                int naconstr, CONST_ float *constr,
00231                float *acoeff, void *usrptr,
00232                void (*outpatch) ( int n, int lknu, const float *knu,
00233                                   int m, int lknv, const float *knv,
00234                                   const float *cp, void *usrptr ) );
00235 
00236 /* ///////////////////////////////////////////////////////////////////////// */
00237 /* drawing procedures */
00238 void g2h_DrawDomAuxPatchesf ( GHoleDomainf *domain,
00239                void (*drawpatch) ( int n, int m, const point2f *cp ) );
00240 void g2h_DrawBasAuxPatchesf ( GHoleDomainf *domain, int fn,
00241                void (*drawpatch) ( int n, int m, const float *cp ) );
00242 void g2h_DrawJFunctionf ( GHoleDomainf *domain, int k, int l,
00243                           void (*drawpoly) ( int deg, const float *f ) );
00244 void g2h_DrawDiPatchesf ( GHoleDomainf *domain,
00245                       void (*drawpatch) ( int n, int m, const point2f *cp ) );
00246 void g2h_ExtractPartitionf ( GHoleDomainf *domain,
00247                              int *hole_k, int *hole_m,
00248                              float *partition,
00249                              float *part_delta,
00250                              float *spart_alpha,
00251                              float *spart_malpha,
00252                              float *spart_salpha,
00253                              float *spart_knot,
00254                              float *alpha0,
00255                              boolean *spart_sgn,
00256                              boolean *spart_both );
00257 void g2h_ExtractCentralPointf ( GHoleDomainf *domain,
00258                                 point2f *centp, vector2f *centder );
00259 void g2h_DrawBasAFunctionf ( GHoleDomainf *domain, int fn,
00260                void (*drawpatch) ( int n, int m, const point3f *cp ) );
00261 void g2h_DrawBasBFunctionf ( GHoleDomainf *domain, int fn,
00262                void (*drawpatch) ( int n, int m, const point3f *cp ) );
00263 void g2h_DrawBasCNetf ( GHoleDomainf *domain, int fn,
00264                void (*drawnet) ( int n, int m, const point3f *cp ) );
00265 void g2h_DrawBFAomcf ( GHoleDomainf *domain, int fn, 
00266                        void (*drawpoly)(int degree, const float *coeff) );
00267 void g2h_DrawBFBomcf ( GHoleDomainf *domain, int fn,
00268                        void (*drawpoly)(int degree, const float *coeff) );
00269 void g2h_DrawFinalSurfBCf ( GHoleDomainf *domain,   
00270                             int spdimen, const float *hole_cp,
00271                             const float *acoeff, 
00272                             void (*drawcurve)(int degree, int spdimen,
00273                                               const float *cp) );
00274 void g2h_ExtDrawFinalSurfBCf ( GHoleDomainf *domain,
00275                                int spdimen, const float *hole_cp,
00276                                const float *acoeff, 
00277                                void (*drawcurve)(int degree, int spdimen,
00278                                                  const float *cp) );
00279 void g2h_DrawMatricesf ( GHoleDomainf *domain,
00280                          void (*drawmatrix)(int nfa, int nfb,
00281                                             float *amat, float *bmat) );
00282 void g2h_DrawExtMatricesf ( GHoleDomainf *domain,
00283                             void (*drawmatrix)(int k, int r, int s,
00284                                                float *Aii, float *Bi) );
00285 int g2h_DrawBFcpnf ( int hole_k, unsigned char *bfcpn );
00286 
00287 boolean g2h_GetABasisFPatchCurvef ( GHoleDomainf *domain, int fn, int i,
00288                                     float *bfpc );
00289 boolean g2h_GetBBasisFPatchCurvef ( GHoleDomainf *domain, int fn, int i,
00290                                     float *bfpc );
00291 
00292 /* ///////////////////////////////////////////////////////////////////////// */
00293 /* spline basis drawing procedures */
00294 void g2h_DrawSplBasFuncNumf ( GHoleDomainf *domain,
00295                         int *nfunc_a, int *nfunc_b, int *nfunc_c, int *nfunc_d );
00296 
00297 void g2h_DrawSplBasAuxPatchesf ( GHoleDomainf *domain, int fn,
00298                void (*drawpatch) ( int n, int lknu, const float *knu,
00299                                    int m, int lknv, const float *knv,
00300                                    const point3f *cp ) );
00301 
00302 void g2h_DrawSplBasFunctionf ( GHoleDomainf *domain, int fn,
00303              void (*drawpatch) ( int n, int lknu, const float *knu,
00304                                  int m, int lknv, const float *knv,
00305                                  const point3f *cp ) );
00306 
00307 void g2h_DrawSplBFAomcf ( GHoleDomainf *domain, int fn,
00308                           void (*drawpoly)(int degree, int lastknot,
00309                                            const float *knots,
00310                                            const float *coeff) );
00311 void g2h_DrawSplBFBomcf ( GHoleDomainf *domain, int fn,
00312                           void (*drawpoly)(int degree, int lastknot,
00313                                            const float *knots,
00314                                            const float *coeff) );
00315 void g2h_DrawSplBFDomcf ( GHoleDomainf *domain, int fn,
00316                           void (*drawpoly)(int degree, int lastknot,
00317                                            const float *knots,
00318                                            const float *coeff) );
00319 void g2h_DrawSplFinalSurfBCf ( GHoleDomainf *domain,
00320                                int spdimen, const float *hole_cp,
00321                                const float *acoeff,
00322                                void (*drawcurve)(int degree, int spdimen,
00323                                              int lastknot, const float *knots,
00324                                              const float *cp) );
00325 
00326 void g2h_DrawSplMatricesf ( GHoleDomainf *domain,
00327                             void (*drawmatrix)( int k, int r, int s, int t,
00328                                                 float *A, float *B ) );
00329 
00330 boolean g2h_GetSplABasisFPatchCurvef ( GHoleDomainf *domain, int fn, int i,
00331                                        int *lkn, float *kn, float *bfpc );
00332 boolean g2h_GetSplBBasisFPatchCurvef ( GHoleDomainf *domain, int fn, int i,
00333                                        int *lkn, float *kn, float *bfpc );
00334 boolean g2h_GetSplDBasisFPatchCurvef ( GHoleDomainf *domain, int fn, int i,
00335                                        int *lkn, float *kn, float *bfpc );
00336 
00337 /* ///////////////////////////////////////////////////////////////////////// */
00338 int g2h_SymPatchMatrixSize ( int hole_k );
00339 boolean g2h_GetSymPatchMatrixf ( GHoleDomainf *domain, float *patchmatrix );
00340 boolean g2h_GetExtSymPatchMatrixf ( GHoleDomainf *domain, float *patchmatrix );
00341 boolean g2h_MatrixFillSymHolef ( int hole_k, const float *patchmatrix,
00342                                  int spdimen, const float *hole_cp, void *usrptr,
00343                                  void (*outpatch) ( int n, int m, const float *cp,
00344                                                     void *usrptr ) );
00345 /* ///////////////////////////////////////////////////////////////////////// */
00346 int g2h_GetErrorCodef ( GHoleDomainf *domain, char **ErrorString );
00347 
00348 #ifdef __cplusplus
00349 }
00350 #endif
00351 
00352 #endif
00353