mi32/transgen.h

Go to the documentation of this file.
00001 /**
00002  * \file transgen.h <mi32/transgen.h>
00003  * \brief Function prototypes and macros for TransGen functions
00004  *
00005  * \if NODOC
00006  * $Id: transgen.h_v 1.45 2003/09/15 13:49:56 fileserver!dwilliss Exp $
00007  *
00008  * $Log: transgen.h_v $
00009  * Revision 1.45  2003/09/15 13:49:56  fileserver!dwilliss
00010  * Doxygen
00011  *
00012  * Revision 1.44  2003/06/12 19:32:04  scowan
00013  * More const.
00014  *
00015  * Revision 1.43  2003/03/14 18:25:51  mju
00016  * Add SetMaxInsertVertices.
00017  *
00018  * Revision 1.42  2002/08/19 15:32:40  scowan
00019  * Fixed g++ 3.1 warning.
00020  *
00021  * Revision 1.41  2000/10/26 21:53:24  mju
00022  * Add default ctor for TRANSPARM.
00023  *
00024  * Revision 1.40  2000/10/26 21:46:48  mju
00025  * Disallow copy ctor / assignment for TRANSPARM.
00026  *
00027  * Revision 1.39  2000/09/05 13:14:45  mju
00028  * Fix default parm for TransGenIsFlipped().
00029  *
00030  * Revision 1.38  2000/09/01 20:18:19  msmith
00031  * Genitor documentation
00032  *
00033  * Revision 1.37  2000/08/03 13:44:39  mju
00034  * Use inlines instead of macros so will be documented by Genitor.
00035  *
00036  * Revision 1.36  1999/12/29 17:12:52  mju
00037  * Add TransGenIsFlipped().
00038  *
00039  * Revision 1.35  1999/05/19 17:19:03  mju
00040  * Add TransgenCopy().
00041  *
00042  * Revision 1.34  1999/05/07  21:25:37  mju
00043  * Hdr restruct.
00044  *
00045  * Revision 1.33  1999/04/29  22:07:57  mju
00046  * Move TRANSFUNC here.
00047  * Move Disect funcs here needing TRANSFUNC/TRANSPARM.
00048  *
00049  * Revision 1.32  1999/04/29  16:02:24  mju
00050  * Move TRANSPARM structure here.
00051  *
00052  * Revision 1.31  1999/04/28  17:41:38  mju
00053  * Include ctrlpt.h.
00054  *
00055  * Revision 1.30  1999/04/27  16:01:00  mju
00056  * Use "const" for more functions.
00057  *
00058  * Revision 1.29  1999/03/25  22:08:12  mju
00059  * Add GetInput/OutputModel.
00060  *
00061  * Revision 1.28  1999/03/17  15:42:32  mju
00062  * Use const for more "set" functions.
00063  *
00064  * Revision 1.27  1999/03/15  15:37:12  mju
00065  * Use const for Coord2DT funcs and FindBest funcs.
00066  *
00067  * Revision 1.26  1999/01/05  19:12:37  scowan
00068  * Swapped multiple keywords
00069  *
00070  * Revision 1.25  1998/10/26 18:26:37  mju
00071  * Add functions to set max error for point insertion.
00072  * Make SetDoInsert() a function instead of a macro.
00073  *
00074  * Revision 1.24  1998/08/28  16:43:49  scowan
00075  * geom dll update.
00076  *
00077  * Revision 1.23  1998/06/17  17:16:15  mju
00078  * Add GetInput/OutputProj().
00079  *
00080  * Revision 1.22  1997/10/22  16:31:32  mju
00081  * Add TransGenConvPointSet().
00082  *
00083  * Revision 1.21  1997/03/05  14:05:31  mju
00084  * Add TransGenGetInput/OutputTransAffine.
00085  *
00086  * Revision 1.20  1996/12/31  21:35:33  mju
00087  * Add TransGenSetAffineApprox().
00088  *
00089  * Revision 1.19  1996/12/20  16:37:34  coffee!dwilliss
00090  * Added __cplusplus things
00091  *
00092  * Revision 1.18  1996/10/01  16:20:59  scowan
00093  * Added TransGenIsInitialized.
00094  *
00095  * Revision 1.17  1996/08/21  00:29:32  mju
00096  * Change IsReversibleAll to IsReversible.
00097  *
00098  * Revision 1.16  1996/08/12  17:04:29  mju
00099  * Add TransGenConvPointMapToMap...
00100  *
00101  * Revision 1.15  1996/06/18  21:42:54  mju
00102  * Add prototype for TransGenSetExtrapOutside().
00103  *
00104  * Revision 1.14  1996/05/24  23:19:53  mju
00105  * Add TransGetGetAffineLocal() prototype.
00106  *
00107  * Revision 1.13  1996/05/21  16:27:18  mju
00108  * Add TRANSGENCOORD definitions.
00109  * Add TransGenGetPiece prototypes.
00110  *
00111  * Revision 1.12  1996/05/17  21:14:51  mju
00112  * Remove prototype for TransGenAllocPoints() as no longer available.
00113  *
00114  * Revision 1.11  1996/05/17  00:07:52  mju
00115  * Change some prototypes to "int" from "void".
00116  *
00117  * Revision 1.10  1996/05/16  00:20:10  mju
00118  * Add more prototypes.
00119  *
00120  * Revision 1.9  1996/05/15  19:48:50  mju
00121  * Add prototypes for TransGenTransFuncFwd/Inv.
00122  *
00123  * Revision 1.8  1996/05/14  21:21:24  mju
00124  * Add macros and function prototypes.
00125  *
00126  * Revision 1.7  1996/05/14  16:46:47  mju
00127  * Change API for TransGenSetXxxxTransCtrlPoint().
00128  *
00129  * Revision 1.6  1996/05/10  23:04:07  mju
00130  * Add TransGenCopyInputToOutput and CopyOutputToInput.
00131  *
00132  * Revision 1.5  1996/05/09  17:14:20  mju
00133  * Add additional function prototypes.
00134  *
00135  * Revision 1.4  1996/05/02  23:50:04  mju
00136  * Add TransGenSetupObjProjTrans().
00137  *
00138  * Revision 1.3  1996/05/02  16:44:12  mju
00139  * Add additional function prototypes.
00140  *
00141  * Revision 1.2  1995/04/14  21:16:31  mju
00142  * Fix prototypes for TransGenSet...ProjHandle.
00143  *
00144  * Revision 1.1  1995/04/14  17:03:14  mju
00145  * Initial revision
00146  *
00147  * \endif
00148 **/
00149 
00150 #ifndef  INC_MI32_TRANSGEN_H
00151 #define  INC_MI32_TRANSGEN_H
00152 
00153 #ifndef  INC_MI32_STDDEFNS_H
00154 #include <mi32/stddefns.h>
00155 #endif
00156 #ifndef INC_MI32_CTRLPT_H
00157 #include <mi32/ctrlpt.h>
00158 #endif
00159 
00160 #ifdef GEOMDLL
00161    #define GEOMLIBEXPORT MI_DLLEXPORT
00162 #else
00163    #define GEOMLIBEXPORT MI_DLLIMPORT
00164 #endif
00165 
00166 struct MAPPROJPARM;
00167 
00168 /* Prototype for generic transformation function */
00169 typedef int (*TRANSFUNC)(void*,void*,int,int,void*);
00170 
00171 /*----------------------------------------------------------------------------*/
00172 /*    TRANSPARM - Transformation parameters used by TransGen...() functions   */
00173 /*----------------------------------------------------------------------------*/
00174 
00175 struct TRANSPARM {
00176    // MEMBERS
00177    unsigned InitDone:1,          //!<  Set if has been initialized 
00178             IsAffineAll:1,       //!<  Set if entire transformation is affine, overrides all other flags 
00179             IsIdentityAll:1,     //!<  Set if entire transformation is identity 
00180             SameProj:1,          //!<  Set if input and output projections are the same (or either undefined) 
00181             IsReversible:1,      //!<  Set if transformation is reversible 
00182             DoGeneric:1,         //!<  Set if just do generic transformation 
00183             PrimaryDirInverse:1, //!<  Set if primary transformation direction is "inverse" 
00184             DoInsertPoints:1,    //!<  Set if should "insert" points in TransGenConvPoints...() 
00185             sparebits:24;
00186    Mat3x3 ItoO;            //!<  Input to Output transformation if IsAffineAll set 
00187    Mat3x3 OtoI;            //!<  Output to Input transformation if IsAffineAll set 
00188    TRANSFUNC GenTransFwd;  //!<  Generic transformation used if DoGeneric is set 
00189    TRANSFUNC GenTransInv;  //!<  Generic transformation used if DoGeneric is set 
00190    void *GenTransData;     //!<  Data for generic transformation function 
00191    void *internal;         //!<  Private data internal to TransGen toolkit 
00192    /* DO NOT CHANGE SIZE OF THIS STRUCTURE UNDER PENALTY OF ILLOP'S */
00193 
00194    //! Default constructor, performs no initialization.
00195    TRANSPARM (
00196       ) {
00197       }
00198 private:
00199    #ifndef GENERATING_DOXYGEN_OUTPUT
00200 
00201    //! UNSUPPORTED / UNIMPLEMENTED
00202    TRANSPARM (const TRANSPARM&);             //! Copy ctor
00203    TRANSPARM& operator= (const TRANSPARM&);  //! Assignment
00204    #endif // GENERATING_DOXYGEN_OUTPUT
00205    };
00206 
00207 #define  TRANSDIR_Forward  0
00208 #define  TRANSDIR_Inverse  1
00209 
00210 
00211 #define  TRANSGENCOORD_Input     0x00000001
00212 #define  TRANSGENCOORD_Output    0x00000002
00213 #define  TRANSGENCOORD_External  0x00000004
00214 #define  TRANSGENCOORD_Map       0x00000008
00215 
00216 
00217 #if defined(__cplusplus)
00218 extern "C" {
00219 #endif
00220 
00221 //! Disect a transformation into component parts (scale, rotation, shear).
00222 //!
00223 //! #include <mi32/geom2d.h>
00224 //! This function is used to compute the affine transformation parameters above at a given point for
00225 //! a general transformation function.
00226 GEOMLIBEXPORT int DisectGen2D (
00227    const DPOINT2D *point,              //!< Point to compute values at
00228    double size,                        //!< Size in source coodinates over which to compute (usually 1.0)
00229    double *xscale,                     //!< X scale at specified point returned
00230    double *yscale,                     //!< Y scale at specified point returned
00231    double *rotangle,                   //!< Rotation angle at specified point returned (radians)
00232    double *shearangle,                 //!< Shear angle at specified point returned (radians)
00233    TRANSFUNC transfunc,                //!< Transformation function to "disect"
00234    void *transfuncdata                 //!< "userdata' for transfunc
00235    );
00236 
00237 //! Transform single point from "input" to "output" coordinates.
00238 //!
00239 //! @return Error code < 0
00240 GEOMLIBEXPORT int TransGenConvPointFwd (
00241    const TRANSPARM *transparm,         //!< Transformation parameter structure
00242    const DPOINT2D *ipoint,             //!< Input point
00243    DPOINT2D *opoint                    //!< Converted point coordinates returned
00244    );
00245 
00246 //! Transform single point from "output" to "input" coordinates.
00247 //!
00248 //! @return Error code < 0
00249 GEOMLIBEXPORT int TransGenConvPointInv (
00250    const TRANSPARM *transparm,         //!< Transformation parameter structure
00251    const DPOINT2D *ipoint,             //!< Input point
00252    DPOINT2D *opoint                    //!< Converted point coordinates returned
00253    );
00254 
00255 //! Transform single point from "input" to map coordinates.
00256 //!
00257 //! @return Error code < 0
00258 GEOMLIBEXPORT int TransGenConvPointInputToMap (
00259    const TRANSPARM *transparm,         //!< Transformation parameter structure
00260    const DPOINT2D *ipoint,             //!< Input point
00261    DPOINT2D *opoint                    //!< Converted point coordinates returned
00262    );
00263 
00264 //! Transform single point from map to "input" coordinates.
00265 //!
00266 //! @return Error code < 0
00267 GEOMLIBEXPORT int TransGenConvPointMapToInput (
00268    const TRANSPARM *transparm,         //!< Transformation parameter structure
00269    const DPOINT2D *ipoint,             //!< Input point
00270    DPOINT2D *opoint                    //!< Converted point coordinates returned
00271    );
00272 
00273 //! Transform single point from input map coordinates to output map coordinates.
00274 //!
00275 //! @return Error code < 0
00276 GEOMLIBEXPORT int TransGenConvPointMapToMapFwd (
00277    const TRANSPARM *transparm,         //!< Transformation parameter structure
00278    const DPOINT2D *ipoint,             //!< Input point
00279    DPOINT2D *opoint                    //!< Converted point coordinates returned
00280    );
00281 
00282 //! Transform single point from output map coordinates to input map coordinates.
00283 //!
00284 //! @return Error code < 0
00285 GEOMLIBEXPORT int TransGenConvPointMapToMapInv (
00286    const TRANSPARM *transparm,         //!< Transformation parameter structure
00287    const DPOINT2D *ipoint,             //!< Input point
00288    DPOINT2D *opoint                    //!< Converted point coordinates returned
00289    );
00290 
00291 //! Transform single point from map to "output" coordinates.
00292 //!
00293 //! @return Error code < 0
00294 GEOMLIBEXPORT int TransGenConvPointMapToOutput (
00295    const TRANSPARM *transparm,         //!< Transformation parameter structure
00296    const DPOINT2D *ipoint,             //!< Input point
00297    DPOINT2D *opoint                    //!< Converted point coordinates returned
00298    );
00299 
00300 //! Transform single point from "output" to map coordinates.
00301 //!
00302 //! @return Error code < 0
00303 GEOMLIBEXPORT int TransGenConvPointOutputToMap (
00304    const TRANSPARM *transparm,         //!< Transformation parameter structure
00305    const DPOINT2D *ipoint,             //!< Input point
00306    DPOINT2D *opoint                    //!< Converted point coordinates returned
00307    );
00308 
00309 //! Transform N-dimensional point "set" from "input" to "output" coordinates.
00310 //!
00311 //! @return Error code < 0
00312 GEOMLIBEXPORT int TransGenConvPointSetFwd (
00313    const TRANSPARM *transparm,         //!< Transformation parameter structure
00314    const double *ipoint,               //!< Input point array
00315    INT32 iNumPoints,                   //!< Number of input points
00316    int NumDim,                         //!< Number of dimensions in point array (usually 2 or 3)
00317    double *opoint                      //!< Output point array
00318    );
00319 
00320 //! Transform N-dimensional point "set" from "output" to "input" coordinates.
00321 //!
00322 //! @return Error code < 0
00323 GEOMLIBEXPORT int TransGenConvPointSetInv (
00324    const TRANSPARM *transparm,         //!< Transformation parameter structure
00325    const double *ipoint,               //!< Input point array
00326    INT32 iNumPoints,                   //!< Number of input points
00327    int NumDim,                         //!< Number of dimensions in point array (usually 2 or 3)
00328    double *opoint                      //!< Output point array
00329    );
00330 
00331 //! Transform N-dimensional point array from "input" to "output" coordinates.
00332 //!
00333 //! @return Error code < 0
00334 //! This function returns a pointer to an internally allocated array.  Do not free this pointer.
00335 //! The internal array may be freed via TransGenFreeParm() or TransGenFreePoints().
00336 //! Note: The number of output points may be different than iNumPoints, if you want to transform the
00337 //! points one-to-one use TransGenConvPointSetFwd().
00338 GEOMLIBEXPORT int TransGenConvPointsFwd (
00339    const TRANSPARM *transparm,         //!< Transformation parameter structure
00340    const double *ipoint,               //!< Input point array
00341    INT32 iNumPoints,                   //!< Number of input points
00342    int NumDim,                         //!< Number of dimensions in point array (usually 2 or 3)
00343    double **opoint,                    //!< Output point array (pointer returned, DO NOT FREE)
00344    INT32*                              //! Number of output points returned
00345    );
00346 
00347 //! Transform N-dimensional point array from "output" to "input" coordinates.
00348 //!
00349 //! @return Error code < 0
00350 //! This function returns a pointer to an internally allocated array.  Do not free this pointer.
00351 //! The internal array may be freed via TransGenFreeParm() or TransGenFreePoints().
00352 //! Note: The number of output points may be different than iNumPoints, if you want to transform the
00353 //! points one-to-one use TransGenConvPointSetInv().
00354 GEOMLIBEXPORT int TransGenConvPointsInv (
00355    const TRANSPARM *transparm,         //!< Transformation parameter structure
00356    const double *ipoint,               //!< Input point array
00357    INT32 iNumPoints,                   //!< Number of input points
00358    int NumDim,                         //!< Number of dimensions in point array (usually 2 or 3)
00359    double **opoint,                    //!< Output point array (pointer returned, DO NOT FREE)
00360    INT32*                              //! Number of output points returned
00361    );
00362 
00363 //! Transform rectangle (DRECT2D) from "input" to "output" coordinates.
00364 //!
00365 //! @return Error code < 0
00366 GEOMLIBEXPORT int TransGenConvRectFwd (
00367    const TRANSPARM *transparm,         //!< Transformation parameter structure
00368    const DRECT2D *irect,               //!< Input rectangle to be translated
00369    DRECT2D *orect,                     //!< Output rectangle
00370    int sidepoints                      //!< Number of points per side of box if needed (0 for default)
00371    );
00372 
00373 //! Transform rectangle (DRECT2D) from "output" to "input" coordinates.
00374 //!
00375 //! @return Error code < 0
00376 GEOMLIBEXPORT int TransGenConvRectInv (
00377    const TRANSPARM *transparm,         //!< Transformation parameter structure
00378    const DRECT2D *irect,               //!< Input rectangle to be translated
00379    DRECT2D *orect,                     //!< Output rectangle
00380    int sidepoints                      //!< Number of points per side of box if needed (0 for default)
00381    );
00382 
00383 //! Copy one TRANSPARM to another
00384 //!
00385 //! @return Error code < 0
00386 GEOMLIBEXPORT int TransGenCopy (
00387    TRANSPARM *otp,                     //!< Output transformation parameter structure
00388    const TRANSPARM *itp                //!< Input transformation parameter structure
00389    );
00390 
00391 //! Copy "input parameters" from on TRANSPARM structure to another.
00392 //!
00393 //! @return Error code < 0
00394 GEOMLIBEXPORT int TransGenCopyInputParms (
00395    TRANSPARM *dtransparm,              //!< Destination transformation parameters
00396    const TRANSPARM *stransparm         //!< Source transformation parameters
00397    );
00398 
00399 //! Copy "input parameters" from one TRANSPARM to "output parameters" of another.
00400 //!
00401 //! @return Error code < 0
00402 GEOMLIBEXPORT int TransGenCopyInputToOutput (
00403    TRANSPARM *dtransparm,              //!< Destination transformation parameters
00404    const TRANSPARM *stransparm         //!< Source transformation parameters
00405    );
00406 
00407 //! Copy "output parameters" from one TRANSPARM to another.
00408 //!
00409 //! @return Error code < 0
00410 GEOMLIBEXPORT int TransGenCopyOutputParms (
00411    TRANSPARM *dtransparm,              //!< Destination transformation parameters
00412    const TRANSPARM *stransparm         //!< Source transformation parameters
00413    );
00414 
00415 //! Copy "output parameters" from one TRANSPARM to "input parameters" of another.
00416 //!
00417 //! @return Error code < 0
00418 GEOMLIBEXPORT int TransGenCopyOutputToInput (
00419    TRANSPARM *dtransparm,              //!< Destination transformation parameters
00420    const TRANSPARM *stransparm         //!< Source transformation parameters
00421    );
00422 
00423 //! Determine scale/rotation/shear at specified point for forward transformation.
00424 //!
00425 //! @return Error code < 0
00426 GEOMLIBEXPORT int TransGenDisectFwd (
00427    const TRANSPARM *transparm,         //!< Transformation parameter structure
00428    const DPOINT2D *point,              //!< Reference point at which values will be computed (NULL for 0,0)
00429    double size,                        //!< Size of area over which to compute values
00430    double *xscale,                     //!< X scale factor returned (NULL if don't need)
00431    double *yscale,                     //!< Y scale factor returned (NULL if don't need)
00432    double *rotangle,                   //!< Rotation angle returned in radians (NULL if don't need)
00433    double *shearangle                  //!< Shear angle returned in radians (NULL if don't need)
00434    );
00435 
00436 //! Determine scale/rotation/shear at specified point for inverse transformation.
00437 //!
00438 //! @return Error code < 0
00439 GEOMLIBEXPORT int TransGenDisectInv (
00440    const TRANSPARM *transparm,         //!< Transformation parameter structure
00441    const DPOINT2D *point,              //!< Reference point at which values will be computed (NULL for 0,0)
00442    double size,                        //!< Size of area over which to compute values
00443    double *xscale,                     //!< X scale factor returned (NULL if don't need)
00444    double *yscale,                     //!< Y scale factor returned (NULL if don't need)
00445    double *rotangle,                   //!< Rotation angle returned in radians (NULL if don't need)
00446    double *shearangle                  //!< Shear angle returned in radians (NULL if don't need)
00447    );
00448 
00449 //! Free all allocated entried in the TRANSPARM structure.
00450 //!
00451 //! @return nothing
00452 GEOMLIBEXPORT void TransGenFreeParm (
00453    TRANSPARM *transparm                //!< Transformation parameter structure
00454    );
00455 
00456 //! Free output point array in the TRANSPARM structure.
00457 //!
00458 //! @return nothing
00459 GEOMLIBEXPORT void TransGenFreePoints (
00460    TRANSPARM *transparm                //!< Transformation parameter structure
00461    );
00462 
00463 //! Get affine (Mat3x3) transformation if available.
00464 //!
00465 //! @return Error code < 0
00466 GEOMLIBEXPORT int TransGenGetAffine (
00467    const TRANSPARM *transparm,         //!< Transformation parameter structure
00468    MAT3X3 ItoO,                        //!< Input to output transformation returned (NULL if don't need)
00469    MAT3X3 OtoI                         //!< Output to input transformation returned (NULL if don't need)
00470    );
00471 
00472 //! Determine affine transformation at specified point.
00473 //!
00474 //! return Error code < 0
00475 //! The flags value determines if the specified point is in "input" or "output" coordinates.
00476 GEOMLIBEXPORT int TransGenGetAffineLocal (
00477    const TRANSPARM *transparm,         //!< Transformation parameter structure
00478    const DPOINT2D *point,              //!< Reference point at which values will be computed
00479    double size,                        //!< Size of area over which to compute values
00480    MAT3X3 ItoO,                        //!< Input to output transformation returned
00481    MAT3X3 OtoI,                        //!< Output to input transformation returned
00482    UINT32 flags                        //!< TRANSGENCOORD_Input or TRANSGENCOORD_Output
00483    );
00484 
00485 //! Get input transformation model.
00486 //!
00487 //! @return Transformation model
00488 GEOMLIBEXPORT UINT16 TransGenGetInputModel (
00489    const TRANSPARM *tp                 //!< Transformation parameter structure
00490    );
00491 
00492 //! Get "input projection parameters" from TRANSPARM.
00493 //!
00494 //! @return See below
00495 //! If a non-NULL value is passed for "projparm" then a pointer to this structure will be
00496 //! returned.  If NULL is passed for "projparm" then either NULL or a pointer to an internal
00497 //! projection parameter structure will be returned depending on whether a projection has
00498 //! previously been specified via TransGenSetInputProj() or TransGenSetInputProjHandle().
00499 //! It is therefore highly recommended that you pass a pointer to a structure to fill in.
00500 GEOMLIBEXPORT MAPPROJPARM * TransGenGetInputProj (
00501    const TRANSPARM *transparm,         //!< Transformation parameter structure
00502    MAPPROJPARM *projparm               //!< Projection parameter structure to fill in
00503    );
00504 
00505 //! Get input object-map affine transformation if possible.
00506 //!
00507 //! @return Error code < 0
00508 //! An error (EBadFuncParm) will be returned if the object-map transformation is not affine.
00509 GEOMLIBEXPORT int TransGenGetInputTransAffine (
00510    const TRANSPARM *transparm,         //!< Transformation parameter structure
00511    MAT3X3 ItoO,                        //!< Input to output transformation returned
00512    MAT3X3 OtoI                         //!< Output to input transformation returned
00513    );
00514 
00515 //! Get number of "pieces" for piecewise transformations.
00516 //!
00517 //! @return Number of "pieces"
00518 GEOMLIBEXPORT int TransGenGetNumPieces (
00519    const TRANSPARM *tp,                //!< Transformation parameter structure
00520    UINT32 flags
00521    );
00522 
00523 //! Get output transformation model.
00524 //!
00525 //! @return Transformation model
00526 GEOMLIBEXPORT UINT16 TransGenGetOutputModel (
00527    const TRANSPARM *tp                 //!< Transformation parameter structure
00528    );
00529 
00530 //! Get "output projection parameters" from TRANSPARM.
00531 //!
00532 //! @return See below
00533 //! If a non-NULL value is passed for "projparm" then a pointer to this structure will be
00534 //! returned.  If NULL is passed for "projparm" then either NULL or a pointer to an internal
00535 //! projection parameter structure will be returned depending on whether a projection has
00536 //! previously been specified via TransGenSetOutputProj() or TransGenSetOutputProjHandle().
00537 //! It is therefore highly recommended that you pass a pointer to a structure to fill in.
00538 GEOMLIBEXPORT MAPPROJPARM * TransGenGetOutputProj (
00539    const TRANSPARM *transparm,         //!< Transformation parameter structure
00540    MAPPROJPARM *projparm               //!< Projection parameter structure to fill in
00541    );
00542 
00543 //! Get outpu object-map affine transformation if possible.
00544 //!
00545 //! @return Error code < 0
00546 //! An error (EBadFuncParm) will be returned if the object-map transformation is not affine.
00547 GEOMLIBEXPORT int TransGenGetOutputTransAffine (
00548    const TRANSPARM *transparm,         //!< Transformation parameter structure
00549    MAT3X3 ItoO,                        //!< Input to output transformation returned
00550    MAT3X3 OtoI                         //!< Output to input transformation returned
00551    );
00552 
00553 //! Return array of points defining "piece" for piecewise transformation.
00554 //!
00555 //! @return Array of points
00556 GEOMLIBEXPORT int TransGenGetPiece (
00557    const TRANSPARM *tp,
00558    int piecenum,
00559    DPOINT2D **points,
00560    int *numpoints,
00561    UINT32 flags
00562    );
00563 
00564 //! Initialize TRANSPARM structure.
00565 //!
00566 //! @return Error code < 0
00567 GEOMLIBEXPORT int TransGenInit (
00568    TRANSPARM *transparm                //!< Transformation parameter structure
00569    );
00570 
00571 //! Determine if transformation is "affine".
00572 //!
00573 //! @return TRUE if transformation is affine, FALSE if not
00574 inline bool TransGenIsAffine (
00575    const TRANSPARM *transparm          //!< Transformation parameter structure
00576    ) {
00577    return (transparm->IsAffineAll != 0);
00578    }
00579 
00580 //! Determine if transformation results in change between right-hand and left-hand system.
00581 //!
00582 //! @return TRUE if transformation results in change, FALSE if not
00583 GEOMLIBEXPORT int TransGenIsFlipped (
00584    const TRANSPARM *tp,
00585    const DPOINT2D *pt,
00586    bool fwd = true
00587    );
00588 
00589 //! Determine if transformation has been "initialized".
00590 //!
00591 //! @return TRUE if transformation has been initialized, FALSE if not
00592 inline bool TransGenIsInitialized (
00593    const TRANSPARM *transparm          //!< Transformation parameter structure
00594    ) {
00595    return (transparm->InitDone != 0);
00596    }
00597 
00598 //! Determine if transformation is "identity".
00599 //!
00600 //! @return TRUE if transformation is identity, FALSE if not
00601 inline bool TransGenIsIdentity (
00602    const TRANSPARM *transparm          //!< Transformation parameter structure
00603    ) {
00604    return (transparm->IsIdentityAll != 0);
00605    }
00606 
00607 //! Determine if transformation is reversible.
00608 //!
00609 //! @return TRUE if transformation is reversible, FALSE if not
00610 inline bool TransGenIsReversible (
00611    const TRANSPARM *transparm          //!< Transformation parameter structure
00612    ) {
00613    return (transparm->IsReversible != 0);
00614    }
00615 
00616 //! Set full transformation to approximated affine if within tolerance.
00617 //!
00618 //! @return Error code < 0
00619 //! Flags:
00620 //!      TRANSGENCOORD_Output                Rectangle is in "output" coordinates (tolerance in "input" coordinates)
00621 GEOMLIBEXPORT int TransGenSetAffineApprox (
00622    TRANSPARM *transparm,               //!< Transformation parameter structure
00623    const DRECT2D *rect,                //!< Rectangle over which to compute approximation
00624    double tolerance,                   //!< Maximum displacement in opposite coordinates from "rect"
00625    UINT32 flags                        //!< Used to determine coordinates
00626    );
00627 
00628 //! Set whether to insert new points when doing TransGenConvPoints...().
00629 GEOMLIBEXPORT void TransGenSetDoInsert (
00630    TRANSPARM *transparm,               //!< Transformation parameter structure
00631    UINT8 doinsert                      //!< TRUE if point insertion is allowed, FALSE if not
00632    );
00633 
00634 //! Set whether or not to extrapolate points outside defined boundaries.
00635 //!
00636 //! If extrapolation is not enabled then an error -may- be returned for points outside the defined
00637 //! extents.  This is the default condition and will generally be much faster than extrapolating.
00638 GEOMLIBEXPORT void TransGenSetExtrapOutside (
00639    TRANSPARM *transparm,               //!< Transformation parameter structure
00640    UINT8 extrapoutside                 //!< TRUE if extrapolation desired, FALSE if not
00641    );
00642 
00643 //! Temporarily set full transformation to specified affine matrices.
00644 //!
00645 //! @return 0
00646 //! This will override the values set in the TRANSPARM structure until the next TransGenSet...()
00647 //! or TransGenUpdate() operation.
00648 GEOMLIBEXPORT int TransGenSetFullTransAffine (
00649    TRANSPARM *transparm,               //!< Transformation parameter structure
00650    const MAT3X3 ItoO,                        //!< Input to output transformation returned
00651    const MAT3X3 OtoI                         //!< Output to input transformation returned
00652    );
00653 
00654 //! Set boundaries for valid transformation in input coordinates.
00655 //!
00656 //! Using this function will ensure that all points within the specified rectangle will have a valid
00657 //! conversion for the forward transformation, assuming that their map coordinates are reasonable.
00658 //! Points outside the rectangle may or may not have a valid transformation depending on the type of
00659 //! transformation being performed.  This function is needed for some of the piecewise transformations
00660 //! which are defined by the convex hull of the defining control point mesh.
00661 GEOMLIBEXPORT ERRVALUE TransGenSetInputBound (
00662    TRANSPARM *transparm,               //!< Transformation parameter structure
00663    const DRECT2D *boundrect            //!< Bounding rectangle in input coordinates
00664    );
00665 
00666 //! Set maximum displacement for point insertion, input coordinates
00667 GEOMLIBEXPORT void TransGenSetInputInsertMaxError (
00668    TRANSPARM *transparm,               //!< Transformation parameter structure
00669    double MaxError                     //!< Max error
00670    );
00671 
00672 //! Set "input projection" in TRANSPARM structure.
00673 GEOMLIBEXPORT ERRVALUE TransGenSetInputProj (
00674    TRANSPARM *transparm,               //!< Transformation parameter structure
00675    const MAPPROJPARM *projparm         //!< Projection parameters (pass NULL if no projection)
00676    );
00677 
00678 //! Set "input projection" using given gctp handle (assumes handle is initialized).
00679 //!
00680 //! This makes a copy of the handle, so any subsequent changes to it will have no effect on the TRANSPARM
00681 GEOMLIBEXPORT ERRVALUE TransGenSetInputProjHandle (
00682    TRANSPARM *transparm,               //!< Transformation parameter structure
00683    void *gctphandle                    //!< CCTP handle (must have been initialized via gctpSetParm() already)
00684    );
00685 
00686 //! Set "input transformation" to specified affine matrices.
00687 //!
00688 //! @return 0
00689 GEOMLIBEXPORT int TransGenSetInputTransAffine (
00690    TRANSPARM *transparm,               //!< Transformation parameter structure
00691    const MAT3X3 ItoM,                  //!< Input to Map transformation matrix
00692    const MAT3X3 MtoI                   //!< Map to Input transformation matrix
00693    );
00694 
00695 //! Set "input transformation" using given control points and model.
00696 GEOMLIBEXPORT ERRVALUE TransGenSetInputTransCtrlPoint (
00697    TRANSPARM *transparm,               //!< Transformation parameter structure
00698    const CTRLPOINT3 *ctrlpoint,        //!< Control point array
00699    int NumPoints,                      //!< Number of control points
00700    UINT16 transmodel                   //!< Transformation model: TRANS2DMODEL_...
00701    );
00702 
00703 //! Set "input transformation" to identity (implied).
00704 //!
00705 //! @return 0
00706 GEOMLIBEXPORT int TransGenSetInputTransIdentity (
00707    TRANSPARM *transparm             //!< Transformation parameter structure
00708    );
00709 
00710 //! Set maximum number of vertices to insert between pair of points.
00711 //! Default maximum is 256.
00712 GEOMLIBEXPORT void TransGenSetMaxInsertVertices (
00713    TRANSPARM *transparm,            //!< Transformation parameter structure
00714    int MaxVertices                  //!< Maximum allowed vertices
00715    );
00716 
00717 //! Set boundaries for valid transformation in output coordinates.
00718 //!
00719 //! Using this function will ensure that all points within the specified rectangle will have a valid
00720 //! conversion for the inverse transformation, assuming that their map coordinates are reasonable.
00721 //! Points outside the rectangle may or may not have a valid transformation depending on the type of
00722 //! transformation being performed.  This function is needed for some of the piecewise transformations
00723 //! which are defined by the convex hull of the defining control point mesh.
00724 GEOMLIBEXPORT ERRVALUE TransGenSetOutputBound (
00725    TRANSPARM *transparm,               //!< Transformation parameter structure
00726    const DRECT2D *boundrect            //!< Bounding rectangle in input coordinates
00727    );
00728 
00729 //! Set maximum displacement for point insertion, output coordinates.
00730 GEOMLIBEXPORT void TransGenSetOutputInsertMaxError (
00731    TRANSPARM *transparm,               //!< Transformation parameter structure
00732    double MaxError                     //!< Max error
00733    );
00734 
00735 //! Set "output projection" in TRANSPARM structure.
00736 GEOMLIBEXPORT ERRVALUE TransGenSetOutputProj (
00737    TRANSPARM *transparm,               //!< Transformation parameter structure
00738    const MAPPROJPARM *projparm         //!< Projection parameters (pass NULL if no projection)
00739    );
00740 
00741 //! Set "output projection" using given gctp handle (assumes handle is initialized).
00742 GEOMLIBEXPORT ERRVALUE TransGenSetOutputProjHandle (
00743    TRANSPARM *transparm,               //!< Transformation parameter structure
00744    void *gctphandle                    //!< CCTP handle (must have been initialized via gctpSetParm() already)
00745    );
00746 
00747 //! Set "output transformation" to specified affine matrices.
00748 //!
00749 //! @return 0
00750 GEOMLIBEXPORT int TransGenSetOutputTransAffine (
00751    TRANSPARM *transparm,               //!< Transformation parameter structure
00752    const MAT3X3 OtoM,                  //!< Output to Map transformation matrix
00753    const MAT3X3 MtoO                   //!< Map to Output transformation matrix
00754    );
00755 
00756 //! Set "output transformation" using given control points and model.
00757 GEOMLIBEXPORT ERRVALUE TransGenSetOutputTransCtrlPoint (
00758    TRANSPARM *transparm,               //!< Transformation parameter structure
00759    const CTRLPOINT3 *ctrlpoint,        //!< Control point array
00760    int NumPoints,                      //!< Number of control points
00761    UINT16 transmodel                   //!< Transformation model: TRANS2DMODEL_...
00762    );
00763 
00764 //! Set "output transformation" to identity (implied).
00765 //!
00766 //! @return 0
00767 GEOMLIBEXPORT int TransGenSetOutputTransIdentity (
00768    TRANSPARM *transparm                //!< Transformation parameter structure
00769    );
00770 
00771 //! Set primary transformation direction.
00772 //! 
00773 //! The default transformation direction if not set explicitly is "forward".  This is used in
00774 //! cases where the time to do a reverse transformation is much higher than in the primary direction.
00775 //! This is commonly used for raster warping.
00776 GEOMLIBEXPORT void TransGenSetPrimaryDirection (
00777    TRANSPARM *transparm,               //!< Transformation parameter structure
00778    UINT8 directions                    //!< TRANSDIR_Forward or TRANSDIR_Inverse
00779    );
00780 
00781 //! Setup generic transformation between objects in different projections.
00782 GEOMLIBEXPORT ERRVALUE TransGenSetupObjProjTrans (
00783    TRANSPARM *transparm,               //!< Transformation parameter structure
00784    MAT3X3 AtoM,                        //!< Object A -> Map
00785    MAT3X3 MtoA,                        //!< Map -> Object A
00786    MAPPROJPARM *Aprojparm,             //!< Projection parameters for object A
00787    MAT3X3 BtoM,                        //!< Object B -> Map
00788    MAT3X3 MtoB,                        //!< Map -> Object B
00789    MAPPROJPARM *Bprojparm              //!< Projection parameters for object B
00790    );
00791 
00792 //! TRANSFUNC-style conversion function for forward transformation.
00793 //!
00794 //! This function is suitable for use in all functions which take a TRANSFUNC, including
00795 //! MfCopyObjectT(), MfCopySubObjectsT(), etc.  Pass a pointer to the appropriate TRANSPARM structure
00796 //! as the data associated with the TRANSFUNC.
00797 GEOMLIBEXPORT ERRVALUE TransGenTransFuncFwd (
00798    void *ipoint,
00799    void *opoint,
00800    int numpoints,
00801    int numdim,
00802    void *vtp
00803    );
00804 
00805 //! TRANSFUNC-style conversion function for inverse transformation.
00806 //!
00807 //! This function is suitable for use in all functions which take a TRANSFUNC, including
00808 //! MfCopyObjectT(), MfCopySubObjectsT(), etc.  Pass a pointer to the appropriate TRANSPARM structure
00809 //! as the data associated with the TRANSFUNC.
00810 GEOMLIBEXPORT ERRVALUE TransGenTransFuncInv (
00811    void *ipoint,
00812    void *opoint,
00813    int numpoints,
00814    int numdim,
00815    void *vtp
00816    );
00817 
00818 //! Update transformation after any changes and determine most efficient method.
00819 GEOMLIBEXPORT void TransGenUpdate (
00820    TRANSPARM *transparm                //!< Transformation parameter structure
00821    );
00822 
00823 #if defined(__cplusplus)
00824 }
00825 
00826 //! Disect a transformation into component parts (scale, rotation, shear).
00827 inline int DisectGen2D (
00828    const DPOINT2D_OLD *point,          //!< Point to compute values at
00829    double size,                        //!< Size in source coordinates over which to compute (usually 1.0)
00830    double *xscale,                     //!< X scale at specified point returned
00831    double *yscale,                     //!< Y scale at specified point returned
00832    double *rotangle,                   //!< Rotation angle at specified point returned (radians)
00833    double *shear,                      //!< Shear angle at specified point returned (radians)
00834    TRANSFUNC transfunc,                //!< Transformation function to "disect"
00835    void* transdata                     //!< "userdata" for transfunc
00836    ) {
00837    return (DisectGen2D((const DPOINT2D*)point, size, xscale, yscale, rotangle, shear, transfunc, transdata));
00838    };
00839 
00840 #endif
00841 
00842 
00843 #endif
00844 

Generated on Thu Aug 12 06:19:11 2004 for TNTsdk by doxygen 1.3.4-20031026