File: fractal.h

package info (click to toggle)
povray 1%3A3.6.1-12
  • links: PTS
  • area: non-free
  • in suites: lenny, squeeze
  • size: 31,084 kB
  • ctags: 20,310
  • sloc: ansic: 110,032; cpp: 86,573; sh: 13,595; pascal: 5,942; asm: 2,994; makefile: 1,753; ada: 1,637
file content (128 lines) | stat: -rw-r--r-- 4,789 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/****************************************************************************
 *                  fractal.h
 *
 * This module contains all defines, typedefs, and prototypes for FRACTAL.CPP.
 *
 * from Persistence of Vision(tm) Ray Tracer version 3.6.
 * Copyright 1991-2003 Persistence of Vision Team
 * Copyright 2003-2004 Persistence of Vision Raytracer Pty. Ltd.
 *---------------------------------------------------------------------------
 * NOTICE: This source code file is provided so that users may experiment
 * with enhancements to POV-Ray and to port the software to platforms other
 * than those supported by the POV-Ray developers. There are strict rules
 * regarding how you are permitted to use this file. These rules are contained
 * in the distribution and derivative versions licenses which should have been
 * provided with this file.
 *
 * These licences may be found online, linked from the end-user license
 * agreement that is located at http://www.povray.org/povlegal.html
 *---------------------------------------------------------------------------
 * This program is based on the popular DKB raytracer version 2.12.
 * DKBTrace was originally written by David K. Buck.
 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
 *---------------------------------------------------------------------------
 * $File: //depot/povray/3.6-release/source/fractal.h $
 * $Revision: #2 $
 * $Change: 2939 $
 * $DateTime: 2004/07/04 13:43:26 $
 * $Author: root $
 * $Log$
 *****************************************************************************/

#ifndef FRACTAL_H
#define FRACTAL_H

BEGIN_POV_NAMESPACE

/*****************************************************************************
* Global preprocessor defines
******************************************************************************/

#define QUATERNION_TYPE    0
#define HYPERCOMPLEX_TYPE  1

/* Hcmplx function stypes must come first */
#define EXP_STYPE          0
#define LN_STYPE           1
#define SIN_STYPE          2
#define ASIN_STYPE         3
#define COS_STYPE          4
#define ACOS_STYPE         5
#define TAN_STYPE          6
#define ATAN_STYPE         7
#define SINH_STYPE         8
#define ASINH_STYPE        9
#define COSH_STYPE        10
#define ACOSH_STYPE       11
#define TANH_STYPE        12
#define ATANH_STYPE       13
#define PWR_STYPE         14

/* end function stypes */
#define SQR_STYPE         15
#define CUBE_STYPE        16
#define RECIPROCAL_STYPE  17

#define Iteration(V,F) ( (*((F)->Iteration_Method))(V,F) )
#define Normal_Calc(F,V) ( (*((F)->Normal_Calc_Method))(V,(F)->n,F) )
#define F_Bound(R,F,dm,dM) ( (*((F)->F_Bound_Method))(R,F,dm,dM) )
#define D_Iteration(V,F,D) ( (*((F)->D_Iteration_Method))(V,F,D) )
#define Complex_Function(t,s,F) ( (*((F)->Complex_Function_Method))(t,s) )

/*****************************************************************************
* Global typedefs
******************************************************************************/

typedef struct Fractal_Struct FRACTAL;
typedef struct cmplx { DBL x,y; } CMPLX;
typedef void (*NORMAL_CALC_METHOD) (VECTOR, int, FRACTAL *);
typedef int (*ITERATION_METHOD) (VECTOR, FRACTAL *);
typedef int (*D_ITERATION_METHOD) (VECTOR, FRACTAL *, DBL *);
typedef int (*F_BOUND_METHOD) (RAY *, FRACTAL *, DBL *, DBL *);
typedef void (*COMPLEX_FUNCTION_METHOD) (CMPLX *, CMPLX *);

struct Fractal_Struct
{
  OBJECT_FIELDS
  VECTOR Center;
  DBL Julia_Parm[4];
  DBL Slice[4];                 /* vector perpendicular to slice plane */
  DBL SliceDist;                /* distance from slice plane to origin */
  DBL Exit_Value;
  int n;                        /* number of iterations */
  DBL Precision;                /* Precision value */
  int Inverted;

  int Algebra;                  /* Quaternion or Hypercomplex */
  int Sub_Type;
  CMPLX exponent;               /* exponent of power function */

  NORMAL_CALC_METHOD Normal_Calc_Method;
  ITERATION_METHOD Iteration_Method;
  D_ITERATION_METHOD D_Iteration_Method;
  F_BOUND_METHOD F_Bound_Method;
  COMPLEX_FUNCTION_METHOD Complex_Function_Method;

  DBL Radius_Squared;           /* For F_Bound(), if needed */
};

/*****************************************************************************
* Global variables
******************************************************************************/

extern DBL *Sx, *Sy, *Sz, *Sw;
extern DBL Precision;
extern VECTOR Direction;

/*****************************************************************************
* Global functions
******************************************************************************/

FRACTAL *Create_Fractal (void);
void SetUp_Fractal (FRACTAL * Fractal);
void Allocate_Iteration_Stack (int n);
void Free_Iteration_Stack (void);

END_POV_NAMESPACE

#endif