FRACTAL.H 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /****************************************************************************
  2. * fractal.h
  3. *
  4. * This module contains all defines, typedefs, and prototypes for FRACTAL.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 FRACTAL_H
  24. #define FRACTAL_H
  25. /*****************************************************************************
  26. * Global preprocessor defines
  27. ******************************************************************************/
  28. #define QUATERNION_TYPE 0
  29. #define HYPERCOMPLEX_TYPE 1
  30. /* Hcmplx function stypes must come first */
  31. #define EXP_STYPE 0
  32. #define LOG_STYPE 1
  33. #define SIN_STYPE 2
  34. #define ASIN_STYPE 3
  35. #define COS_STYPE 4
  36. #define ACOS_STYPE 5
  37. #define TAN_STYPE 6
  38. #define ATAN_STYPE 7
  39. #define SINH_STYPE 8
  40. #define ASINH_STYPE 9
  41. #define COSH_STYPE 10
  42. #define ACOSH_STYPE 11
  43. #define TANH_STYPE 12
  44. #define ATANH_STYPE 13
  45. #define PWR_STYPE 14
  46. /* end function stypes */
  47. #define SQR_STYPE 15
  48. #define CUBE_STYPE 16
  49. #define RECIPROCAL_STYPE 17
  50. #define Iteration(V,F) ( (*((F)->Iteration_Method))(V,F) )
  51. #define Normal_Calc(F,V) ( (*((F)->Normal_Calc_Method))(V,(F)->n,F) )
  52. #define F_Bound(R,F,dm,dM) ( (*((F)->F_Bound_Method))(R,F,dm,dM) )
  53. #define D_Iteration(V,F,D) ( (*((F)->D_Iteration_Method))(V,F,D) )
  54. #define Complex_Function(t,s,F) ( (*((F)->Complex_Function_Method))(t,s) )
  55. /*****************************************************************************
  56. * Global typedefs
  57. ******************************************************************************/
  58. typedef struct Fractal_Struct FRACTAL;
  59. typedef struct cmplx { DBL x,y; } CMPLX;
  60. typedef void (*NORMAL_CALC_METHOD) (VECTOR, int, FRACTAL *);
  61. typedef int (*ITERATION_METHOD) (VECTOR, FRACTAL *);
  62. typedef int (*D_ITERATION_METHOD) (VECTOR, FRACTAL *, DBL *);
  63. typedef int (*F_BOUND_METHOD) (RAY *, FRACTAL *, DBL *, DBL *);
  64. typedef void (*COMPLEX_FUNCTION_METHOD) (CMPLX *, CMPLX *);
  65. struct Fractal_Struct
  66. {
  67. OBJECT_FIELDS
  68. TRANSFORM * Trans;
  69. VECTOR Center;
  70. DBL Julia_Parm[4];
  71. DBL Slice[4]; /* vector perpendicular to slice plane */
  72. DBL SliceDist; /* distance from slice plane to origin */
  73. DBL Exit_Value;
  74. int n; /* number of iterations */
  75. DBL Precision; /* Precision value */
  76. int Inverted;
  77. int Algebra; /* Quaternion or Hypercomplex */
  78. int Sub_Type;
  79. CMPLX exponent; /* exponent of power function */
  80. NORMAL_CALC_METHOD Normal_Calc_Method;
  81. ITERATION_METHOD Iteration_Method;
  82. D_ITERATION_METHOD D_Iteration_Method;
  83. F_BOUND_METHOD F_Bound_Method;
  84. COMPLEX_FUNCTION_METHOD Complex_Function_Method;
  85. DBL Radius_Squared; /* For F_Bound(), if needed */
  86. };
  87. /*****************************************************************************
  88. * Global variables
  89. ******************************************************************************/
  90. extern DBL *Sx, *Sy, *Sz, *Sw;
  91. extern DBL Precision;
  92. extern VECTOR Direction;
  93. /*****************************************************************************
  94. * Global functions
  95. ******************************************************************************/
  96. FRACTAL *Create_Fractal (void);
  97. void SetUp_Fractal (FRACTAL * Fractal);
  98. void Allocate_Iteration_Stack (int n);
  99. void Free_Iteration_Stack (void);
  100. #endif