home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / povsrc31.zip / sphsweep.h < prev    next >
Text File  |  1998-10-09  |  3KB  |  101 lines

  1. /****************************************************************************
  2. *                   sphsweep.h
  3. *
  4. *  This module contains the global defines, typedefs, and prototypes
  5. *  for sphsweep.c.
  6. *
  7. *  Copyright 1997 Jochen Lippert
  8. *
  9. *****************************************************************************/
  10.  
  11.  
  12. #ifndef SPHERE_SWEEP_H
  13. #define SPHERE_SWEEP_H
  14.  
  15.  
  16.  
  17. /*****************************************************************************
  18. * Global preprocessor defines
  19. ******************************************************************************/
  20.  
  21. #define SPHERE_SWEEP_OBJECT     (BASIC_OBJECT)
  22.  
  23. /* Sphere sweep interpolated by a piecewise linear function */
  24. #define LINEAR_SPHERE_SWEEP                0
  25.  
  26. /* Sphere sweep interpolated by a cubic Catmull-Rom-Spline function */
  27. #define CATMULL_ROM_SPLINE_SPHERE_SWEEP    1
  28.  
  29. /* Sphere sweep approximated by a cubic B-Spline function */
  30. #define B_SPLINE_SPHERE_SWEEP            2
  31.  
  32. /* Maximum number of coefficients of the polynomials describing one segment */
  33. #define SPH_SWP_MAX_COEFS                4
  34.  
  35.  
  36.  
  37. /*****************************************************************************
  38. * Global typedefs
  39. ******************************************************************************/
  40.  
  41. typedef struct Sphere_Sweep_Struct SPHERE_SWEEP;
  42. typedef struct Sphere_Sweep_Sphere_Struct SPHSWEEP_SPH;
  43. typedef struct Sphere_Sweep_Segment_Struct SPHSWEEP_SEG;
  44.  
  45. /* The complete object */
  46. struct Sphere_Sweep_Struct
  47. {
  48.     OBJECT_FIELDS
  49.     TRANSFORM    *Trans;
  50.     int            Interpolation;
  51.     int            Num_Modeling_Spheres;        /* Number of modeling spheres    */
  52.     SPHSWEEP_SPH    *Modeling_Sphere;    /* Spheres describing the shape  */
  53.     int            Num_Spheres;                /* Number of single spheres      */
  54.     SPHSWEEP_SPH    *Sphere;            /* Spheres that close segments   */
  55.     int            Num_Segments;                /* Number of tubular segments    */
  56.     SPHSWEEP_SEG    *Segment;        /* Tubular segments              */
  57.     DBL            Depth_Tolerance;            /* Preferred depth tolerance     */
  58. };
  59.  
  60. /* Single sphere, used to connect two adjacent segments */
  61. struct Sphere_Sweep_Sphere_Struct
  62. {
  63.     VECTOR        Center;
  64.     DBL            Radius;
  65. };
  66.  
  67. /* One segment of the sphere sweep */
  68. struct Sphere_Sweep_Segment_Struct
  69. {
  70.     SPHSWEEP_SPH    Closing_Sphere[2];        /* Spheres closing the segment   */
  71.     VECTOR    Center_Deriv[2];    /* Derivatives of center funcs for 0 and 1   */
  72.     DBL        Radius_Deriv[2];    /* Derivatives of radius funcs for 0 and 1   */
  73.     int        Num_Coefs;                        /* Number of coefficients        */
  74.     VECTOR    Center_Coef[SPH_SWP_MAX_COEFS];    /* Coefs of center polynomial    */
  75.     DBL        Radius_Coef[SPH_SWP_MAX_COEFS];    /* Coefs of radius polynomial    */
  76. };
  77.  
  78.  
  79.  
  80. /*****************************************************************************
  81. * Global variables
  82. ******************************************************************************/
  83.  
  84.  
  85.  
  86.  
  87. /*****************************************************************************
  88. * Global functions
  89. ******************************************************************************/
  90.  
  91. SPHERE_SWEEP *Create_Sphere_Sweep (void);
  92. void Compute_Sphere_Sweep_BBox (SPHERE_SWEEP *Sphere_Sweep);
  93. int Intersect_Sphere_Sweep (RAY *Ray, VECTOR Center, DBL Radius2, DBL *Depth1, DBL *Depth2);
  94. void *Copy_Sphere_Sweep (OBJECT *Object);
  95. void Transform_Sphere_Sweep (OBJECT *Object, TRANSFORM *Trans);
  96. void Destroy_Sphere_Sweep (OBJECT *Object);
  97.  
  98. void Compute_Sphere_Sweep (SPHERE_SWEEP *Sphere_Sweep);
  99.  
  100. #endif
  101.