BEZIER.H 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /****************************************************************************
  2. * bezier.h
  3. *
  4. * This module contains all defines, typedefs, and prototypes for BEZIER.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 BEZIER_H
  24. #define BEZIER_H
  25. /*****************************************************************************
  26. * Global preprocessor defines
  27. ******************************************************************************/
  28. #define BICUBIC_PATCH_OBJECT (PATCH_OBJECT+DOUBLE_ILLUMINATE)
  29. #define BEZIER_INTERIOR_NODE 0
  30. #define BEZIER_LEAF_NODE 1
  31. #define MAX_PATCH_TYPE 4
  32. /*****************************************************************************
  33. * Global typedefs
  34. ******************************************************************************/
  35. typedef struct Bicubic_Patch_Struct BICUBIC_PATCH;
  36. typedef struct Bezier_Node_Struct BEZIER_NODE;
  37. typedef struct Bezier_Child_Struct BEZIER_CHILDREN;
  38. typedef struct Bezier_Vertices_Struct BEZIER_VERTICES;
  39. struct Bezier_Child_Struct
  40. {
  41. BEZIER_NODE *Children[4];
  42. };
  43. struct Bezier_Vertices_Struct
  44. {
  45. float uvbnds[4];
  46. VECTOR Vertices[4];
  47. };
  48. struct Bezier_Node_Struct
  49. {
  50. int Node_Type; /* Is this an interior node, or a leaf */
  51. VECTOR Center; /* Center of sphere bounding the (sub)patch */
  52. DBL Radius_Squared; /* Radius of bounding sphere (squared) */
  53. int Count; /* # of subpatches associated with this node */
  54. void *Data_Ptr; /* Either pointer to vertices or pointer to children */
  55. };
  56. struct Bicubic_Patch_Struct
  57. {
  58. OBJECT_FIELDS
  59. int Patch_Type, U_Steps, V_Steps;
  60. VECTOR Control_Points[4][4];
  61. VECTOR Bounding_Sphere_Center;
  62. DBL Bounding_Sphere_Radius;
  63. DBL Flatness_Value;
  64. BEZIER_NODE *Node_Tree;
  65. };
  66. /*****************************************************************************
  67. * Global variables
  68. ******************************************************************************/
  69. /*****************************************************************************
  70. * Global functions
  71. ******************************************************************************/
  72. void Precompute_Patch_Values (BICUBIC_PATCH *Shape);
  73. BICUBIC_PATCH *Create_Bicubic_Patch (void);
  74. void Compute_Bicubic_Patch_BBox (BICUBIC_PATCH *Patch);
  75. #endif