home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 January / Chip_1997-01_cd.bin / ms95 / disk22 / dir03 / f011170.re_ / f011170.re
Text File  |  1996-04-02  |  7KB  |  239 lines

  1. /*----------------------------------------------------------------------+
  2. |                                    |
  3. |  Copyright (c) 1985-93;  Bentley Systems, Inc., All rights reserved.    |
  4. |                                    |
  5. | "MicroStation", "MDL", and "MicroCSL" are trademarks of Bentley    |
  6. |  Systems, Inc.                            |
  7. |                                    |
  8. |  Limited permission is hereby granted to reproduce and modify this    |
  9. |  copyrighted material provided that the resulting code is used only     |
  10. |  in conjunction with Bentley Systems products under the terms of the    |
  11. |  license agreement provided therein, and that this notice is retained    |
  12. |  in its entirety in any such reproduction or modification.        |
  13. |                                    |
  14. +----------------------------------------------------------------------*/
  15. /*----------------------------------------------------------------------+
  16. |                                    |
  17. |   mdlbspln.h -- Include file for MDL applications using        |
  18. |          B-splines. Defines constants and strucutes.        |
  19. |                                    |
  20. |   $Workfile:   mdlbspln.h  $
  21. |   $Revision:   6.1  $
  22. |          $Date:   02 Feb 1994 15:38:46  $
  23. |                                    |
  24. +----------------------------------------------------------------------*/
  25. #if !defined (__mdlbsplnH__)
  26. #define __mdlbsplnH__
  27.  
  28. #if !defined (__basetypeH__)
  29. #include    <basetype.h>
  30. #endif
  31.  
  32. /*----------------------------------------------------------------------+
  33. |                                    |
  34. |   Immediate Defines                            |
  35. |                                    |
  36. +----------------------------------------------------------------------*/
  37. /* B-Spline curve types */
  38. #define        BSCURVE_GENERAL        0
  39. #define        BSCURVE_LINE        1
  40. #define        BSCURVE_CIRCULAR_ARC    2
  41. #define        BSCURVE_CIRCLE        3
  42. #define        BSCURVE_ELLIPTICAL_ARC    4
  43. #define        BSCURVE_ELLIPSE        5
  44. #define        BSCURVE_PARABOLIC_ARC    6
  45. #define        BSCURVE_HYPERBOLIC_ARC    7
  46.  
  47. /* B-Spline surface types */
  48. #define        BSSURF_GENERAL        0
  49. #define        BSSURF_PLANE        1
  50. #define        BSSURF_RIGHT_CYLINDER    2
  51. #define        BSSURF_CONE            3
  52. #define        BSSURF_SPHERE        4
  53. #define        BSSURF_TORUS        5
  54. #define        BSSURF_REVOLUTION        6
  55. #define        BSSURF_TAB_CYLINDER        7
  56. #define        BSSURF_RULED_SURFACE    8
  57.  
  58. /* Constants */
  59. #define BSSURF_U 0
  60. #define BSSURF_V 1
  61.  
  62. /* Miscellaneous Maxima */
  63. #define MAX_POLES    101
  64. #define MAX_ORDER    15
  65. #define MAX_KNOTS    (MAX_POLES + 2*MAX_ORDER - 1)
  66. #define MAX_BNDRY_PTS    151
  67. #define MAX_DATA_PTS    250
  68.  
  69. /* Tolerances */
  70. #define KNOT_TOLERANCE_BASIS    1E-10
  71.  
  72. /* Fit modes */
  73. #define FIT_POLES            0
  74. #define FIT_POINTS        1
  75. #define FIT_LEASTSQUARES    2
  76. #define FIT_CATMULLROM      3
  77.  
  78.  
  79. /* Offset cusp treatments */
  80. #define OFFSET_JUMP_CUSP    0
  81. #define OFFSET_CHAMFER_CUSP    1
  82. #define OFFSET_POINT_CUSP    2
  83. #define OFFSET_PARABOLA_CUSP    3
  84. #define OFFSET_ARC_CUSP        4
  85.  
  86. /* Continuity degree specifications */
  87. #define     POSITION_CONTINUITY     0
  88. #define     TANGENT_CONTINUITY      1
  89. #define     CURVATURE_CONTINUITY    2
  90.  
  91. /* Truncation specifications */
  92. #define     TRUNCATE_BOTH        0
  93. #define     TRUNCATE_NONE        1
  94. #define     TRUNCATE_SINGLE        2
  95.  
  96. /* Iso display for silhouette curves */
  97. #define     SILHBND_U            0
  98. #define     SILHBND_V            1
  99. #define     SILHBND_NONE        2
  100. #define     SILHBND_BOTH        3
  101.  
  102. /* Surface edge classification */
  103. #define     NO_EDGE     0x0000
  104. #define     U0_EDGE     0x0001
  105. #define     U1_EDGE     0x0002
  106. #define     V0_EDGE     0x0004
  107. #define     V1_EDGE     0x0008
  108. #define     ANY_EDGE    0x000F
  109.  
  110. /*----------------------------------------------------------------------+
  111. |                                    |
  112. |   Structure Definitions                        |
  113. |                                    |
  114. +----------------------------------------------------------------------*/
  115. typedef struct bSplineParam
  116.     {
  117.     int        order;
  118.     int        closed;
  119.     int        numPoles;
  120.     int        numKnots;
  121.     int        numRules;
  122.     } BsplineParam;
  123.  
  124. typedef struct bsplineDisplay
  125.     {
  126.     int        polygonDisplay;
  127.     int        curveDisplay;
  128.     int        rulesByLength;
  129.     } BsplineDisplay;
  130.  
  131. #if !defined (resource)
  132. typedef struct bsurfBoundary
  133.     {
  134.     int        numPoints;
  135.     Dpoint2d    *points;
  136.     } BsurfBoundary;
  137.  
  138. /*----------------------------------------------------------------------+
  139. |                                    |
  140. |   SSI Definitions                                |
  141. |                                    |
  142. +----------------------------------------------------------------------*/
  143. typedef struct boundBox               /* 120 words */
  144.     {
  145.     double      system[3][3];
  146.     Dpoint3d    origin;
  147.     Dpoint3d    extent;
  148.     } BoundBox;
  149.  
  150. typedef struct boundCyl               /* 64 words */
  151.     {
  152.     Dpoint3d    org;        /* origin of cylinder */
  153.     Dpoint3d    dir;        /* direction of cylinder, unit vector */
  154.     double    radius;        /* radius of cylinder */
  155.     double      length;        /* length of cylinder axis */
  156.     } BoundCyl;
  157.  
  158. typedef struct booleandata           /* specific to each surface in SurfaceChain */
  159.     {
  160.     int            numBounds;           /* number of new trim boundaries for this surface */
  161.     BsurfBoundary   *bounds;           /* trim boundaries for this surface created by SSI */
  162.     BoundBox        box;           /* bounding box of this surface */
  163.     void        *edP;           /* generating element descriptor for this surface */
  164.     void        *trimEdP;           /* trimmed element descriptor for this surface */
  165.     } BooleanData;
  166.  
  167.  
  168. /*----------------------------------------------------------------------+
  169. |                                    |
  170. |   MSBsplineCurve                            |
  171. |                                    |
  172. +----------------------------------------------------------------------*/
  173. typedef struct msbsplinecurve
  174.     {
  175.     int            type;
  176.     int            rational;
  177.     BsplineDisplay    display;
  178.     BsplineParam    params;
  179.     Dpoint3d        *poles;        /* In homogenous coordinates */
  180.     double        *knots;        /* Full knot vector */
  181.     double        *weights;    /* Weights only if rational */
  182.     } MSBsplineCurve;
  183.  
  184.  
  185. /*----------------------------------------------------------------------+
  186. |                                    |
  187. |   MSBsplineSurface                            |
  188. |                                    |
  189. +----------------------------------------------------------------------*/
  190. typedef struct msbsplinesurface
  191.     {
  192.     int            type;
  193.     int            rational;
  194.     BsplineDisplay    display;
  195.     BsplineParam    uParams;
  196.     BsplineParam    vParams;
  197.     Dpoint3d        *poles;
  198.     double        *uKnots;
  199.     double        *vKnots;
  200.     double        *weights;
  201.     int            holeOrigin;
  202.     int            numBounds;
  203.     BsurfBoundary    *boundaries;
  204.     } MSBsplineSurface;
  205.  
  206. /*----------------------------------------------------------------------+
  207. |                                    |
  208. |   CurveChain                                |
  209. |                                    |
  210. +----------------------------------------------------------------------*/
  211. typedef struct curveChain CurveChain;
  212.  
  213. struct curveChain
  214.     {
  215.     MSBsplineCurve    curve;
  216.     void        *userDataP;
  217.     CurveChain        *nextP;
  218.     CurveChain        *previousP;
  219.     };
  220.  
  221. /*----------------------------------------------------------------------+
  222. |                                    |
  223. |   SurfaceChain                            |
  224. |                                    |
  225. +----------------------------------------------------------------------*/
  226. typedef struct surfaceChain SurfaceChain;
  227.  
  228. struct surfaceChain
  229.     {
  230.     MSBsplineSurface    surface;
  231.     void        *userDataP;
  232.     SurfaceChain    *nextP;
  233.     SurfaceChain    *previousP;
  234.     };
  235.  
  236. #endif /* ndef resource */
  237.  
  238. #endif /* ndef __mdlbsplnH__ */
  239.