Gaddis and Michael - Fractals
Gaddis and Michael - Fractals
Gaddis and Michael - Fractals
1985
Gaddis, Michael E.
http://hdl.handle.net/10945/21349
DUDLEY KNOX LIBRARY
NAVAL POSTGRADUATE SCHOOL
MONTEREY, CALIFORNIA 93943-8003
NAVAL POSTGRADUATE SCHOOL
Monterey, California
THESIS
The Fractal Geometry of Nature;
Its Mathematical Basis and
Application to Computer Graphics
by
Michael Edward (Caddis
December 19S5
T226311
CURITY CLASSIFICATION OF THIS PAGE
COSATI CODES 18 SUBJECT TERMS (Continue on reverie if necessary and identify by block number)
FIELD GROUP SUB-GROUP Computer Graphics, Fractals, Stochastic Terrain
Modelling, Terrain Modelling
DFORM 1473, B4 mar 33 APR edition may be used until exhausted SECURI t y CLASSIFICATION OF ~~»s ?ACi
Ail other editions are obsolete
1
Approved for public release, distribution unlimited
December 1985
A BSTRAC T
Fractal Geometry is a recent synthesis of old mathematical constructs. It was
first popularized by complex renderings of terrain on a computer graphics
medium. Fractal geometry has since spawned research in many diverse scientific
disciplines. Its rapid acceptance has been achieved due to its ability to model
phenomena that defy discrete computation due to roughness and discontinuities.
that serves no purpose. Its essence is induction using simple geometric constructs
to transform initiating objects. The fractal objects that we create with this
3
5
1
TABLE OF CONTENTS
B. FRACTAL GEOMETRY 9
A. PRELIMINARIES 10
B. DIMENSION 15
D. IMPLEMENTATION STRATEGIES 55
E. SUMMARY 55
B. CONCLUSIONS 102
pursue a subject that was both interesting and challenging. Who also allowed me
considerable leeway in my research and had the good sense to keep me on track
when I strayed too far. To Leut. Steven Firth, RAN, for Ozdraw, his
excellent figure generation system, which made the creation of figures for my
thesis a joy. To Lt. John Ynrchak, USN, who was the intrepid hacker that
developed the thesis macros for the QMS laser printer. But most of all I would
like to thank my wife, Kathleen, who has shown infinite patience with my
seemingly endless late hours and far-off gazes. Who has given me a wonderful
daughter during this time, and who gives me the joy of life.
6
I. AN INTRODUCTION TO FRACTAL GEOMETRY
response to the need for more detailed models to describe new developments,
both technological and philosophical. This was true when Newton developed
calculus and also true during the late 1800's through the 1920's when a schism
thinkers.
and beliefs and through this questioning develop new insight and innovation.
Most mathematical systems are developed for use in applications. Man's natural
inquisitiveness often leads him to develop his systems beyond the application and
into abstract theory. This theory drives him to investigate the applications and
often yields direction for new discoveries that were not previously foreseen or that
defy intuition.
the modern set theory. Some of Cantor's discoveries seemed to invalidate many
of the long held beliefs of mathematics. Cantor and his peers became deeply
involved in controversy over their findings. Their discovery of functions which
seemed to violate the basic rules of geometry and calculus were deemed as
usefulness to any application then known [Ref. l:pp. 9]. These new concepts
developed to a point where the old models could no longer adequately describe it>
processes and would look to the new mathematics for a new perspective.
It was from these discoveries that Fractal Geometry was born Ref.
l:Chap. 2]. It will be seen in the following chapters that fractal geometry
is a synthesis of many of the concepts which developed from the mathematical
schism of the 19th century, most notably set theory and topology.
2:pp 1-3]:
Although the phenomenon of interest need not be taken from the real world,
they usually are. The real world component is described quantitatively by such
things as parameter values and at which time things occur.
The third component of a model is a specification of the way in which the real
world is represented by the mathematical structure, that is, a correspondence
between the elements of the first component and those of the second.
expands and we need to describe processes that are not well behaved, we need to
develop a geometry that can adequately model our process within a certain
closeness of scale.
not follow the man-made rules that we impose on our model. But at a given
scale, the model (if it is accurate) can describe the object with enough precision
describe a wall but this wall, when viewed closely enough, is not straight at all.
This is of no matter to the engineer because his model is accurate for his scale of
reference.
8
B. FRACTAL GEOMETRY
One man who saw a need for a new geometry was Benoit B. Mandlebrot. He
felt that Euclidean geometry was not satisfactory as a model for natural objects.
To anyone who has tried to draw a picture of a nonregular object (such as a tree)
describe a class of functions first discovered by Cantor (Cantor's dustj. Koch (the
Koch curve) and Peano. He showed how these functions yield valuable insight
into the creation of models for natural objects such as coastlines and mountains.
Mandlebrot popularized the notion of a fractal geometry for these types of
objects. Although he did not invent the ideas he presents, Mandlebrot must be
1
This research will take the later approach . It is designed to investigate the
1
Where Mandelbrot took the former.
9
II. THE MATHEMATICAL BASIS OF FRACTAL GEOMETRY
underlie the theory of fractals. Little technique currently exists for the practical
(i.e. it is very difficult to prove that a set is fractal). This causes the non-
A. PRELIMINARIES
A complete definition of fractals is given later in this chapter but before we
can understand that definition, we must establish a foundation in set theory.
Fractals were discovered in set theory and topology. They can be considered as
1. What is a Set
A set is formed by the grouping together of single objects into a whole. A set is
a plurality thought of as a unit. We can consider these statements as expository,
as references to a primitive concept, familiar to us all, whose resolution into
more fundamental concepts would perhaps be neither competent nor necessary.
We will content ourselves with this construction and will assume as an axiom
that an object M
inherently determines certain other objects a, b, c, ... in some
undefined way, and vice versa. We express this relation by the words: The set
consists of the objects a, b, c, ...
M
This definition is intentionally vague to allow the set to become the basic
the body of this chapter. The reader is directed to the references for a detailed
Definitions:
Cardinality
Two sets S and T are said to have the same number of elements, or to have the
same cardinality, if there is a one-one function /from 5 to T.
10
Finite and Infinite Sets
Countability
A set S is said to be countable if S has the same cardinality as a subset of N, the
set of positive integers. Otherwise, 5 is said to be uncountable.
Propositions:
body of this chapter. The reader is directed to the references for a detailed
Concepts:
Metric Space
A metric space is a set in which we have a measure of the closeness or proximity
of two elements of the set, that is, we have a distance defined on the set. For ex-
ample, a metric on R 2
would be the pythagorean metric:
2 2
D((xi,yi),(x 2 ,y 2 )) = x/(x 1
-i 2 ) +(yi-J/2)
Covering a Set
Let A' be a topological space and S a subset of X. A cover of the set 5 is exactly
what its name implies, a collection of subsets of X which cover S, that is, whose
union contains S.
4. What is a Function
Definition:
11
If /is function from A to B, then A is called the domain of the function /and B
is called the codomain of /.
To completely define a function we must specify the domain, the codomain, and
the value f(x) for each possible argument x.
creation of a set from other sets using some agreed upon mathematical
symbolism. The functions can yield powerful results when the target set (co-
domain) is complex and not easily described by set theoretical constructs. This is
fractal set.
which a function exists. The function can be rigorously defined within the above
constructs but lack intuitive appeal due to its complexity. Mathematicians have
a. Partial Functions
Most of the fractal functions in this study have as their domain some
undefined subset of R . It is useful then to consider them as partial functions
and not concern ourselves with a rigorous description of the domain of the
view such a situation as one where a function has a domain A and codomain B,
but the value of the function does not exist for some arguments of A. This is
called a partial function.
Definition:
Let A and B be sets. A partial function f with domain A and codomain B is any
function from A' to B, wnere A' is a subset of A. For any x which is an element
of A - A', the value of / (x is said to be undef ined ) .
b. Bijectivity
12
the domain maps to a point in the codomain then we want to know if all points
of the domain A in the mapping /(A) map to distinct points in the codomain B.
We may also want to know to what extent the mapping /(A) covers the set B.
The definition of bijective, surjective and injective functions is from [Ref 2:pp.
204].
Definition:
6. Functions From RN - RN
A point in R' space is specified by an n- tuple of the form
(jr
1
,x 2
,x 3 ,
xn ). To completely specify a function from R^ — R N each point in
/ : R -R 2 2
2
/((x 1? x 2 ))= (x, ,,/)
This function is well defined. For each point in the domain of the function we
have specified a unique point in the codomain.
Most of the functions that are covered in this study are mappings within
R 2
or R3 . Fractal sets exist in all finite dimensions but it is impractical at this
point to use fractal functions beyond the fourth dimension in view of the graphics
the function to roam the fourth dimension and then taking time slices which
13
Our definition of inductive definitions of sets is from [Ref. 2:pp. 199-201].
1. The basis, or basic clause, of the definition establishes that certain objects
are in the set. The basic clause establishes that a set is not empty and charac-
terizes the "building blocks" (the seeds of the induction) which are used to con-
struct the set from the inductive clause.
(Basis)
t A
(Induction)
If n e A, then (n +2) e A
(Extremal)
The set that we defined is the set of all even nonnegative integers.
fractals.
Most of the fractal functions that are introduced in this study use the
inductive method as the primary functional tool. In fact, these functions are a
14
B. DIMENSION
The classification of fractal sets from non-fractal sets is based on the
The concept of dimension is one rife with difficulties. Many of the gr^at
consistent with the known mathematical systems. For each of their attempts
There currently exist five definitions of dimension that date back to the late
1800V. The classification of Fractal sets into a class of sets is the result of the
discovery of functions that created sets which did not fit comfortably into the
time). Fractal sets are rigorously classified as those sets that demonstrate a
topological dimension.
Euclidean geometry as the standard three dimensions. Long after Euclid made
the first attempts at defining dimension and concurrent with the discovery of
atomic particle physics the concept of dimension was rethought by the prominent
model for the geometry of objects with the new view of what those objects were
made of. Our increasing ability to focus on the nature of matter inevitably
The dilemma that arose from the new concepts of dimension quickly
developed into a theoretical debate that left intuition behind. When human
intuition fails, we must rely upon well founded models that are based on axioms
1
1). Cantor and Minkowski; 2). Bouligand and Minkowski; 3). Pontrajgin. Schnirelman and
Kolornogorov, Tihomirov; 4). Hausdorff-Besicovitch and 5). the topological dimension (there are
others). Most of these definitions are concerned with the most efficient method of covering a set
(i.e. are topological concerns).
15
true physical nature of the objects we model. The debate still rages today and
complexity and possible paradoxes that can arise from dimension theory.
Consider the way in which we define the density of air at a given point and at a
given moment. We picture a sphere of volume V
centered at that point and in-
cluding the mass Wi. The quotient M/V is the mean density within the sphere,
and by the true density we denote some limiting value of this quotient. This no-
tion, however, implies that at the given moment the mean density is practically
constant for spheres below a certain volume. This mean density may be notably
different for spheres containing 1,000 cubic meters and 1 cubic centimeter
respectively.
Suppose the volume becomes continually smaller. Instead of becoming less and
less important, these fluctuations come to increase. For scales at which the
brownian motion shows great activity, fluctuations may attain 1 part in 1,000,
and they become of the order of 1 part in 5 when the radius of the hypothetical
spherule becomes of the order of a hundredth of a micron.
One step further and our spherule becomes of the order of a molecule radius. In
a gas it will generally lie in intermolecular space, where its mean density will
henceforth vanish. At our point the true density will also vanish. But about
once in a thousand times that point will lie within a molecule, and the mean
density will be a thousand times higher than the value we usually take to be
the true density of the gas.
Let our spherule grow steadily smaller. Soon, except under exceptional cir-
cumstances, it will Decome empty and remain so henceforth owing to the intra-
atomic space; the true density vanishes almost everywhere, except at an infinite
number of isolated points, where it reaches an infinite value.
of reference. Each ends with reference to the paradox of atomic particles. That
paradox is, for any collection of finite (or countably infinite) points, the
dimension is zero [Ref. 6:pp. 1-8]. Since the earth and sun each have a finite
16
only for a mathematical continuum and as such lacks application to the physical
4
universe as we currently know it .
composed of basic elements that were indivisible. While the debate raged over the
not practical to represent objects by representing each atom and its position
relative to the entire set. The power of modeling would thus be lost; that is. the
constructs. Thus the fact is reinforced that models can only represent objects
through gross approximations and that the model is only effective for a restricted
frame of reference. Without this realization, dimension would have very little
application.
2. Topological Dimension
a. An Intuitive Approach
The concept of dimension is very old. It is based on the algebraic
concepts of Euclidean n space and the notion that a set has dimension n if the
least number of real parameters needed to describe its points was n. This fuzzy
definition was accepted for a very long time until the advent of Cantor and set
theory at the time (but who could not disregard Cantors findings) began to
consider ways of explicitly defining dimension. The new definition would have to
be applicable to the bizarre functions of Cantor. Koch and Peano as well as the
4
The set theoretical concepts of finiteness, countably infinite and uncountabl) infinite (con-
tinuous) sets carry with them very profound implications. It is premature to view matter a> mere-
ly collections of finite atoms. Science may yet find true continuity (in the mathematical sense) in
atomic matter and the universe. For now, matter is what it is and our pronunciations upon it will
not change its true texture.
17
relatively simple objects that had previously fit into the old definition without
contradiction.
unless n equals m. To say that two spaces A and B are homeomorphic means
that a mapping / :A^B exists, such that /is continuous over .4 and bijective.
~
Additionally, the inverse of this mapping /
l
B^A , is continuous over B and
bijective. If two spaces are homeomorphic then it is analogous to saying that they
dimension of a set was developed. This definition assigned an integer value as the
study but the following definition is included for completeness [Ref. 6:pp. 24]:
Definition:
The empty set and only the empty set has dimension -1.
18
The topological dimension is rigorous and consistent for all sets that
exist within a metric space. The problem that arises with fractal sets and its
topological dimension is not that the topological dimension is wrong. Fractal sets
like all sets in a metric space exhibit a topological dimension. The question is
set or can we find a better way to characterize the dimensional qualities of the
useful and consistent with the notion of dimension and space? Can we devise a
3
better concept which can further refine dimension and make it more useful .
the lack of practical technique that it yields. The Hausdorff measure of a set is a
proved using the existential qualities of infinite sets in a metric space H. While
measure of a set.
measure of dimension is not universal [Ref. 6:pp. 102] and [Ref. l:pp. 363-365].
The debate is between the disciplines of topology and metrics and is not wholly
germane to this study. It is beneficial to divorce ourselves from the debate and
sets exist that have a topological dimension equal to 1 but in no way resemble a
set's structure that provides a mathematical and intuitive difference that is useful
5
Try not to ascribe grandiose implications to a set's dimension (the fourth dimension as time
or some such) as this is premature at best. Rather, view a set's dimension as merely descriptive
terminology the terminology of bijectivity describes a function's characteristics The
much like
problem most people have with this mental abstraction is the visual reinforcement that the\ re-
ceived from the notion of the standard three dimensions.
19
The Hausdorff measure of a set was developed during the same
period that the new topological dimension was invented to solve the paradoxes of
point within a Euclidean space of R . The connection to metric spaces and the
idea of measure is obvious when you consider that the Hausdorff measure of a set
is also based on this notion of a spherical neighborhood and what Hausdorff calls
the test function of a set. The test function of a set denoted h(p ) is a function
that characterizes the "best" method of covering a point with the spherical ball
of radius p that covers points of the set, which in their union, cover the entire
set.
becomes the test function for the surface. The formula for the area of a circle
always contains the constant factor it multiplied by the square of the radius r.
This radius is the measure p as above. This leaves us with a test function for a
planar shape in R 2
of h(p )
= wp 2 .
You might expect that the test function for a spherical neighborhood
is. Hausdorff further complicated the idea of test functions (even within the lower
This further refinement of the test function allowed Hausdorff to make assertions
about how this test function h(p ) behaved when the parameters p and d were
allowed to vary.
approached zero. The effect of this on our disc example is increasingly smaller
and smaller discs around points of the planar set. As the disc size is decreased,
fewer points of the set are contained in each disc neighborhood. This requires
more discs to cover the set. As the parameter p becomes infinitely small the
number of discs required to cover the planar set approaches oc. We allow the
20
and see what happens to the total area when the areas of the collection of discs
When we attempt to approximate the area of the planar set by the union of the
discs which make up its cover, we are essentially observing small patches of the
surface and approximating the area of the set by making assertions about the
intrinsic qualities of the patch. The notion that this measure is merely an
can expect that we will get a better fit with our patches and hence a better
there existed a unique real number d such that for d'<d. the infinum defined
by the test function using d' approaches oc (for any countably infinite set). And
for a d'>d the corresponding infinum approaches zero. This means that every
set has a parameter which can be associated with it that is closely related to the
These results only tell us that a number and function exist. They do
not tell us how to compute them in the general case. This gives us the quandary
allusions to, but can rarely compute (at least at the present time),
formalize the inttiitive discussion above. We first define what a ;>-measure of a set
For our example this would be the sum of the areas of the discs
21
Definition:
Let X be a space and p an arbitrary real number. ^ p <oo. Given e >0 let
where X = A + A + A* +
1 2
• •
is any decomposition of X into a countable
number of subsets of diameter less than e , and the superscript p denotes ex-
ponentiation. Let
If p <q then m p
(X) ^ m ?
(X); in fact p <q and mp (X) <oo imply m ?
(X) = 0.
the Hausdorff dimension is difficult to compute directly. In [Ref. l:pp. 14-19] and
[Ref 7], Mandelbrot expressed a distaste for the focusing of attention on the HB
dimension. He states:
''I developed the definition of fractals using the topological and Hausdorff di-
mensions in response to colleagues who urged me to do so. They felt that it was
necessary to rigorously define the concept within firm mathematical criteria. I
have come to believe that an empirical definition would be more beneficial at
this time because the present definition denies the inclusion of some shapes that
could best be described as fractals."
too difficult to deal with and is perhaps too restrictive. He prefers to focus on the
greater degree of accuracy then does the Euclidean model. The future may prove
the fractal model the superior method, however. The dimensional qualities of
22
4. Why Consider Dimension
For the purpose of this study, it is not important that a rigorous feel for
importantly, the dimension yields little intuitive insight: one is hard pressed to
and another with a dimension of 2.45. The pictures are much more descriptive.
and 2 then the object should be a very irregular curve. If the dimension of that
curve approaches 1 then the curve is probably not very rough and would lack any
interesting diversion from an ordinary plane curve. If the dimension of the curve
approaches 2 then the curve becomes like a plane or filled polygon and again
lacks appeal. The most interesting fractal curves are those which demonstrate
dimensions nearer the center of the scale between the standard Euclidean
dimensions. A similar argument can be made for solid objects with dimensions
between 2 and 3.
This is not to say that fractal geometry is not a powerful tool for the
The graphics programmer should not concern himself greatly with the
concern himself with the techniques of construction and the realism that is
achieved.
7
Mandelbrot's method for estimating the Hausdorff- Be.sicovitch dimension for non-random
sets built through self similar shapes will be introduced in section C after the hoch curve i>
described.
23
C. FRACTAL CURVES AND SETS
1. Definition of Fractal Sets
We take our definition of fractal sets from [Ref l:Chap 3 and pp. 361].
Definition:
A fractal set is a set for which the Hausdorff Besicovitch dimension strictly
exceeds the topological dimension.
is not very useful. The definitions of topological and Hausdorff dimensions are
Hausdorff dimension (if one desires complete rigor, typically the topological
dimension is derived by the least parameter approach (section 2)). When using
that creates fractal sets with a behavior that is disciplined and predictable. The
assumption is, since these methodologies are well behaved, that any set created
by these methods (with some careful restrictions) will itself be a fractal set.
WeT
are left with a practical methodology whereby we discover fractal
functional methods, prove that the set created is fractal, characterize the fractal
part of the functional method (carefully) and then enshrine that method as a
8
fractal method. If one's purpose is a practical application of fractal techniques
We use a geometrical shape (at first a straight line) and call this shape
8
A working model or equation where you are only concerned about the behavior and not the
exact mathematical properties.
24
transformations upon all current initiators (suppose there are m such initiators)
in the construction by applying the generator to all initiators. This creates a new
generator) sides where each side is a shape that is similar to the initiator. The
next step is to again apply the generator to all initiators.
infinitum. This functional process is well suited for recursion because the
and varies only to scale. It is also well suited for parallel processing (in the
initiators is independent.
These concepts are probably confusing at this point and were especially
difficult to visualize when they were first envisioned because the authors had few
tools beyond mental imagery to convey their point. This is probably why they
were largely ignored for 70 years. It is much easier to visualize these functions
differentiability. These equations were developed during the great debate on set
theory and were used by Cantor in arguing for his theory. These functions were
like none before, using constructions which played upon natural geometric
constructs but when combined with the power of infinite recursion became sets
which defied intuition. It was not until much later that mathematicians were able
to reconcile these functions with algebra and set theory. The function to be
The Koch curve is a very beautiful curve that at first gives the observer
the impression of a snowflake or a coastline (Fig 2.1). Mandelbrot uses this type
25
understand one method of obtaining a fractal set from a well defined non-fractal
10
equal length and join them to form an equilateral triangle . To construct the
generator we use four line segments that are each — the length of the initiators
and apply these to each initiator (Fig 2.1). This yields a new geometric figure
with 12 sides versus the original 3 and a total perimeter length of 4 units of
building the Koch curve. Observe how the progression develops to yield the final
- With each iteration of applying the generators the total perimeter length
- The length of the curve begins to increase without bound even though the
length of the initiator decreases to an infinitely small length. Hence the
curve's length unbounded with no point
is intersecting but yet is contained
in a small bounded two dimensional area.
- The points of the curve are by construction only the end-points of each
initiator and each point is clearly distinct from the other ( no two points are
connected).
- Although each point is distinct at any one level of the curve construction, it
can be proven that the curve when viewed in the limit is continuous at every
point.
- That due to the above qualities the curve is not differentiable at ANY point.
It is important to realize that the endpoints of the lines (initiators) are the only
points of the curve. The line only serves as a vehicle by which the points may be
easily determined. The exact same set could be built using 180° arcs as initiators.
The choice of an equilateral triangle was arbitrary. We could have chosen any shape as
long as it was made up of Initiators and avoided intersecting lines during recursion.
26
:
INITIATOR
GENERATOR N = 4
r = -
27
4. Mandelbrot's Dimension Approximation Function
fractal curve that is built using these constructs. In [Ref. l:pp 56-57], Mandelbrot
segment into N segments with each segment a part of the original segment such
that the sum of the lengths of the N segments equals the length of the original
segment. It follows then, that the sum of the ratios of the divided segments
/ . . \
Divided segment
lengths to the original segment length e.g. rs = —— ;
s
must
Original segment
equal 1.
N
£r s
= 1
s=l
We know that the dimension of a line is equal to 1. If we raise each of the above
Eh =1
Let's allow the Koch function to assume a similar dimensional relationship but
treat D as a real valued unknown. Refer once again to Figure 2.1. Notice that
the length of the four line segments that make up the generator have a length
ratio of — to the initiator. Call this ratio r m . Notice that the generator is made
s M = 1
11
CAUTION: This technique does not necessarily apply to other fractal functional
methods.
28
)
D
|rJ -
/ \ D
1
4 x = 1
3
D = -j^- % 1.2618
log3
dimension of a self similar fractal set but implies that a general dimension
G(D) = £ (r m
m=l * j
'
Mandelbrot claims that experimental evidence suggests that this equation holds
When each segment of the generator is a fixed ratio to the initiator (as is
the case with the Koch curve) then the solution to this equation is trivial:
lo 8(N)
D
l°g(—
can stretch the notational capabilities of the symbolic aspects of the inductive
I2
The Koch curve was proven to have a Hausdorff-Besicovitch dimension equal
O £J 4
I
~ 1.2618 and a topological dimension equal to 1, Hausdorff Dimension und au>seres \l iss
log3
29
except in a verbose and non-rigorous manner. It can be insightful however, to
dissect the beast (once!) and hopefully gain further intuitive insight.
but with a single line segment as the Initiator (versus the equilateral triangle).
fractal shape that is drawn to a partial function on: [0,1] X [0,1] -* [0,1] X [0,1].
(Basis)
Step
n = {(o.o,o.o), (i.o,o.o)}
(Induction)
Step k
Label the ordered set of 2-tuple points from" Step k-1 as:
where
n = 4(*-l) + i
n* = {P* P* 2 P* 3 ,...,P* m
1 }
where
m = 4* +1
where
P*! _
iJfc r>k-l
= P K ~\
Pk 5 = P k '\
Pk o = P k ~\
pk _ pk - 1
30
where
(p\,p* 7
,p* 8)
= P k ~\
[
2
R ]p*
3
'
~ k-\
C* 10/* 11/* 12) - Pk X
:
3R4
I pk pk pk ok -1 *-]
V-* m-3, r m-2, r m - l)=
1 ^ n-1 n-l^nj
and where the relation ,-iR. is the geometrical relationship between the two
end points of the initiator line segment from step k-1 and the five points of the
generator that compose the ordered subset for step k as above. For purposes of
brevity, the full functional definition for this geometrical relationship is explained
in detail in Chapter 4.
(Extremal)
technique.
as the Koch curve but with a reverse twist. Cantor's function takes an initiator
(the unit interval [0,1]) and dissolves it into a discontinuous set which is as rich
in points as the interval [0,1] but contains no interval itself [Ref. 6:pp. 22-23].
The points of the set are all distinct but the set has the same cardinality as the
unit interval. The best description for this set is that it resembles a dust.
is
Also referred to as Cantor's discontinuum or Cantor's triadic set.
31
Cantor's Dust is difficult to demonstrate on a graphics display because it
quickly dissolves below the resolution of the display. Refer to Figure 2.2 to
visualize the initiator and the generator. The initiator is a line interval [a ,6 ]
where ^ a < b ^1 and the generator is two intervals each — the length of
[6- (b
V
-a) x — ,6]. After the initial application of the generator to the unit
'
3
1 2
interval there will be two intervals in the current construction [0.
— ] and [
— ,1].
The second iteration of the recursive routine will yield four intervals
2 1 I t 8
[0.-1, [-,-].
1 J l J
[-,-] andJ
f-,ll.
l J
9 9 3 3 9 9
that is begun at the next application of the generator. This causes a series of
convergent sequences to each end point of each initiator. Thus each initiator
= 2
CANTOR'S DUST
INITIATOR £
GENERATOR * = °
5 1
i
• • • Initiating Structure: D
T =
The Interval [0,1]
HB = -6309
1st Iteration Initiator Length ^
32
spawns a convergent sequence toward its endpoints. But for each initiator there
are also two spawned sequences toward the center. It is possible to imagine this
as an infinitely dividing organism which leaves behind four points (eggs) each
computer graphics because it can be used to cause many special effects from
ordinary objects. Mandelbrot has used variations of this method to create images
to:
N / m
G(D) = £ rj = 1
m=l V
'
Where N = 2
Where Rm = -
3
log 2
D = -^£_=. « .6309
log 3
in the investigation of fractal functions. This can be expected because of the type
of functional building tools that are used for most of these sets. The relationship
of the generator to the initiator has similarity built in. Thus Mandelbrot is able
33
The functional method invented by Koch and Cantor is but one method
provides a vehicle for the creation of disciplined fractal sets but makes you
wonder about the rest of the space that fills the gaps between the standard
Much like the transcendental numbers (n and e for example ) in all their uncountably rich
expanse fill the gaps between the familiar (and well behaved) sets in R.
34
III. THE IMPLEMENTATION OF FRACTALS IN COMPUTER GRAPHICS
confront the issues of economy of scale between the infinite fractal function and
that when applied to physical objects quickly breaks down as soon as that object
(automata theory) and gain useful insight into possible capabilities of the
computer (the use of push down automata in compilers for instance). But in
order for automata theory to make assertions it is often necessary to make the
infinite. When the assumption of infinity is made, there are many powerful
considered to have an arbitrarily large but bounded space. The question arises,
answer is yes. but only in the context of some bounded space (for instance, the
problem is to use a passive sensor to detect stack overflow and notify the user
15
Functionally in the sense that the problem may be decidable but the solution space is so
large and undefined that it could not be determined in a reasonable amount of time.
35
that his problem is to large for the current stack space. Although the compiler is
computations and large amounts of primary memory. In order to use the fractal
function productively, we must manage the methods we use and produce a finite
active means.
equation. All fractal methods introduced in this thesis have a similar recurrence
16
fractal graphics .
limit of allocatable memory space. The formal definition of the Koch-like fractal
signal the beginning of the recursive ascent when this precision is met.
17
of the system stack which stores the program state on each recursive call . The
programmer should be careful to keep his local variables at a minimum in the
recursive subroutine. By doing so, the total data stored during each recursive
call is reduced.
16
Why should you try ? The recursive part of fractals functions is the mathematically beau-
tiful aspect which makes them so eloquent and powerful.
This could be the recursive termination event if you are not careful. It might be a good
idea to try this experimentally on your computer to determine this maximum recursive descent
distance.
36
3. The Computer Graph i cs Set Paradigm
The paradigm that is used for displaying objects on the raster graphics
primitives that allow the user a view of his modeling world as a largely
unrestricted three dimensional space. These primitives are limited in their power
and are usually based on the Euclidean geometry (lines, points, polygons etc.).
The user is required to supply viewing parameters that define a limited three
system which projects the objects contained in the viewing space onto a two-
dimensional space that is the display screen. The display screen can be divided
into discrete entities called pixels, each of which represents one point on the
[Ref. l]. This view is a departure from the normal view of the graphics
in describing objects but for the fractal graphics programmer the former is the
construction.
For this study, we view the world and the objects it contains as
through fractal techniques, the length of the pixel is a natural termination point
for the fractal recursive process. This yields an attractive bijective mapping from
18
All computer graphics is an abstraction; realism is achieved through deception of the eye
by a very small collection of colored points. Our goal then, is to find the most efficient method of
defining those points.
37
4. Summary
From our previous discussion, it should be obvious that fractal sets do
not exist in our computer. The sets that we create are finite approximations of
the actual set. The same is true of the fractal pictures that we create and to
bounded set space which has a one to one correspondence between the points
computed by the fractal equations and the entities of the screen. This abstraction
is appropriate because these entities called pixels (which are nothing more than
colored points) are the only components of the picture 19 . The only reason for not
set.
Most graphics software packages provide a means by which the user can
define the space on the display screen onto which he wishes to map. This is done
Many mappings are possible within the above constructs but for the
one to one (or bijective) relationship between the 3 pixel set and the real-valued
coordinate space in which we compute a fractal object. We develop this bijective
between generating points (in real coordinates) is less than the distance of one
pixel in the mapping of real to screen coordinates (SCR), Figure 3.1. This
mapping is explicit when the window, viewport and z- clipping are defined. This
mapping limits the number of pixels that can be associated with a given fractal
initiator to a one to one mapping of fractal parts to the pixel set. The size of the
In fact, this is the way the Euclidean graphics abstracts such as a line are mapped to the
screen. At some point in the display process this mapping must take place.
38
pixel is a cubic space which clumps together the infinite fractal space into a
discrete number of cubic spaces equal to the number of pixels in the pixel set.
The fractal programmer should choose his viewport and window carefully
so as to elicit the most attractive mapping possible between his object and the
screen. The viewport (SCR) rectangle should be defined such that the ratio of
the X distance (horizontal) to the Y distance (vertical) is equal to the ratio of the
X-Y distances of his (real-valued) window. The Z-distance (front and back
clipping plane distance) should be equal to the distance in the window
coordinates that defines the length of the pixel multiplied by the desired Z-depth.
X SCR WLD
SCR Y WLD
z
2
The Initiator Length Is Less The Pixels Were Mapped To
Than The PIXELSIZE, So Map Their Corresponding Position
The Points To The Pixel Set. In The Pixel Set.
39
1 ; —
Graphics Display
Terminal The Pixel Set
'User Defined Viewport
1 1 i
'
I : ,
'
'
'
1
1 I
•
i
'
'
: ! i ' : l
'
*-v~-
h :
'
;
:,
M
i
;
i
i i
i
1
i
'
i
'
.
i i
:
i < i i
'
!
'
'
:
i ! I
i
!
«e
|
'J.
Y Distance
II'' w *~
—
'ii
in WLD
=
' '
^ii i
'iifr?
T iT
-» t
H
I I I :
i
i i i i
:
..-K ;. -
.
5^E
3±Z t '
'
I I I I
i
' 1 I
i ' i
| I I I
X Distance
WLD
XwLD Z-Depth^D
PIXEL SIZE = Z-Depth pij
SCR PIXEL SIZE
40
If the above relationship holds then the size of the pixel in world coordinates
equal to the X (or Y) world distance divided by the number of pixels, Figure 3.2.
PIX SIZE =
XsCR
The front and back Z-clipping planes should be established such that the distance
from front to back is equal to the desired Z depth (expressed in pixels) multiplied
check:
2. Memory Requirements
The amount of main memory required by the fractal programmer is
directly proportional to the size of the pixel space that is being used to display a
represent a point in R 3
). The points can be computed by the function and
displayed on the screen in the immediate mode and then destroyed. The only
requirement for memory is the data that is germane to the program ("globals"
and thus fixed at run time) and the amount of data pushed onto the run-time
stack for the recursive calls up to the point of the deepest recursive level. This
computing the current generator with the input coordinates of the initiator. The
41
inductive nature of the fractal method provides data independence so that the
programmer does not have to have available to his subroutine all points
fractal method becomes just a part of the overall display process. The
programmer has the fractal process compute the points of the picture and these
points are stored in a memory structure. This structure is processed by a hidden
surface algorithm and a lighting algorithm and is then projected onto the screen.
memory. This however, can stretch the capabilities of most present day
computers. For example; if the pixel set is defined such that its dimensions are
20
would be an array of 10 9 x 24 bits or 24 billion bits.
buffer array can be used to store the current Z coordinate of the forward most
displayed pixel. By using this method the fractal computation can be made and
visibility of the point by checking it against any other point in the same position
on the X-Y plane. This technique reduces the above space requirements to
6 6
10 x 24 bits + (Z- buffer = 10 x 32 bits) 21 or 56 million bits.
requires a tradeoff between efficiency, realism and the memory space utilized.
The algorithms for hidden surface and lighting are well covered in the literature
and although they are integral aspects of the fractal realism issue they are not
germane to this study. Throughout the remainder of this study, we are not
" 24 bits for a machine assuming the RGB color system with 24 bit planes. Each color; red,
green and blue would then have 8 bits of precision.
1
Assuming the Z coordinate is stored as a 32 bit floating point number: this number can be
further reduced if we restrict the Z precision.
42
l
3. Concurrency
thai led up to the K :r sterf ~'r.~ mathematical process ::" ap; .y.r.g :':.< - -
the K level needs only the initiator data from the K— - step and reqoin
knowledge of the entire :"rac*a. sel Tne ••- 1 indue* ion - "hen
" To beat the hur -rid ach.-: graphics illusion, typkalh by completing
raster graphics i
generate (INITIATOR 2)
generate (INITIATOR 3)
generate(INITIATOR n);
end concurrent;
end main;
generate(INITIATOR I)
concurrent;
generate (INITIATOR 1)
generate(INITIATOR 2)
generate(INITIATOR 3)
generate(INITIATOR m);
end concurrent;
end generate;
44
IV. FRACTAL COMPUTATION IN R 2
graphics programmer with the basic tools for fractal computation and an
algorithmic template that can be used for many applications. The graphics
programmer needs to fully understand fractal programming within R" before he
can be described through a very simple set of data that captures the essence of
the Koch curve. The method introduced also allows us to vary the data which
The general strategy for computing generator points from a set of initiator
between the initiator and generator. The first line is the perpendicular from the
generator point to the initiator line. The second line is formed between the first
point of the initiator and the unknown generator point. All data to compute the
line equations are derivable from the two endpoints of the initiator or from
constant initiator/generator ratios. For simplicity's sake, we ignore the divide- by-
zero problems that are encountered when any of the lines are parallel to the X or
Y axis. These situations only simplify the computations and their solution is
demonstrated in Appendix A.
If we label the endpoints of the initiator as P =(X1 1
,Yj) and P : =(X : .Y : )
Y, - Y,
Slope, init =
X2 - X,
We must be careful in our terminology because the relationship described can draw shapes
that do not avoid self intersection and thus must be considered quasi-fract al.
45
The slope of the perpendicular intercept line is the negative inverse of the
Slope, perp =
Slope. init
+ X2
X.perp = —Xj (Generator. ratio. constant x )
The value of " Generator. ratio. constant" is a fixed constant (although it might be
interesting to randomize it) where you determine at what point the generator
intercept point intersects the initiator and express it as demonstrated in Figure
4.1.b. This ratio can be determined graphically, through hand calculation or via
With the slope and a point of the line (X.perp, Y.perp) we can determine the
To determine the generator line equation for the line segment which connects
the first point of the initiator and the unknown generator point, we need
constant information about the angle between the initiator and this line. This
angle is always constant with respect to the initiator and like the ratio
46
X Yg.j>Jif*+ Unknown
( gmn '
Generator Point
Generator Lin<
(x i >
x*>*
Initiator
(X >
Y J :
•Perpendicular Intercept
'unk
Gi
dist. a. dist . b
H
PiGi a.
Ratio-constant =
Gi P2 b
.' G,
/ e
\ e
47
We record the data about the angle as the tangent of the angle. With this
information, the slope of the generator line can be determined with the following
equation:
Y. intercept. gen = Y — l
(Slope. gen x X x)
The Cartesian points of the unknown generator point can now be determined
by intersecting the two line equations and solving for X (Figure 4.1. a) then
substituting X into one of the line equations and solving for Y . The
equations follow:
v
A8 =
,. .
Y. intercept. perp —
Y. intercept. gen
Slope. gen — Slope. perp
The constant data for the Koch curve that corresponds to this geometric
There are many different ways to build a generator given an initiator using
with the Koch function to discover new shapes. By varying the tangent of 6 and
the fixed ratio of Figure 4.1 we can describe new generator constructions. These
new constructions can be used in the same algorithms that compute the Koch
curve. We initiate the recursion on a generating structure built of line segment
25
initiators and allow the recursion to progress until a terminating event , creating
many diverse shapes. Figures 4.6 through 4.9 demonstrate some of these shapes.
48
The Koch
Point
_W_
Point
Generator
i
1 2 Point 3
i
i
i i
i i
P
>4-J P Pl
i
G P
2 3 8 3
draw the Koch-like curves that is equally valid. He calls his technique mid-point
displace a point from the mid-point of the initiator. This method uses many of
the same geometric relationships that are used above but provides a different
progression to the method of building the generator. This new view allows us to
look at the relationship between the initiator and generator in a slightly different
light. By so doing we are provided new insight as to how we might alter the
The mid-point displacement technique can be useful for two other reasons. It
is the best known method for fractal set building and because of this, it facilitates
have been developed use the mid-point technique. It also provides an easier
49
The Midpoint Displacement
Technique
,' i
V--- ^\
Figure 4.3.c Third Midpoint Displacement.
displacement. This yields the figure demonstrated in Figure 4. 3. a. The next step
performs a mid- point displacement on the left initiator created by step 1. This
yields the figure demonstrated in Figure 4.3.b. The third and final step is to
50
a
the displacement is above the initial initiator where in Figure 4.3.b it is below)
invert the position of point 1 and point 2 in the parameters of that procedure.
The parameter inversion changes the orientation of the initiator in space with
initiator input points. This operation implicitly defines the orientation of the
generator in space.
The geometry for computing the midpoint given two initiator points can be
computed in precisely the same manner as the intersecting line algorithm (The
Koch midpoint ratios are 1.0 and the angle is .437 radians). An alternative
method is to use the equations of a line (or a plane) normal. The second method
(utilizing the normal) provides a geometric relationship which is intuitively
appealing. Its appeal comes from the desire to modify the length of the
The mid-point displacement technique has some advantages over the line
along the normal (from the computed generator point to the initiator using the
of the desired displacement into an angle (the angle 9 (Figure 4.1.c) between the
initiator line and the unknown generator intercept line). The control of that
angle is less intuitive than the control of a displacement length. The geometry
for mid-point displacement using the initiator normal is introduced in Chapter 5.
The first algorithm (Figure 4.4) is a template that delineates the basic
processing steps. This recursive process is typical of fractal functions and can be
51
used as a template for many fractal programs. The second algorithm (Figure 4.5)
produce the data for Figure 2.1 and Figures 4.6 through 4.9. This program
demonstrates the precautions that must be taken to avoid divide- by- zero when
main()
{
{
generate(X(I) 1 ,Y(I) 1 ,X(I) 2 ,Y(I) 2 )
}
generate(X 1 ,Y 1 ,X 2 ,Y 2 )
{
52
main()
(
generate(X ,Y ,X 2 ,Y 2
1 1 )
{
plot.point(); /* Your Graphics Point Plotting Routine */
>
I* Load The Endpoints of the Initiator into the Generator Array '/
Generator. X[0] = Xp
Generator. Y[0] = Y,;
Generator. X[Number.of.generator. points + l] = X: ;
- continued-
53
/* Calculate Unknown Generator Point via Intersecting Lines
the */
for J=l; J<= Number.of.generator. points; J=J+1;
{
} /* End Generate */
54
D. IMPLEMENTATION STRATEGIES
There are numerous ways to display the fractal shapes that the above
algorithm is capable of computing. The graphics primitives required are limited
to the standard initiation and termination commands coupled with the ability to
plot a point (or alternatively a line). Any raster graphics system, plotter or
Figures 4.6 through 4.9 represent a few of the shapes that this algorithm can
compute. Each figure has the generator data used to compute the shape and a
E. SUMMARY
The line intersection algorithm as it stands is not very useful for the
results from its encapsulation of the essence of the non-random inductive fractal
method. This algorithm demonstrates the idea and intent of fractal functions and
programmer must throughly understand the salient parts of this chapter before
successfully attempting fractal images in three dimensions (i.e. before climbing the
55
t :
A Cloud-like Shape
Ini iat i ag Structure
1st Iter&ti
GENERATOR DATA
Number of points = 1
Pointl :
56
: :
Boxes Ad Infinitum
Initiating Structure
Equilateral Triangle
1st Tterati
GENERATOR DATA
Number of points = 3
Pointl
Angle = O.OOOO rads
Ratio = 1 OOOO
.
Point2:
Angl e = O. 7854 rads
Ratio = l.OOOO
Point3:
Angle = 0.4636 rads
Ratio = 200.00
57
: .
INIT.
.w \
1st Iteration
GENERATOR DATA
Number of points = 3
Poiatl
Angle = O. oooo rads
Ratio = O. 6687
Point2:
Angle = o 7854 rads 2nd Iteration
Ratio = 1 OOOO
Point3:
Angle = o. OOOO rads
Ratio = 1 50O0
58
.
INIT. GENERATOR
GENERATOR DATA
Number o f points = 8
Point 1 :
Ratio = 0.2000
Point2:
Angle = 1 OS3S rads
.
Ratio = 0.5000
Point3:
Angle = O. 7092 rads
Ratio = 2.0000
Point4:
Angle = O 3289 rads
.
Ratio = 4.0000
PointS:
Angle = O.OOOO rads
Ratio = O.SOOO
PointO:
Angle = O.OOOO rads
Ratio = 2.0000
-continued-
59
Orientation
r~\ pi~^
of points
pa
r\
After Second Iterat:
/ ^S Angles = neg V^ \
rientation
Or \ / Orientation
of points \ / of points
Pi
60
V. FRACTAL GEOMETRY FOR GRA P HICS TERRAIN
One of the most widely recognized fractal images found in the literature is of
the mountain scene. This type of terrain modeling is perfectly attuned to the
fractal technique. The reason for this is that mountains are highly irregular
shapes, with a rough but consistent texture when viewed from a distant vantage
terrain with computer graphics. It provides the blueprint for fractal graphics
computing resources that are required and the requirement to perform the
from that chapter and use standard compiiter graphics techniques to manage
those tools. To this framework, we add new fractal functions which provide the
provide realism. The artist might use chicken wire on top of *mall boxes as the
frame with modeling clay as the texturizing element. His choice of clay is
predicated by the type of look that he wants to achieve. The chicken wire
CI
provides an inexpensive and disguised method to quickly build the mountainous
shape and structure. This method minimizes the cost and time to build up the
clay.
The artist continues the modeling process after the development of the
basic mountain shape to achieve hues and contrast in the coloration. He might
achieve this by the use of natural lighting to cast shadows or by a careful
the essence of the above idea to guide us in developing a model for the discrete
describes the process intuitively and leaves the implementation details to later
sections.
divided into discrete cubic units by use of a concept from mathematics called a
lattice (in our case we can view it as three dimensional graph paper). This lattice
serves as our controlling structure, the equivalent of the chicken wire structure
relationships, where the number of lines evenly divides the boundaries of the pixel
space and each line is a constant distance from its neighbors. By this method, we
do not have to store the lattice but can express it as a mathematical function of
of the mountain that we wish to model. This can be done in many different ways
but should result in a stick frame model of the mountain (a connected polygon
that allows the programmer to select a ground level plane of the lattice and
provide a means to visually select points for the rough outline (essentially draw
62
A frame can also be developed using fractal functions to pervert the
lattice into a controlled random shape from a given plane of the lattice. This is a
powerful method that can be controlled via bounds on the random tools,
most useful when a class of mountain shapes are required but no particular
mountain needs to be modeled, i.e. when random landscapes suffice.
Alternatively, the stick frame of the mountain can be determined via manual
(hand computation) means. This approach is tedious and limited in its flexibility,
graphics clay to cover our stick frame model. This clay is a fractal function which
closes the polygons of the frame model with an inductive process that provides a
continuous pixel surface for the entire structure of the mountain.
is the frame described above and the generator is a similar geometrical shape that
reduces in size continually until it becomes the size of a pixel and is mapped.
After the stick frame of the mountain is developed, this texturizing of
the surface becomes an automatic process that terminates when each geometrical
shape that makes up the framework is reduced to a continuous set of pixels in the
pixel set. At this point, the mountain exists in the pixel set (memory) but must
be provided color and light to bring it to life.
The fractal function which texturizes the surface does not concern itself with
local computations so many overlapping pixels are mapped to the pixel set.
There are two reasons then, why we need hidden surface removal (in this case
back or hidden sides of the mountain by projecting only those pixels which are
visible along the axis of sight to the perpendicular planar surface of the display
screen. The second kind of hidden pixel removal is caused by mapped pixels
63
which were covered up by other recursive fractal descents either before or after
26
functionally denied access past the simplifying abstraction of graphics Euclidean
primitives. The fractal programmer must have access to this level of the graphics
mapping and thus can use simple techniques to determine if a pixel is hidden or
visible.
pixel elimination is through the use of Z-buffer algorithms. With this method, the
against the Z coordinate of the pixel currently in the pixel set at the same row
and column of the three dimensional array used to store the pixel set. If the pixel
is closer to the planar surface of the display screen, then the Z coordinate is
determined prior to the fractal recursive process so that the determination of the
line through the (now two dimensional) pixel set is known. The Z-buffer becomes
an adjacency matrix to the pixel set and can retain information about forwardly
displayed pixels only. All information is lost about other pixels that were
computed in the fractal process. If another view of the mountain is required then
the entire pixel set has to be recomputed with a new axis of sight. If the fractal
function uses (non-tabular) random techniques then the mountain varies with
each view.
* The abstraction provided by Euclidean primitives is a powerful one when the alternative of
pixel mapping is considered. Without some powerful mapping tool (such as fractal functions), the
pixel level modeling process is in general very difficult.
64
Most fractal pictures consume such vast computing resources that
only one view is computed for a given picture. As more requirements for graphics
terrain are determined, a more powerful method has to be used to retain all of
the computed pixels in the three dimensional pixel set. This method requires
that all pixels be stored in the three dimensional array previously described. The
hidden surface calculation can then be performed during the pixel mapping
has terminated.
Both methods are viable but the latter approach provides more
flexibility for the programmer whereas the first approach is a response to the
capacities geared toward fractal image computation, the first method can be
eliminated.
If you stood on the dark side of the moon without illumination, the
mountains and craters of the moon would not be visible. They still exist however,
intensities of pixels displayed on the screen. The color mixture of these discrete
points determines the lighting effect that a viewer perceives. This perception is
not reality but another deception caused by scale and composition. A lighting
model then, is one which is able to abstract the essence of color from a real world
27
An Ideal architecture is one with a large main memory and parallel processing capabilities
with K processing elements (where K is greater than the maximum recursive descent distance).
65
object and transform that essence into a set of color values (intensities) that
with diverse approaches to the same problem. Many of these models (like those of
interact with the physics of light reflection to create the spectrum of light that
our eyes decode. In a graphics image, this process has to be simulated with
discrete lighting intensity values for each pixel. Thus, the illumination of the
mountain is a two step process; the fractal entities that are mapped to the pixel
set must be provided with a basic color, and these colors have to be highlighted
The basic color can be determined during the pixel mapping event of
with the lighting algorithm. This color can add realism to the picture through
This type of heuristic combined with some random control structure (i.e. to vary
the snow peak) can provide for improved realism (versus making the whole
mountain brown). The process of determining the basic color must be
accomplished prior to applying the lighting algorithm since the lighting algorithm
can only vary the intensities of an existing color 29 . Developing the process of
basic color determination is best accomplished through trial and error. It is the
with casting shadows from one object to another given a direction from an
imaginary light source and with highlighting surfaces which are directly exposed
to the source. A surface is highlighted relative to the angle at which the light
"8
The Gouraud model (intensity interpolation shading) for instance
Since
Sine* so many diverse color models exist, the details of color representation are not
covered here
66
source's rays strike the surface. This poses special problems for fractal surfaces
noted above). It is beneficial to view the pixel set as a collection of pebbles which
have size and position. This abstraction allows us to view the pixel as a
continuous space that can block light (cast shadows) and for which an angle of
illumination can be determined (usually in conjunction with neighboring pixels).
space between adjacent pixels in the pixel set). Thus the surface can also be
viewed as a continuous (while very rough) surface where reflected light can be
One lighting model which fits the fractal process is the Torrance-
This model views an object as a collection of facets which is each a perfect reflec-
tor (i.e. does not absorb light). The orientation of each facet is given by the
Gaussian probability distribution function (i.e. the smooth surface of the Eu-
clidean object is roughed by the Gaussian relationship). The geometry of the
facets and the direction of light (assumed to be from an infinitely distant source.
so all rays are parallel^ determines the intensity and direction of specular reflec-
tion as a function of the light source intensity, the normal to the average sur-
face, the direction to the light source and the direction to the viewpoint.
This model has to be modified to adapt to the fractal set method. In the fractal
method, there is no need to rough the surface to provide reflection because the
each pixel space has to be determined and the geometry of connecting these
fronts identified. With these modifications to the lighting model, each individual
pixel's color intensity can be modified for the increase in intensity associated with
The model also allows diffuse reflection (light reflected from one
object to another) which is critical to bring out clarity of the fractal image. For
67
e. Summary of the Fractal Mountain Paradigm
To summarize the methodology we can view the process as a five
step process:
images within R3 . The list provides a basic set of programming tools to guide the
creation process.
The lattice (or controlling structure) can be very useful to the graphics
random progression of the fractal figure. The graphics programmer may wish to
limit the growth of the mountain by implementing a ground level plane of the
lattice and a maximum height that the mountain can obtain. He accomplishes
this by arbitrarily assigning another plane of the lattice as the upper bounding
plane. The height of the mountain can then be checked during any level of the
fractal recursive descent against this fixed plane. The programmer can then clip
the height by adjusting the random equation that controls the upward trend to
tend towards the ground again. This is an example of a heuristic applied to the
A fractal programmer can use the lattice to assign the initial colors to
the mountain via a user designed set of rules. The lattice aids the user in the
conditions (tree line to snow line etc.) and can be used in conjunction with
of the primary methods of control being the lattice or some derivative thereof. As
68
the height of the mountain increases (lattice level), it becomes increasingly more
likely that it will transition to another texture. This can be controlled by adding
pixel space is demonstrated in Figure 5.1. The actual lattice has been extended
from the pixel space in order to visually demonstrate how it relates to the pixel
set. In actuality, this is not the case. The lattice coincides with the boundaries of
the pixel space. Although the lattice can have a one-to-one relationship with the
pixel space, this defeats the purpose of the lattice (macro control). By grouping
cubic sets of pixels into a well-formed relationship, we can better implement
heuristics and bounding functions.
As a lattice example, consider a pixel space that is created by abstracting
the real world coordinate space for our mountain as described below. We desire a
real world space to be a cubic area established by the box 20.000 ft.
30
to be 1000 ft. and establishing the corner lattice point as (0.0, 0) .
The mapping function between the lattice and pixel space is then
8
: -=20 ft. and the lattice cubic sections contain 10 cubic feet or
1,000 ft.
The ground level can then be identified as the 2000 foot level and the
bounding height can be assigned a level of 10500 feet. If we wish, we can make
the bounding heuristic more realistic by sectioning the lattice into mountainous
69
The Lattice Control Structure
LATTICE
FRACTAL MOUNTAIN STRUCTURE
PIXEL SET
70
2. A Fractal Function for Contouring Mountains
demonstrated in Figure 5.2. Figure 5. 2. a shows a triangle with its first iteration of
mid-point displacement. This process continues until all triangles have reached
5.2.b. The precision is typically lower (pixel level) than that demonstrated in
Figure 5.2.b but it was terminated at a higher level to better demonstrate the
idea. Random techniques (described below) are used to produce the relatively
computational structure. Results have shown that very little randomness needs to
The mountains created for the film Star Trek: The Search For Spock used a
limited random number look-up table consisting of fewer than 300 entries [Ref.
-]
randomized displacement along the normal to the X-Z plane of a cartesian three
requires as inputs the points of the triangle. It computes the midpoints of each
line of the triangle and inscribes a triangle inside of the initiating triangle by
coincident with the plane of the initiating triangle. When we fix the X-Z normal
1
Any regular structure suffices; the triangle is easy to use and yields very satisfactory
results.
71
.
72
along the normal and determine a point, Figure 5.3.b. Since the normal is to the
normal and replace the midpoint with these new points. This yields a new
structure that still consists of four triangles but with each coincident with a
a. Midpoint of a Line in R 3
triangle is a simple process that uses the equation of Chapter 4. and fixes the
X, + x 2
Xmid
2
Y, + Y
Y mid
*
2
z, + z2
Z m id
The above equations completely determine the midpoints of the lines formed by
simple one. We need a factor such that the displacement can obtain a varied
Randvar = getrand(Seed);
Point l[y] = Pointl[y] + (Scale * Randvar);
73
Four Triangles are
created for each
triangle initiator
Computed displacement
X-Z plane
Positive Y displacement
74
A valid question is, why the normal to the X-Z plane? There are
three good answers to this question. Using the normal to a fixed plane simplifies
recursive division). It also is generally the direction that we want the mountain
to grow. The most important reason however, is related to the gapping problem
should be avoided.
utilizes a random displacement along the X-Z normal line. It is indirectly caused
by the data locality aspect of the inductive process of the recursive fractal
descent. The problem exists when two adjacent sides of two adjacent triangles are
not displaced with the same value. Each side is computed during independent
levels of the recursive descent so there is no practical method to communicate the
random numbers for the displacement.
If triangle A uses Rand = 0.3 and triangle B uses Rand = -1.07, then the
displacement for each adjacent midpoint (which are at the start coincident) is
skewed in the opposite direction. This creates a gap in the fractal landscape that
will (in all likelyhood) not be filled by other fractal shapes from neighboring
triangles. We need an algorithm which can insure that each midpoint (which is
always shared by two triangles) has the same displacement along the normal to
the plane.
75
d. Solving the Gapping Problem via Random Tables
displacement within the random table so that the random number returned is
their random numbers for M a . This can be facilitated by the inclusion of a table
seed for each recursive call to the midpoint displacement routine and by rotating
the orientation of the midpoint triangle (the triangle created by the three
computed midpoints) labeled T4 in Figure 5. 5. a. This rotation is performed in
relation to the random table and not in relation to the Cartesian space. It is
in Figure 5.5.b and for T4 as described in Figure 5.5.c. All four triangles generate
a recursive sequence and use the same seed to the random number table. The
random numbers retrieved from the table must observe the order of assignment
that is demonstrated in Figure 5.5.d. For example, the line segment formed by
the first two points (Pj and P2 ) input to the midpoint displacement routine
determine the midpoint Rj. This midpoint is assigned the random displacement
from the table corresponding to the entry seed. The next midpoint retrieves the
76
The Gapping Proble m
Gene rated random structure
common midpo i nt
77
b da
e
t3
mm
/ Tl >
Ip^iik
a \
Figure 5 5 . .
Figure 5 . 5 .
Figure 5 5 . .
i+l
Figure 5 5 . .
78
Main()
{
LOAD THE INITIATING TRIANGLE
Seed = 1;
frac_triangle(P j ,P 2 ,P 3 ,Seed)
frac_triangle(Pj,P 7 ,P 3 ,Seed)
{
Plotj>ixel();
return;
}
Seed = Seed + 3;
/* Triangle T, */
frac_triangle(M .P 2 ,M 2 ,Seed)
1
/* Triangle T2 */
frac_triangle(M 3 .M 2 ,P 3 ,Seed)
/* Triangle T3 */
frac_triangle(P .M, j .M 3 ,Seed)
/* Triangle T4 '/
frac_triangle(M 2 ,M3 ,M 1 ,Seed)
}
79
4. Random (Stocastic) Fractals
against the order that is displayed, our expectations about the rough reality of
nature are not satisfied. The use of randomness in generating fractal images is
Koch curve. Although it resembles a snowflake, it lacks the realistic look that
experience trains our eyes to see. In a mathematical sense, the Koch curve is
the inclusion of a random variable into the control structure within the fractal
error about a true value that normally occurs when measurements are taken of a
natural event. The symmetry that was observed from error measurement and
sampling suggested that there was a natural order to such observations. These
curve to the observed graph that behaves as probability requires (i.e. the sum of
the area under the curve equals unity). Many of the early scientists
32
Often referred to as the Gaussian distribution, the normal distribution is the standard bell
curve to which every student is accustomed.
80
referred to the normal distribution as the law of error in deference to its roots in
11] who formulated a least squares approach, published in 1809 in Theoria Motus
Corporum Coelestium. The form of the normal distribution was not finalized
We take our definition of the normal distribution from [Ref. 9:pp 18].
Definition:
f(x: M V "Ik
•exp
2a
2
SCALE:
horz vert
ss
Many mathematicians can lay claim to founding the normal distribution, most notably: Pi-
81
This definition is the general case of the normal distribution. We are
interested in the behavior of the function and need a practical way to determine
a random number that we can use in the parameter of the normal to the plane in
illustrated in Figure 5.8. The standard normal distribution function is the special
case where /i = and a = 1. This reduces the general equation to the simplified
equation:
i x"
f.M = exp
'2* T
The above functions describe the behavior of a normal random
variable. We need a function that returns values from that function which will
observe the period of the normal distribution. This means we need a string of
real numbers over an assigned range about a mean that will observe the
The Standard
^Normal (Gaussian)
SCALE: Distribution
Wz a 5
vert
/*= 0.0
(7= 1.0
N. (x) = 7±= e 2
>/iT
99.37%-
82
b. Standard Computer Random Functions
pseudo- random number. Such a function, when given a seed, will produce a
sequence of numbers distributed over the fixed interval defined by that system.
compilers of the system. A normal distribution routine must then be defined that
transforms the uniform random numbers into random numbers which behave
variable distributed over the interval [0,1] into an approximate normal random
variable over — oo < x < oo . This requires the uniform random variable to be
mapped into the interval [0,1] and then transformed by the normal
approximating function.
[0,max_int] while maintaining the distribution density, requires the following step:
UNF- 0ma ^ n
UNF I0>1]
=
max int
(
uses two uniform variables from [0,1], denoted UNF, and UNF 2
. and computes
NORM, -
>
/(-2log eUNF 1 cos(2*rUNF 2 )
S4
This is how most standard system provided computer subroutines perform the operation
83
Appendix B contains a C UNIX routine that implements an algorithm to
number generators from standard system subroutines. These routines vary widely
and can provide good to barely adequate results. When the normal
that his function adequately models the normal distribution. This process is
The purist may not accept the results displayed in Figure 5.9 as an
nature and minor random skewness will not deter us. If the programmer demands
a better approximation, it is a simple process to expand the sample space of the
test and build a table with exact proportions by selective deletion of skew
density.
The choice of which method to use depends on the programmer's application but
functional method but must by its definition limit the amount of randomness it
contains. The major issue however is the need to reproduce a figure under some
requirement for fixed terrain. This issue was the driving force for Loren Carpenter
from Lucas Film in determining that he needed to use a table driven method to
produce the planet images for the film Star Trek: The Search for Spock [Ref. 7].
He had to be able to fix a space where the images of the actors could be imposed
84
: . :
Experimental Reiulti
With Normalised
a.
Uniform Distribution
Transformation Equations Over [0.0,1.0]
From Uniform Distribution
Over [0,1] to the Normal 87
so-
Distribution Over -oo<x<oo
40- issgj 8
30-
N2 =y (-2lnU1 ) * cos(2KU
2)
2CT
::•
:•:
1Q-
N 2 = / (-2lnUJ ) * sin(2tU ) 59
58
o i o
Samp 1 e Spac e
SOO Random Events
29
.21 i .
18
12T
T' T T
' ,i ,
ri
i
85
onto the fractal images and could not allow the fixed space to change with each
frame computed. This is the major advantage of the table method. By retaining
confronted with basic questions about determinism and order in the universe. It
is not at all clear which rules chance. In any case, we can deceive perception
a variety of shapes computed with the same algorithm of Figure 5.6 using
numbers can suffice to provide enough local disorder to give the viewer the
rather than a discrete table method. As long as the goal of our computations is
merely to deceive the graphics viewer, it suffices to use the random number table.
The table must be large enough to provide for an appealing textural perception.
86
VI. SHORT CUTS TO MOUNTAIN SHAPES
Since the fractal mountain computation (the full approach with hidden
shortcuts that can lessen this burden. This is best realized by utilizing the hidden
surface and curve fitting capabilities that are provided on some advanced
graphics systems.
Our goal is to match the well known bicubic surface procedures with the
35
rectangle as the basic geometric building block. Most of the cubic surface
When the fractal algorithm of Figure 6.2 has its computations terminated
before reaching the level of pixel size, it yields a connected rectangle structure
like the one shown in Figure 6.3. This structure is a connected Euclidean
structure that can be used as a base on which other algorithms can be applied.
Cubic equations can fill the polygons to an arbitrary precision and standard
hidden surface algorithms can eliminate the hidden sides of the computed
36
achieve a realistic lighting effect . This is how Voss and Carpenter created their
procedure to split the midpoints of each side of the rectangle and a procedure to
find the center of the rectangle. From these five points, we construct four scaled
55
We actually use a non-planar four sided polygon. We refer to the basic structure as a rec-
tangle to simplify the terminology.
6
Couraud shading for example.
87
rectangles, as demonstrated in Figure 6.1. The five shared midpoints of the
generated rectangles are then displaced along the normal to the X-Z plane
according to a random Gaussian value. This process is exactly the same as for the
triangular algorithm of chapter 5. The gapping problem still exists and this
requires an algorithm to rotate the rectangle relative to the random number table
and the starting seed to insure that adjacent midpoints are displaced relative to
the same random number. The basic methodology is displayed in Figure 6.1, the
88
Computed
Four Rectangles Midpoints
are created for
each rectangu-
lar initiator.
Computed displacement
Y axis
'X-Z plane
Negative Y
displacement
89
Main()
{
LOAD THE INITIATING RECTANGLE
Seed = 1;
frac_rectangle(P j ,P 2 ,P 3 ,P 4 ,Seed)
}
/* Rectangle R 2
*/
frac^;ectangle(P 1 ,M 1 ,M c ,M 4 ,Seed)
/* Rectangle R 2
*/
frac_rectangle(M 2 ,M c ,M ,P 2 ,Seed) 1
I* Rectangle R 3 */
frac_rectangle(M 2 ,M c ,M 3 ,P 3 ,Seed)
/* Rectangle R 4
*/
frac_rectangle(P 4 ,M 3 ,M c .M 4 ,Seed)
}
90
Rectangular Mountain Fractal
Generating rectangle
91
B. PARAMETRIC CUBIC SURFACES
A complete description of parametric cubic surfaces is too involved to be
described in this study. The theoretical basis of cubic curves is not directly
514-536]. If the reader is already familiar with cubic curves and their derivations,
he can skip by the section on cubic curves to the section that details the
application of cubic surfaces. For any reader who has not been exposed to the
engines, it is recommended that he read the following section so that he may gain
curves is not a prerequisite to the successful use of cubic surface fitting engines
1. Cubic Curves
The general method of cubic curves has as its basis that any continuous
curve in R can be expressed in parametric form. This form relates the points
x,y,z with a parameter t such that as t varies within some range of values the
equations solve for unique points on the curve. Specifying two endpoints and two
of that segment. Once this vector product is established, we can solve for points
on the curve by picking discrete values of t and solving for x. y,z in turn. This
Because we deal with a finite segment of a curve, we limit the range of the
92
parameter t to the range, ^ t ^ 1. This yields the equations:
x(t) = a xt 3 + b x t 2 + c xt + dx
y(t) = a t3 + b t2 + c t + dy
y y y
3
x(t) = [t t
2
t 1]
This vector product separates the distinct parameters of the parametric equation
into the unknown coefficients of x(t); [a x 'D x c x^x] an(^ ^e parameter t that we
wish to manipulate. Through this separation, we are able to manipulate them as
algebraic entities. If you multiply the vector product out. you find that the
vector product is equivalent to the parametric equation that precedes it. Denote
3
T = ft t
2
t 1
and
equation x(t) evaluated at the bounds of the range of the parameter /. (i.e. t=0
and t = l). We consider four equations of x(t) and its first derivative x'(t) where
93
and since the first derivative of x(t) is:
x'(t) = [3t
2
2t 1 0]C X = T'C X
We now have four equations that can be grouped into a vector product:
x(0) 1
x(l) 1111
x'(0) 10
x'(l) 3 2 10
We recognize that x(0) and x(l) are the endpoints of the curve
segment and x'(0) and x'(l) are components of the tangent vector at the
endpoints (y'(t) andz'(t) are the other components). With this knowledge we
are able to solve the left hand side of the equation above. These points (that we
38
call Pj through P4 ) are the control points that we establish for curve fitting .
For a given curve segment the control points are fixed. We rewrite the equations
1 1 1 1
3 2 1
Gx = MC X
The matrix Gx is often referred to as the geometry of the cubic curve and M as
the basis.
If we establish ourselves as servers then these four points are the user's input to our rou-
tine.
94
parametric equations. We can solve this equation for these parameters and
establish the parametric equations with the only unknown being the parameter /.
The parameter t can be discretely varied over its range of ^ t ^1. providing a
set of points on the curve. It is through these constraints that the control points
control the parametric equations and produce an equation that can produce a
discretely sampleable curve segment in three space. Solving the equation for Cx is
straightforward:
CX =M 1
GX
39
Substituting Cx into the equation for x(t) yields :
x(t) - TM 'G x
y(t) - TM-'Gy
z(t) - TM'G,
The matrix M _1 is constant for all three equations and is usually
that the models Bezier, B-spline, Cardinal Spline, Ferguson (Hermite or Coon's)
surface etc. modify the parametric equations and provide different curve fitting
engines.
computations. To use the model requires the determination of the control points
(in conjunction with how they relate to the curve) and a vector multiplication
engine. Since vector pipeline computations are ideally suited to computers, this
method becomes a fast technology for curve fitting with an intuitive appeal for a
programmer.
95
b. An Example: Bezier Cubic Curves
We consider the model called Bezier [Ref. 8:pp. 514-536]. The Bezier
model defines the position of the curve's endpoints and uses two other points (not
on the curve) which define tangents at the curve's endpoints (by the line segment
x(0)=P 1
x(l)=P 4
x'(0) = SfPr-PJ
x'(l) = 3(P 4 -P 3 )
1 3 -3 1
3 -6 3
G,
3 3
1 3 -3 1
Pi
3 -6 3 P 2
s z
x(t) = [t t t 1]
3 3 P3
1 P.
96
Bezier Curve
Tange nt, defined by
P P line segment.
Tange nt defined by
P P „ line segment.
4 <1
substituting values along the range of t and fitting the curve by connecting each
point with a line segment. This provides an approximation to the curve that can
smaller lengths.
decreasing the two endpoint tangents formed by the four control points. It can be
viewed intuitively by thinking about each tangent as a force which pulls the
curve in the direction of the tangent until the force from the other endpoint
overcomes the original at the midpoint. The two endpoint tangents work against
2. Bezier Surfaces
adding a new parameter s that we vary from 0^5 ^ 1 as we did with the
97
parameter t in cubic curves. The connection between cubic curves and surfaces
can be made by fixing one parameter and varying the other over its range. This
yields a cubic curve. The equation is of the form x(s,t) and is written as:
x(s,t) = a n s 3 t 3 + a 12 s 3 t 2 + a 13 s 3 t + a ]4 s 3
x(s,t) = SC x T e
where S = [s
3
,s
2
,s,l], T = [t
3
,t
2
,t,l] and T fc
is the transpose of the matrix T.
section. Its details are covered in [Ref. 8:pp. 524-536]. The equation for a Bezier
x(s,t) = SMbQ^^T*
where Mb is the same matrix as in the curve equation, Mb 1
is its transpose and
surfaces are intuitive in their appeal and serve the fractal rectangular mountain
well. To apply the technique to the mountain of Figure 6.3 requires the
application of a routine that takes the non-planer four sided shape of a computed
initiator and develops a connected sixteen point figure as illustrated in Figure 6.5.
The inclusion of a Bezier subroutine at the recursive termination event after this
figtire is developed matches the sixteen point figure with a smooth curve. To
achieve edge continuity requires that adjacent sides have the same four points in
98
— ,
Qx for R, =
Qfor R, =
99
VII. CONCLUSIONS
a great need for refinement and exploration. What is known needs to be refined
into a set of workable techniques with reasonable, simple terminology as its root.
The areas that are unknown need to be explored intrepidly. With this goal in
mind, the following paragraphs quickly review some areas of prospective research.
paradigm are waiting to be discovered. This area of research is especially good for
the graphics programmer since the graphics medium is currently the best method
for fractal experimentation. As these new functions are developed, they can be
The current state of the art in computer graphics lighting models lacks a
complete model for the pixel set paradigm that was introduced in Chapter 5.
lighting model that was discussed in chapter 5. A good pixel set lighting model
would open the avenue of complex terrain modeling to a much wider audience.
4
Nature's fractal map?
As evidenced by the fractal pictures that have been published.
100
3. Fractal Music
techniques to — noise and has produced interesting if not pleasing tonal results.
coupled with vast memory resources. A real-time fractal terrain image generator
it is time that trained mathematicians tackle the problems associated with the
42
imprecise and unworkable current definition of fractal sets . That definition uses
42
Sadly, there has been little attention from the mathematical community, although that is
changing. It is with great timidity that ones accepts fractal geometry without such scrutin>
101
B. CONCLUSIONS
Fractal geometry is an old idea that has found a new application with the
advent of computer imaging techniques. Its acceptance, has spawned a great deal
of research and has provided a new tool to observe nature through a different
perspective. We must be careful to insure that our findings are in fact valid. We
also must begin the coalescence of the many techniques that have been developed
in order to control the growth of this concept and to attain true scientific
It is the hope of the author that this work has illuminated the subject of
fractal geometry and that it will aid others in their research. The purpose and
essence of fractal geometry is based on simple concepts. The reader must not be
overawed by the current literature and should retain his perspective with a mild
of fractal geometry has not yet been realized. In the final analysis, we expect
that even the skeptical reader will discover the mathematical beauty and
102
APPENDIX A: FRACTAL COMPUTATION IN R 2
The first routine is the main routine which initializes the data for the Koch curve
generator and initiates the recursive process on each side of the initiator triangle.
The second routine is the recursive subroutine which performs the generator
KOCH.C
/*
This is the main program which controls the initialization of
the koch generator parameters and initiates recursive operations
on each side of the initiator triangle.
*/
f define x
$ define y 1
103
2
/* Local variables */
int I;
( 'ur point [
1 J
[x] 5.0;
Cur point[l][y] - 3.0;
4
/* Remember to close the side of the triangle /
Generator points = 3;
/' Angle (in radians formed between init point 1 and gen point
for demo) '
/
it) 4
/<•
r '
'
"
i
r v
GENERATE.C
/*
This subroutine computes the generator from a given set
of points in R 2
that define a line segment which is the
initiator. The routine is recursive and terminates at a predefined
precision that is input to the subroutine.
7
/* External global generator data; defined in main subroutine */
extern int Generator joints;
/* The number of points in the GENERATOR */
extern double Gen_angle[lO|;
/* The angle formed between init joint 1
and gen joint */
extern double Gen_ratio[lO];
/* The between init joint 1 to gen joint and
gen joint to init joint2 */
extern double Tan_theda[lO];
/* The tangent of the angle formed between
init joint 1 and gen joint */
generate(Xl,Yl,X2,Y2.precision)
/* Parameter variables */
double XI, Yl,X2,Y2, precision;
{
/* Local variables */
long N;
double Parray[3][2];
double G_point[lO][2],DIST;
double Slope _init, Slope perp, Slope gen;
double X jerp,Y jerp,b jerp,b_gen,TEMP:
double ten_thousand, one, zero, minus jne;
int I, J;
/* assign constants */
ten thousand = 10000.0; one = 1.0; zero = 0.0; minus one = -1.0:
106
/* The Koch curve is defined in the infinite but our re<-
{
"
/* Put your Point plotting routine here
printf( "polyline 2"):
c
printf(" xf %l 0.000000". Xl.Yl :
c cw
printf(" 7.f cf 0.000000". X2.Y2 :
return;
/* Put INITIATOR points one and two into the first ar. :
Gjoint'l[l] = XI;
G_point[l][2J= Yl;
G_point[Generator_points +- 2j lj = X2:
G_point[Generator_points -2 2= Y2:
107
/•* Determine the slope of the line formed by the init _pointl
and init joint2. This is the slope of the INITIATOR */
if (X2 != XI)
{
if (Y2 != Yl)
{
Slope Jnit = (Y2 - Yl)/(X2 - Xl);
}
else
{
Slope_init = 0.0;
}
else
{
/* We can't have infinity in a register
so settle with 10k */
Slope_init = ten_thousand;
}
/* For each GENERATOR point (except end points as they are equal
to the INITIATOR end points) find the X,Y values. This is
108
/* If the angle of the INITIATOR point 1 and the GENERATOR
point in question is zero then the GENERATOR point is
if ( Gen_angle[I] == zero )
G_point[I+l][l] = X_perp:
G_point[I+l][2] - Yjperp:
}
else
{
/* Condition one of STATE 3 */
if ((Slope_init == zero) |
(Slope_init == ten_thousand))
{
/* STATE 1 */
109
if (Slope_init == ten_thousand )
{
/* STATE 1 condition 1; INITIATOR is parallel
Y axis
to the */
G_point[I+l][2] = Yj>erp;
G_point[I+l][l] = (G_point[I+l][2] - b_gen)/
Slope_gen;
}
else
{
/* STATE 1 condition 2; INITIATOR is parallel
X axis
to the */
G_point[I+l][l] = X j>erp;
G_point[I+l][2] = Slope_gen *
G_point[I+l][l] + b_gen;
}
}
/* END STATE 1 */
else
{
/* STATE 3 */
Slope_perp = (minus_one)/Slope_init;
G_point[I+l][l] + b_gen;
}
}
/* END STATE 3 cond. 1 if */
110
else
{
/* STATE 2 */
Slope_perp = (minus_one)/Slope_init;
b_perp = Y^perp - (Slope j>erp * X_perp):
if (Slope_gen == one)
{
G_point[I+l][l] = XI;
G_point[I+l][2] = Slope^perp * G_point[I+l][l]
+ b_perp;
}
else
{
G_point[I+l][2] = Yl;
G_point[I+l][l] = (G_point[I+l][2| - b_perp)/
Slope_perp;
}
} /* END IF 7
} /* END FOR 7
/* Start recursion on each line formed by the generator from
right to left */
111
)
generates a 500 entry table of random numbers that observes the period of the
standard normal distribution. Following this routine are statistics that verify the
transformation.
rand_table_gen (
{
/* Local Variables */
int I,J;
pi = 3.1415926535;
112
/* Determine the range for the random numbers of UNIX UCB "/
range = 2;
for (J=l; J<=30; J++)
{
range = range *
2;
}
range = range - 1;
srandom(475836);
{
/* Get a uniform random number through the Unix C subroutine */
UNF1 = randomQ;
UNF2 = randomQ;
factor = 1.0;
if (log(UNFl) < 0.0) factor = -1.0;
RAND[I] = sqrt(factor
+
(2.0 * log(UNFl))) *
cos ((2*pi*UNF2));
RAND[I] = RAND[I] * factor;
factor = 1.0:
sin ((2*pi*UNF2));
RAXD[I+1] = RAND[I+1] * factor;
}
return;
113
VERIFYING STATISTICS
The UNIX UCB operating system's uniform distribution random number
generating function spans the interval defined by its integer range. For a VAX
11/780 implementation this is equivalent to 2 31 - 1 or [0,2147483647].
The random number seed was assigned the value of 475836. The UNIX UCB
random number generator with a fixed seed yields a fixed sequence of numbers
returned from the function, uniformly distributed over the range. This yields a
valuable function if the table needs to be reproduced with the same sequence
after transformation.
The table below shows the results of the uniform distribution sequence after
it was squeezed into the interval [0,1]. These results show that the uniform
0.0 -* 0.1 = 52
0.1 -> 0.2 = 47
0.2 - 0.3 = 44
0.3 -> 0.4 = 49
0.4 -+ 0.5 = 49
0.5 -* 0.6 = 47
0.6 -> 0.7 = 51
0.7 -* 0.8 = 57
0.8 - 0.9 = 48
0.9 -> 1.0 = 56
numbers as described in the above table. This is the data which was used to
build Figure 5.9. The transformation is acceptable for the purpose intended, that
114
Analysis of the normal (Gaussian) random numbers
X <= -2.75 = 5
-2.75 < X <= -2.25 = 8
-2.25 < X <= -1.75 = 16
-1.75 < X <= -1.25 = 29
-1.25 < X <= -0.75 = 56
-0.75 < X <= -0.25 = 88
-0.25 < X <= 0.25 = 115
0.25 < X <= 0.75 = 87
0.75 < X <= 1.25 = 59
1.25 < X <= 1.75 = 21
1.75 < X <= 2.25 = 12
2.25 < X <= 2.75 = 4
2.75 < X =0
115
C
APPENDIX C: THE TRIANGULAR MOUNTAIN
The first routine is the main routine which initializes the generator data for
the initiating triangle and initiates the recursive process. The second routine is
the recursive subroutine which performs the generator replacement until the
parameter.
MOUNTAIN.
/*
This is the main program that controls the initialization of the triangle
initiating structure and initiates the recursion on that triangle. The
recursion will proceed until the recursive termination event (defined
by the precision global parameter)
*/
/* Global Defines */
# define x
f define y 1
^define z 2
/* Global Tables */
double RAND[500];
double Precision;
double Scale;
116
/* BEGIN MAIN PROGRAM */
mainQ
{
/* Local Variables */
int I,J,K;
double P1[3],P2[3],P3[3];
int Seed;
Pl[x] = 4.5;
Pl[y] - 3.25;
Pljz] = 0.0;
P2[x] = 7.0;
P2[y] = 3.25;
P2[z] - 0.0;
P3[x] = 5.75;
P3[y] = 3.25 + sqrt(((2.5 * 2.5) - (1.25
+
1.25)));
P3[z] = 0.0;
rand_table_gen();
mountain_generate(Pl,P2.P3.Seed);
/* END MAIN */
117
; C
GENERATE MOUNTAIN.
/*
This is the subroutine that computes the four generated triangles from
an initiating triangle. The routine is recursive and terminates at a
predefined precision defined in the global parameter Precision
r
^include <math.h> /* Standard math include file for UNIX lib */
f define x
# define y 1
# define z 2
/* Global Structures */
/* Parameter variables */
double P1[3],P2[3],P3[4];
int Seed;
/* Local variables */
int I,J;
TWO = 2.0;
118
; /
{
/* Put your polygon plotting routine here */
printf "poly gon3 "
(
)
MO/
printf( of %f %f\Pl[x],Pl[y],Pl[z]):
printf("%f %f %f \P2[x],P2[y],P2[zj):
printf("%f %f %P',P3[x],P3[y],P3[z]);
return;
{
Pmidl[I] = (P1[I] + P2[I]) / TWO;
}
{
Pmid2[I] = (P2[I] + P3[I|) / TWO;
}
{
Pmid3[I] = (P3[I] + P1[I]) / TWO;
}
119
/* Adjust the Y coordinate => normal from Z-X plane */
mountain_generate(Pmidl,P2, Pmid2,Seed);
mountain_generate(Pmid3,Pmid2,P3. Seed);
mountain_generate(Pl, Pmidl,Pmid3,Seed);
mountain_generate(Pmid2,Pmid3,Pmidl,Seed);
/* END generate */
}
120
C
The first routine is the main routine which initializes the generator data for
the initiating rectangular shape and initiates the recursive process. The second
routine is the recursive subroutine which performs the generator replacement
until the recursive termination event is reached, which is defined by the precision
parameter.
RECTANGULAR-MOUNTAIN.
/*
This is the main program that controls the initialization of the rectangular
initiating structure and initiates the recursion on that rectangle. The
recursion will proceed until the recursive termination event (defined
by the precision global parameter)
7
^include <math.h> /* Standard UNIX include file for math library */
/* Global Defines */
fdefine x
# define y 1
# define z 2
/* Global Tables */
121
/* BEGIN MAIN PROGRAM */
main()
{
/* Local Variables */
int I,J,K;
double P1[3],P2[3],P3[3],P4[3];
int Seed;
P2[x] = 6.0;
P2[y] = 5.0;
P2[z] = 1.0;
P3[x] = 7.5;
P3[y] = 6.5;
P3[z] = 3.0;
P4[x] = 3.5;
P4[y] = 6.5;
P4[z - 3.0;
mountain_generate(Pl,P2,P3,P4.Seed);
/* END MAIN */
122
C
§ define x
$ define y 1
# define z 2
/* Global Structures */
mountain_generate(Pl,P2,P3,P4,Seed)
/* Parameter variables */
double P1[3],P2[3].P3[3].P4[3);
int Seed:
{
/* Local variables */
int I,J;
double Pmidl[3].Pmid2[3],Pmid3[3].Pmid4[3],Center[3];
double TEMP,DIST.T\VO.FOUR:
123
;
{
/* Put your Polygon output routine here */
printf ( "polygon4 " )
printf("%f %f %f",Pl[x],Pl[y],Pl[z]);
printf("%f %f %f\P2[x],P2[y],P2[zj):
printf("%f %f %f\P3[x],P3[y],P3[zj):
printf("%f %f %f*,P4[x],P4[y],P4[z]):
return;
{
Pmidl[I] = (P1[I] + P2[I]) / TWO;
}
{
Pmid2[I] = (P2[I] + P3[I]) / TWO;
}
{
Pmid3[I] = (P3[I] + P4[I]) / TWO;
}
{
Pmid4[I] = (P1[I] + P4[I]) / TWO:
}
124
/* The four sided polygon is non-planar so average the xyz-displacement
for a best approach */
fit
{
Center[I] = (P3[I] + PI [I] + P4[I] + P2[I]) / FOUR;
}
/* END generate */
}
125
APPENDIX E: GEOMETRIC SUPPORT
Many fractal applications and computer graphics models use the normal to a
devoted to two tools for determining the plane equation of a polygon and the
One of the most common forms of a planar equation is the general form. This
Ax + By + Cz = D
With three points on a plane, you can determine the planar equation by
computing the coefficients. This approach utilizes the determinant form of the
x - x1 y - y l
z - zj
x2 ~ x l Y2 ~ Yl z2 ~ zl =
x2 - x i
y~2 - yi z2 - zi
Cl x - x 2 —
C2 X = x 3 -
Cl y = x 2 -
C2 y = x 3 -
CI. = x 9 -
C2. = Xo -
126
Evaluating the determinant using the diagonal approach yields:
Solving the equations for x,y and z in terms of the constant expressions:
A = Cl C2 z - Cl z C2
y y
B = Cl z C2 x - C1 X C2 Z
C = Cl x C2 y - Cl y C2 x
D = -[A Xl + B yi + CzJ
Once the parameters A,B and C have been determined, the solution of the
linear equation for any normal to the plane is straightforward. Using the plane
parameters in the parametric equation for the normal line to the plane and using
X = * kwn + c A
Y = y kwn + c B
Z = z kwn + c C
127
LIST OF REFERENCES
128
INITIAL DISTRIBUTION LIST
No. Copies
2. Superintendent 2
Attn: Library (Code 0142)
Naval Postgraduate School
Monterey, California 93943
*
5. Michael Zyda (Code 52Zk)
J. 2
Department of Computer Science
Naval Postgraduate School
Monterey, California 93943
9. Capt. H. McArthur 1
129
10. Richard W. Hamming (Code 52Hg)
Department of Computer Science
Naval Postgraduate School
Monterey, California 93943
130
Thesis
G1223
216443
Th'c.l Gaddis
iGl
of nature- e
7 S °metr y
I
m tica i
Vr
the -
f basis ?n
plic ap ~
ation to
Com Puter
graphics.
lft 02g
216443
Gaddis
The fractal geometry
of nature; its mathe-
matical basis and ap-
plication to computer
graphics.
thesG1223
The fractal geometry of nature; its mat