PRISM.H 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /****************************************************************************
  2. * prism.h
  3. *
  4. * This module contains all defines, typedefs, and prototypes for PRISM.C.
  5. *
  6. * from Persistence of Vision(tm) Ray Tracer
  7. * Copyright 1996,1999 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. * NOTICE: This source code file is provided so that users may experiment
  10. * with enhancements to POV-Ray and to port the software to platforms other
  11. * than those supported by the POV-Ray Team. There are strict rules under
  12. * which you are permitted to use this file. The rules are in the file
  13. * named POVLEGAL.DOC which should be distributed with this file.
  14. * If POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. * Team Coordinator by email to team-coord@povray.org or visit us on the web at
  16. * http://www.povray.org. The latest version of POV-Ray may be found at this site.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23. #ifndef PRISM_H
  24. #define PRISM_H
  25. /*****************************************************************************
  26. * Global preprocessor definitions
  27. ******************************************************************************/
  28. #define PRISM_OBJECT (STURM_OK_OBJECT)
  29. #define LINEAR_SPLINE 1
  30. #define QUADRATIC_SPLINE 2
  31. #define CUBIC_SPLINE 3
  32. #define BEZIER_SPLINE 4
  33. #define LINEAR_SWEEP 1
  34. #define CONIC_SWEEP 2
  35. /* Generate additional prism statistics. */
  36. #define PRISM_EXTRA_STATS 1
  37. /*****************************************************************************
  38. * Global typedefs
  39. ******************************************************************************/
  40. typedef struct Prism_Struct PRISM;
  41. typedef struct Prism_Spline_Struct PRISM_SPLINE;
  42. typedef struct Prism_Spline_Entry_Struct PRISM_SPLINE_ENTRY;
  43. typedef struct Prism_Intersection_Structure PRISM_INT;
  44. struct Prism_Intersection_Structure
  45. {
  46. DBL d; /* Distance of intersection point */
  47. DBL w; /* Paramter of intersection point on n-th spline */
  48. int n; /* Number of segment hit */
  49. int t; /* Type of intersection: base/cap plane or segment */
  50. };
  51. struct Prism_Spline_Entry_Struct
  52. {
  53. DBL x1, y1, x2, y2; /* Min./Max. coordinates of segment */
  54. DBL v1, u2, v2; /* Min./Max. coordinates of segment in <u,v>, u1 not needed */
  55. UV_VECT A, B, C, D; /* Coefficients of segment */
  56. };
  57. struct Prism_Spline_Struct
  58. {
  59. int References;
  60. PRISM_SPLINE_ENTRY *Entry;
  61. };
  62. struct Prism_Struct
  63. {
  64. OBJECT_FIELDS
  65. int Number;
  66. int Spline_Type; /* Spline type (linear, quadratic ...) */
  67. int Sweep_Type; /* Sweep type (linear, conic) */
  68. TRANSFORM *Trans;
  69. DBL Height1, Height2;
  70. DBL x1, y1, x2, y2; /* Overall bounding rectangle of spline curve */
  71. PRISM_SPLINE *Spline; /* Pointer to array of splines */
  72. PRISM_INT *Intersections; /* Prism intersections list */
  73. DBL u1, v1, u2, v2; /* Overall <u,v> bounding rectangle of spline */
  74. };
  75. /*****************************************************************************
  76. * Global variables
  77. ******************************************************************************/
  78. /*****************************************************************************
  79. * Global functions
  80. ******************************************************************************/
  81. PRISM *Create_Prism (void);
  82. void Compute_Prism_BBox (PRISM *Prism);
  83. void Compute_Prism (PRISM *Prism, UV_VECT *P);
  84. #endif