Home » Archimedes archive » Archimedes World » AW-1991-09.adf » AWSept91 » !AWSep91/Goodies/PD/QRTinfo/Discuss

!AWSep91/Goodies/PD/QRTinfo/Discuss

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1991-09.adf » AWSept91
Filename: !AWSep91/Goodies/PD/QRTinfo/Discuss
Read OK:
File size: 2B7B bytes
Load address: 0000
Exec address: 0000
File contents
   This document discusses:

     The transmission of light in the QRT world
     Removing sections from a planar object


Transmission of light
=====================
 
   Transmission of light through surfaces now works, allowing one to model
glass surfaces. Some additions to and changes from the original grammar were
necessary to provide the desired functionality. A new keyword, "DENSITY",
has been added, and the function of the old "TRANS" keyword has been
changed. Also, a "THRESHOLD" parameter has been added to the default
structure. Since transmission is a complex operation, this entire Addendum
will discuss aspects of modeling glass surfaces.
 
The DENSITY keyword
~~~~~~~~~~~~~~~~~~~
 
   It was my previous intent that the TRANS keyword would specify the
percent transmission of light though the surface. After thinking a little
more about the nature of light transmission, it was clear that this wasn't
adequate. The amount of light transmitted depends not only on a fixed
coefficient of the surface, but on the thickness of the surface. For
example, a hollow glass sphere will appear darker (transmit less light) near
the edges, where the glass is thickest. To account for this effect, the
"DENSITY" keyword was added. Density specifies what percentage of
transmitted light will be removed per unit distance travelled though the
object. For example, the following density attribute would remove 2 percent
of all light per unit distance:
 
   DENSITY = (.02, .02, .02);
 
   If a sphere, at its widest point, was 10 units thick, 20 percent of the
light would be removed. Near the edge of the sphere, less light would be
removed.
 
   Since density is a function of distance, the same density factor will
have different effects on objects of different sizes. To remove the same
percentage of light from an object half as thick, double the density factor.
 
Shadows from Transparent Surfaces
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
   The old "TRANS" keyword still exists, but it performs a different
function. It does not affect the appearance of the object, but rather, the
attenuation of light passed through the surface. QRT knows how glass
surfaces bend light, and so it can model the magnifying effects of looking
through curved glass, etc. But for computing shadows, it cannot properly
bend the light from lamps. This means that you can model lenses that the
observer looks through, but not lenses used to focus light. In order to
provide some attenuation effects, use "TRANS" to tell QRT how much light is
passed through the surface. This information is ONLY used for computing
shadows. For example, blue glass should cast a blue shadow. Use something
similar to:
 
   TRANS = (0, 0, .7)
 
to cast a blue shadow (this lets 70 percent of the blue light pass). Note
that by using strange combinations of DENSITY and TRANS, you can model
illogical objects which appear, for example, blue, but cast a red shadow.
These shadows will be entirely of one intensity, and will not vary with the
thickness of the glass.
 
Using MIRROR with Transparent surfaces
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
   Glass surfaces not only refract light, but also reflect a percentage of
it. This means that to realistically model glass, the glass should reflect a
small percentage of the light. Try starting with 20 to 25 percent
reflection. Note that all glass objects reflect light from both the outside
and the inside surfaces of the glass.
 
Index of Refraction
~~~~~~~~~~~~~~~~~~~
 
   The index of refraction for an object governs how much the light is bent
upon entering or exiting the object. A higher index will bend the light
more. The index of refraction of air is 1.00, and for glass is roughly 1.33.
Some substances, such as diamond, have a higher index.
 
Modeling Hollow Objects
~~~~~~~~~~~~~~~~~~~~~~~
 
   When designing the QRT transmission routines, I wanted to be able to
model both solid glass and hollow glass objects. To understand how this is
done, it is necessary to understand a little about how QRT's transmission
model works.
 
   A ray, after leaving the observer, has two states: either it is inside a
glass object, or it is outside. The ray starts out outside. When it first
encounters a glass surface, it is bent, and its state is toggled from
OUTSIDE to INSIDE. It continues on until encountering another surface,
whereupon it is bent again, and its state is once more toggled. This has
several implications for modeling glass. The first is that ALL glass
surfaces MUST have two sides - that is, once the ray enters the glass, there
must be no way for it to exit without again passing through a surface. The
second is that a ray must go from glass to air, or air to glass, but not
from glass with index of refraction A to glass with index of refraction B;
i.e, the two glass surfaces cannot touch each other, even though they may be
placed very close together.
 
   As an example of how this works, consider a solid glass sphere. The ray
encounters the sphere, and is bent (in this case, towards the normal
vector). QRT now remembers that the ray is INSIDE a glass surface. The ray
continues on until it hits the back side of the sphere, whereupon it is bent
(away from the normal vector), and its state is toggled to OUTSIDE. In
summary, the INSIDE/OUTSIDE flag tells QRT how to bend the ray.
 
   Consider now the case of a hollow glass sphere. This is modeled using two
concentric spheres, one with a smaller radius. The ray will first hit the
outside sphere, be bent, and have its state toggled to INSIDE. There are now
two possible cases. First, the ray may miss the inside sphere, in which case
the simulation proceeds as in the above paragraph. Second, it may hit the
inside sphere. In this case, it is bent, and its state is toggled to
OUTSIDE. The ray is now considered to be back in air, so that the inside
sphere has modeled the hollow portion of the glass. In a similar manner, the
ray reaches the other side of the inside sphere, enters the glass again, and
finally leaves the outside sphere. Note that even though the inside sphere
is thought of as the "air" in the center of the object, it MUST have the
same index of refraction as the outside sphere. This is necessary so that
QRT can correctly bend the light when it exits the glass.
 
Chromatic Aberration
~~~~~~~~~~~~~~~~~~~~
 
   In QRT, all rays, regardless of color, are refracted exactly the same.
This is contrast to the real world, in which the amount the light is bent
depends on its wavelength. This appears, so far as I can tell, to be a bug
in the real world, and I saw no reason to include it in a ray tracer.

Threshold attribute
~~~~~~~~~~~~~~~~~~~
 
   A new keyword, THRESHOLD, has been added to the default structure. In
previous versions of QRT, there was a mechanism for detecting infinite
recursion provided that objects reflected less that 100 percent of the light
reaching them. QRT stopped the recursion when the intensity of the light
reached 1 percent of its original value. When transmission was added, I made
this value adjustable. With glass objects, both surfaces reflect light, and
if QRT waits until the 1 percent mark before stopping recursion, the time
necessary to complete the image is greatly increased with little or no
increase in image quality. The default is now 10 percent, and is changeable
as follows:
 
   DEFAULT ( threshold = .05
           )
 
   This would stop recursion when the intensity reaches 5 percent of the
original value. An added effect is that if the objects surface reflects (or
transmits) less than the threshold amount of light, the reflection or
transmission will be ignored completely.
 
Affect of Glass on Speed
~~~~~~~~~~~~~~~~~~~~~~~~
 
   Unfortunately, the presence of any glass objects will slow the ray tracer
down. This effect may range from barely noticeable, for few, small objects
to excruciatingly miserably slow, for many, large objects. Sorry, there is
nothing I can do to speed it up - the 68000 simply won't go any faster. The
reason for the  slowdown is that for every ray/glass surface intersection,
TWO additional rays must be sent out (as opposed to one, for reflection).
And remember, each ray intersects a glass object twice: once on the way in,
and once on the way out. Also, the two generated rays may intersect the
glass, as well. You can see how this process could get very slow.
 
Notes, etc.
~~~~~~~~~~~
 
   Watch for control characters in the QRT input file. I had accidentally
imbedded an invisible control character in a file I was working on, and the
QRT parser refused to parse the file. After closely checking the file, I
began to look for a bug in the parser code. Finally, I discovered the
control character, but only after spending 1 hour checking the parser code.
The QRT parser will generate a SYNTAX ERROR, CODE 207 upon encountering any
special characters in the input file.
 
   Since transmission involves heavy recursion, don't forget to set the
default stack size to something larger than the default 4000 bytes. A stack
size of 40000 to 50000 bytes seems safe for most images.


The REMOVE command
==================

   The 'REMOVE' command was added to allow sections of a planar primitive to
be removed. This makes it much easier to create flat objects that are not
shaped like QRT's planar primitives. For example, I had a QRT input file
which created the image of a grand piano. The top of the piano, because of
its complex shape, initially was created from 11 planar primitives. Now, it
is only  1 PARALLELOGRAM primitive, and a section of the parallelogram is
removed to create the shape of a piano top.
 
   Before the REMOVE command can be used, a pattern must be created using
any of QRT's pattern primitives (the piano uses a polygon). This pattern
need not be given any surface characteristics - it simply defines the region
to be removed from the planar primitive. The pattern is attached to the
primitive in exactly the same way as a normal pattern, except that the
REMOVE command is used instead of the PATTERN command:
 
   PARALLELOGRAM ( loc = (0, 0, 0)
                   v1 = (10, 0, 0)
                   v2 = (0, 0, 10)
 
                   diff = (1, 0, 0)
                   remove = SECTION_TO_REMOVE
                   pattern = ANY_PATTERN
                 )
 
   This example shows that the PATTERN command can be used on the same
primitive as the REMOVE command.
 
   Several things should be noted about the REMOVE command. First, the
pattern defines the sections to remove, not the sections which will remain.
In the piano example, the pattern mapped all of the parallelogram except the
part that composed the actual piano top. Second, even though the remove
command can be used with the curved surface primitives (SPHERE, QUADRATIC),
the results will not be quite right. To use the sphere as an example, the
front surface of the sphere would have the correct pattern removed from it,
but the back surface of the sphere would  be completely gone. This is
because the SPHERE intersect routine ignores completely the back surface of
the sphere. I will probably fix this in a future version.
00000000  20 20 20 54 68 69 73 20  64 6f 63 75 6d 65 6e 74  |   This document|
00000010  20 64 69 73 63 75 73 73  65 73 3a 0a 0a 20 20 20  | discusses:..   |
00000020  20 20 54 68 65 20 74 72  61 6e 73 6d 69 73 73 69  |  The transmissi|
00000030  6f 6e 20 6f 66 20 6c 69  67 68 74 20 69 6e 20 74  |on of light in t|
00000040  68 65 20 51 52 54 20 77  6f 72 6c 64 0a 20 20 20  |he QRT world.   |
00000050  20 20 52 65 6d 6f 76 69  6e 67 20 73 65 63 74 69  |  Removing secti|
00000060  6f 6e 73 20 66 72 6f 6d  20 61 20 70 6c 61 6e 61  |ons from a plana|
00000070  72 20 6f 62 6a 65 63 74  0a 0a 0a 54 72 61 6e 73  |r object...Trans|
00000080  6d 69 73 73 69 6f 6e 20  6f 66 20 6c 69 67 68 74  |mission of light|
00000090  0a 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.===============|
000000a0  3d 3d 3d 3d 3d 3d 0a 20  0a 20 20 20 54 72 61 6e  |======. .   Tran|
000000b0  73 6d 69 73 73 69 6f 6e  20 6f 66 20 6c 69 67 68  |smission of ligh|
000000c0  74 20 74 68 72 6f 75 67  68 20 73 75 72 66 61 63  |t through surfac|
000000d0  65 73 20 6e 6f 77 20 77  6f 72 6b 73 2c 20 61 6c  |es now works, al|
000000e0  6c 6f 77 69 6e 67 20 6f  6e 65 20 74 6f 20 6d 6f  |lowing one to mo|
000000f0  64 65 6c 0a 67 6c 61 73  73 20 73 75 72 66 61 63  |del.glass surfac|
00000100  65 73 2e 20 53 6f 6d 65  20 61 64 64 69 74 69 6f  |es. Some additio|
00000110  6e 73 20 74 6f 20 61 6e  64 20 63 68 61 6e 67 65  |ns to and change|
00000120  73 20 66 72 6f 6d 20 74  68 65 20 6f 72 69 67 69  |s from the origi|
00000130  6e 61 6c 20 67 72 61 6d  6d 61 72 20 77 65 72 65  |nal grammar were|
00000140  0a 6e 65 63 65 73 73 61  72 79 20 74 6f 20 70 72  |.necessary to pr|
00000150  6f 76 69 64 65 20 74 68  65 20 64 65 73 69 72 65  |ovide the desire|
00000160  64 20 66 75 6e 63 74 69  6f 6e 61 6c 69 74 79 2e  |d functionality.|
00000170  20 41 20 6e 65 77 20 6b  65 79 77 6f 72 64 2c 20  | A new keyword, |
00000180  22 44 45 4e 53 49 54 59  22 2c 0a 68 61 73 20 62  |"DENSITY",.has b|
00000190  65 65 6e 20 61 64 64 65  64 2c 20 61 6e 64 20 74  |een added, and t|
000001a0  68 65 20 66 75 6e 63 74  69 6f 6e 20 6f 66 20 74  |he function of t|
000001b0  68 65 20 6f 6c 64 20 22  54 52 41 4e 53 22 20 6b  |he old "TRANS" k|
000001c0  65 79 77 6f 72 64 20 68  61 73 20 62 65 65 6e 0a  |eyword has been.|
000001d0  63 68 61 6e 67 65 64 2e  20 41 6c 73 6f 2c 20 61  |changed. Also, a|
000001e0  20 22 54 48 52 45 53 48  4f 4c 44 22 20 70 61 72  | "THRESHOLD" par|
000001f0  61 6d 65 74 65 72 20 68  61 73 20 62 65 65 6e 20  |ameter has been |
00000200  61 64 64 65 64 20 74 6f  20 74 68 65 20 64 65 66  |added to the def|
00000210  61 75 6c 74 0a 73 74 72  75 63 74 75 72 65 2e 20  |ault.structure. |
00000220  53 69 6e 63 65 20 74 72  61 6e 73 6d 69 73 73 69  |Since transmissi|
00000230  6f 6e 20 69 73 20 61 20  63 6f 6d 70 6c 65 78 20  |on is a complex |
00000240  6f 70 65 72 61 74 69 6f  6e 2c 20 74 68 69 73 20  |operation, this |
00000250  65 6e 74 69 72 65 20 41  64 64 65 6e 64 75 6d 0a  |entire Addendum.|
00000260  77 69 6c 6c 20 64 69 73  63 75 73 73 20 61 73 70  |will discuss asp|
00000270  65 63 74 73 20 6f 66 20  6d 6f 64 65 6c 69 6e 67  |ects of modeling|
00000280  20 67 6c 61 73 73 20 73  75 72 66 61 63 65 73 2e  | glass surfaces.|
00000290  0a 20 0a 54 68 65 20 44  45 4e 53 49 54 59 20 6b  |. .The DENSITY k|
000002a0  65 79 77 6f 72 64 0a 7e  7e 7e 7e 7e 7e 7e 7e 7e  |eyword.~~~~~~~~~|
000002b0  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 0a 20 0a 20 20 20  |~~~~~~~~~~. .   |
000002c0  49 74 20 77 61 73 20 6d  79 20 70 72 65 76 69 6f  |It was my previo|
000002d0  75 73 20 69 6e 74 65 6e  74 20 74 68 61 74 20 74  |us intent that t|
000002e0  68 65 20 54 52 41 4e 53  20 6b 65 79 77 6f 72 64  |he TRANS keyword|
000002f0  20 77 6f 75 6c 64 20 73  70 65 63 69 66 79 20 74  | would specify t|
00000300  68 65 0a 70 65 72 63 65  6e 74 20 74 72 61 6e 73  |he.percent trans|
00000310  6d 69 73 73 69 6f 6e 20  6f 66 20 6c 69 67 68 74  |mission of light|
00000320  20 74 68 6f 75 67 68 20  74 68 65 20 73 75 72 66  | though the surf|
00000330  61 63 65 2e 20 41 66 74  65 72 20 74 68 69 6e 6b  |ace. After think|
00000340  69 6e 67 20 61 20 6c 69  74 74 6c 65 0a 6d 6f 72  |ing a little.mor|
00000350  65 20 61 62 6f 75 74 20  74 68 65 20 6e 61 74 75  |e about the natu|
00000360  72 65 20 6f 66 20 6c 69  67 68 74 20 74 72 61 6e  |re of light tran|
00000370  73 6d 69 73 73 69 6f 6e  2c 20 69 74 20 77 61 73  |smission, it was|
00000380  20 63 6c 65 61 72 20 74  68 61 74 20 74 68 69 73  | clear that this|
00000390  20 77 61 73 6e 27 74 0a  61 64 65 71 75 61 74 65  | wasn't.adequate|
000003a0  2e 20 54 68 65 20 61 6d  6f 75 6e 74 20 6f 66 20  |. The amount of |
000003b0  6c 69 67 68 74 20 74 72  61 6e 73 6d 69 74 74 65  |light transmitte|
000003c0  64 20 64 65 70 65 6e 64  73 20 6e 6f 74 20 6f 6e  |d depends not on|
000003d0  6c 79 20 6f 6e 20 61 20  66 69 78 65 64 0a 63 6f  |ly on a fixed.co|
000003e0  65 66 66 69 63 69 65 6e  74 20 6f 66 20 74 68 65  |efficient of the|
000003f0  20 73 75 72 66 61 63 65  2c 20 62 75 74 20 6f 6e  | surface, but on|
00000400  20 74 68 65 20 74 68 69  63 6b 6e 65 73 73 20 6f  | the thickness o|
00000410  66 20 74 68 65 20 73 75  72 66 61 63 65 2e 20 46  |f the surface. F|
00000420  6f 72 0a 65 78 61 6d 70  6c 65 2c 20 61 20 68 6f  |or.example, a ho|
00000430  6c 6c 6f 77 20 67 6c 61  73 73 20 73 70 68 65 72  |llow glass spher|
00000440  65 20 77 69 6c 6c 20 61  70 70 65 61 72 20 64 61  |e will appear da|
00000450  72 6b 65 72 20 28 74 72  61 6e 73 6d 69 74 20 6c  |rker (transmit l|
00000460  65 73 73 20 6c 69 67 68  74 29 20 6e 65 61 72 0a  |ess light) near.|
00000470  74 68 65 20 65 64 67 65  73 2c 20 77 68 65 72 65  |the edges, where|
00000480  20 74 68 65 20 67 6c 61  73 73 20 69 73 20 74 68  | the glass is th|
00000490  69 63 6b 65 73 74 2e 20  54 6f 20 61 63 63 6f 75  |ickest. To accou|
000004a0  6e 74 20 66 6f 72 20 74  68 69 73 20 65 66 66 65  |nt for this effe|
000004b0  63 74 2c 20 74 68 65 0a  22 44 45 4e 53 49 54 59  |ct, the."DENSITY|
000004c0  22 20 6b 65 79 77 6f 72  64 20 77 61 73 20 61 64  |" keyword was ad|
000004d0  64 65 64 2e 20 44 65 6e  73 69 74 79 20 73 70 65  |ded. Density spe|
000004e0  63 69 66 69 65 73 20 77  68 61 74 20 70 65 72 63  |cifies what perc|
000004f0  65 6e 74 61 67 65 20 6f  66 0a 74 72 61 6e 73 6d  |entage of.transm|
00000500  69 74 74 65 64 20 6c 69  67 68 74 20 77 69 6c 6c  |itted light will|
00000510  20 62 65 20 72 65 6d 6f  76 65 64 20 70 65 72 20  | be removed per |
00000520  75 6e 69 74 20 64 69 73  74 61 6e 63 65 20 74 72  |unit distance tr|
00000530  61 76 65 6c 6c 65 64 20  74 68 6f 75 67 68 20 74  |avelled though t|
00000540  68 65 0a 6f 62 6a 65 63  74 2e 20 46 6f 72 20 65  |he.object. For e|
00000550  78 61 6d 70 6c 65 2c 20  74 68 65 20 66 6f 6c 6c  |xample, the foll|
00000560  6f 77 69 6e 67 20 64 65  6e 73 69 74 79 20 61 74  |owing density at|
00000570  74 72 69 62 75 74 65 20  77 6f 75 6c 64 20 72 65  |tribute would re|
00000580  6d 6f 76 65 20 32 20 70  65 72 63 65 6e 74 0a 6f  |move 2 percent.o|
00000590  66 20 61 6c 6c 20 6c 69  67 68 74 20 70 65 72 20  |f all light per |
000005a0  75 6e 69 74 20 64 69 73  74 61 6e 63 65 3a 0a 20  |unit distance:. |
000005b0  0a 20 20 20 44 45 4e 53  49 54 59 20 3d 20 28 2e  |.   DENSITY = (.|
000005c0  30 32 2c 20 2e 30 32 2c  20 2e 30 32 29 3b 0a 20  |02, .02, .02);. |
000005d0  0a 20 20 20 49 66 20 61  20 73 70 68 65 72 65 2c  |.   If a sphere,|
000005e0  20 61 74 20 69 74 73 20  77 69 64 65 73 74 20 70  | at its widest p|
000005f0  6f 69 6e 74 2c 20 77 61  73 20 31 30 20 75 6e 69  |oint, was 10 uni|
00000600  74 73 20 74 68 69 63 6b  2c 20 32 30 20 70 65 72  |ts thick, 20 per|
00000610  63 65 6e 74 20 6f 66 20  74 68 65 0a 6c 69 67 68  |cent of the.ligh|
00000620  74 20 77 6f 75 6c 64 20  62 65 20 72 65 6d 6f 76  |t would be remov|
00000630  65 64 2e 20 4e 65 61 72  20 74 68 65 20 65 64 67  |ed. Near the edg|
00000640  65 20 6f 66 20 74 68 65  20 73 70 68 65 72 65 2c  |e of the sphere,|
00000650  20 6c 65 73 73 20 6c 69  67 68 74 20 77 6f 75 6c  | less light woul|
00000660  64 20 62 65 0a 72 65 6d  6f 76 65 64 2e 0a 20 0a  |d be.removed.. .|
00000670  20 20 20 53 69 6e 63 65  20 64 65 6e 73 69 74 79  |   Since density|
00000680  20 69 73 20 61 20 66 75  6e 63 74 69 6f 6e 20 6f  | is a function o|
00000690  66 20 64 69 73 74 61 6e  63 65 2c 20 74 68 65 20  |f distance, the |
000006a0  73 61 6d 65 20 64 65 6e  73 69 74 79 20 66 61 63  |same density fac|
000006b0  74 6f 72 20 77 69 6c 6c  0a 68 61 76 65 20 64 69  |tor will.have di|
000006c0  66 66 65 72 65 6e 74 20  65 66 66 65 63 74 73 20  |fferent effects |
000006d0  6f 6e 20 6f 62 6a 65 63  74 73 20 6f 66 20 64 69  |on objects of di|
000006e0  66 66 65 72 65 6e 74 20  73 69 7a 65 73 2e 20 54  |fferent sizes. T|
000006f0  6f 20 72 65 6d 6f 76 65  20 74 68 65 20 73 61 6d  |o remove the sam|
00000700  65 0a 70 65 72 63 65 6e  74 61 67 65 20 6f 66 20  |e.percentage of |
00000710  6c 69 67 68 74 20 66 72  6f 6d 20 61 6e 20 6f 62  |light from an ob|
00000720  6a 65 63 74 20 68 61 6c  66 20 61 73 20 74 68 69  |ject half as thi|
00000730  63 6b 2c 20 64 6f 75 62  6c 65 20 74 68 65 20 64  |ck, double the d|
00000740  65 6e 73 69 74 79 20 66  61 63 74 6f 72 2e 0a 20  |ensity factor.. |
00000750  0a 53 68 61 64 6f 77 73  20 66 72 6f 6d 20 54 72  |.Shadows from Tr|
00000760  61 6e 73 70 61 72 65 6e  74 20 53 75 72 66 61 63  |ansparent Surfac|
00000770  65 73 0a 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |es.~~~~~~~~~~~~~|
00000780  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
00000790  7e 7e 7e 7e 0a 20 0a 20  20 20 54 68 65 20 6f 6c  |~~~~. .   The ol|
000007a0  64 20 22 54 52 41 4e 53  22 20 6b 65 79 77 6f 72  |d "TRANS" keywor|
000007b0  64 20 73 74 69 6c 6c 20  65 78 69 73 74 73 2c 20  |d still exists, |
000007c0  62 75 74 20 69 74 20 70  65 72 66 6f 72 6d 73 20  |but it performs |
000007d0  61 20 64 69 66 66 65 72  65 6e 74 0a 66 75 6e 63  |a different.func|
000007e0  74 69 6f 6e 2e 20 49 74  20 64 6f 65 73 20 6e 6f  |tion. It does no|
000007f0  74 20 61 66 66 65 63 74  20 74 68 65 20 61 70 70  |t affect the app|
00000800  65 61 72 61 6e 63 65 20  6f 66 20 74 68 65 20 6f  |earance of the o|
00000810  62 6a 65 63 74 2c 20 62  75 74 20 72 61 74 68 65  |bject, but rathe|
00000820  72 2c 20 74 68 65 0a 61  74 74 65 6e 75 61 74 69  |r, the.attenuati|
00000830  6f 6e 20 6f 66 20 6c 69  67 68 74 20 70 61 73 73  |on of light pass|
00000840  65 64 20 74 68 72 6f 75  67 68 20 74 68 65 20 73  |ed through the s|
00000850  75 72 66 61 63 65 2e 20  51 52 54 20 6b 6e 6f 77  |urface. QRT know|
00000860  73 20 68 6f 77 20 67 6c  61 73 73 0a 73 75 72 66  |s how glass.surf|
00000870  61 63 65 73 20 62 65 6e  64 20 6c 69 67 68 74 2c  |aces bend light,|
00000880  20 61 6e 64 20 73 6f 20  69 74 20 63 61 6e 20 6d  | and so it can m|
00000890  6f 64 65 6c 20 74 68 65  20 6d 61 67 6e 69 66 79  |odel the magnify|
000008a0  69 6e 67 20 65 66 66 65  63 74 73 20 6f 66 20 6c  |ing effects of l|
000008b0  6f 6f 6b 69 6e 67 0a 74  68 72 6f 75 67 68 20 63  |ooking.through c|
000008c0  75 72 76 65 64 20 67 6c  61 73 73 2c 20 65 74 63  |urved glass, etc|
000008d0  2e 20 42 75 74 20 66 6f  72 20 63 6f 6d 70 75 74  |. But for comput|
000008e0  69 6e 67 20 73 68 61 64  6f 77 73 2c 20 69 74 20  |ing shadows, it |
000008f0  63 61 6e 6e 6f 74 20 70  72 6f 70 65 72 6c 79 0a  |cannot properly.|
00000900  62 65 6e 64 20 74 68 65  20 6c 69 67 68 74 20 66  |bend the light f|
00000910  72 6f 6d 20 6c 61 6d 70  73 2e 20 54 68 69 73 20  |rom lamps. This |
00000920  6d 65 61 6e 73 20 74 68  61 74 20 79 6f 75 20 63  |means that you c|
00000930  61 6e 20 6d 6f 64 65 6c  20 6c 65 6e 73 65 73 20  |an model lenses |
00000940  74 68 61 74 20 74 68 65  0a 6f 62 73 65 72 76 65  |that the.observe|
00000950  72 20 6c 6f 6f 6b 73 20  74 68 72 6f 75 67 68 2c  |r looks through,|
00000960  20 62 75 74 20 6e 6f 74  20 6c 65 6e 73 65 73 20  | but not lenses |
00000970  75 73 65 64 20 74 6f 20  66 6f 63 75 73 20 6c 69  |used to focus li|
00000980  67 68 74 2e 20 49 6e 20  6f 72 64 65 72 20 74 6f  |ght. In order to|
00000990  0a 70 72 6f 76 69 64 65  20 73 6f 6d 65 20 61 74  |.provide some at|
000009a0  74 65 6e 75 61 74 69 6f  6e 20 65 66 66 65 63 74  |tenuation effect|
000009b0  73 2c 20 75 73 65 20 22  54 52 41 4e 53 22 20 74  |s, use "TRANS" t|
000009c0  6f 20 74 65 6c 6c 20 51  52 54 20 68 6f 77 20 6d  |o tell QRT how m|
000009d0  75 63 68 20 6c 69 67 68  74 20 69 73 0a 70 61 73  |uch light is.pas|
000009e0  73 65 64 20 74 68 72 6f  75 67 68 20 74 68 65 20  |sed through the |
000009f0  73 75 72 66 61 63 65 2e  20 54 68 69 73 20 69 6e  |surface. This in|
00000a00  66 6f 72 6d 61 74 69 6f  6e 20 69 73 20 4f 4e 4c  |formation is ONL|
00000a10  59 20 75 73 65 64 20 66  6f 72 20 63 6f 6d 70 75  |Y used for compu|
00000a20  74 69 6e 67 0a 73 68 61  64 6f 77 73 2e 20 46 6f  |ting.shadows. Fo|
00000a30  72 20 65 78 61 6d 70 6c  65 2c 20 62 6c 75 65 20  |r example, blue |
00000a40  67 6c 61 73 73 20 73 68  6f 75 6c 64 20 63 61 73  |glass should cas|
00000a50  74 20 61 20 62 6c 75 65  20 73 68 61 64 6f 77 2e  |t a blue shadow.|
00000a60  20 55 73 65 20 73 6f 6d  65 74 68 69 6e 67 0a 73  | Use something.s|
00000a70  69 6d 69 6c 61 72 20 74  6f 3a 0a 20 0a 20 20 20  |imilar to:. .   |
00000a80  54 52 41 4e 53 20 3d 20  28 30 2c 20 30 2c 20 2e  |TRANS = (0, 0, .|
00000a90  37 29 0a 20 0a 74 6f 20  63 61 73 74 20 61 20 62  |7). .to cast a b|
00000aa0  6c 75 65 20 73 68 61 64  6f 77 20 28 74 68 69 73  |lue shadow (this|
00000ab0  20 6c 65 74 73 20 37 30  20 70 65 72 63 65 6e 74  | lets 70 percent|
00000ac0  20 6f 66 20 74 68 65 20  62 6c 75 65 20 6c 69 67  | of the blue lig|
00000ad0  68 74 20 70 61 73 73 29  2e 20 4e 6f 74 65 0a 74  |ht pass). Note.t|
00000ae0  68 61 74 20 62 79 20 75  73 69 6e 67 20 73 74 72  |hat by using str|
00000af0  61 6e 67 65 20 63 6f 6d  62 69 6e 61 74 69 6f 6e  |ange combination|
00000b00  73 20 6f 66 20 44 45 4e  53 49 54 59 20 61 6e 64  |s of DENSITY and|
00000b10  20 54 52 41 4e 53 2c 20  79 6f 75 20 63 61 6e 20  | TRANS, you can |
00000b20  6d 6f 64 65 6c 0a 69 6c  6c 6f 67 69 63 61 6c 20  |model.illogical |
00000b30  6f 62 6a 65 63 74 73 20  77 68 69 63 68 20 61 70  |objects which ap|
00000b40  70 65 61 72 2c 20 66 6f  72 20 65 78 61 6d 70 6c  |pear, for exampl|
00000b50  65 2c 20 62 6c 75 65 2c  20 62 75 74 20 63 61 73  |e, blue, but cas|
00000b60  74 20 61 20 72 65 64 20  73 68 61 64 6f 77 2e 0a  |t a red shadow..|
00000b70  54 68 65 73 65 20 73 68  61 64 6f 77 73 20 77 69  |These shadows wi|
00000b80  6c 6c 20 62 65 20 65 6e  74 69 72 65 6c 79 20 6f  |ll be entirely o|
00000b90  66 20 6f 6e 65 20 69 6e  74 65 6e 73 69 74 79 2c  |f one intensity,|
00000ba0  20 61 6e 64 20 77 69 6c  6c 20 6e 6f 74 20 76 61  | and will not va|
00000bb0  72 79 20 77 69 74 68 20  74 68 65 0a 74 68 69 63  |ry with the.thic|
00000bc0  6b 6e 65 73 73 20 6f 66  20 74 68 65 20 67 6c 61  |kness of the gla|
00000bd0  73 73 2e 0a 20 0a 55 73  69 6e 67 20 4d 49 52 52  |ss.. .Using MIRR|
00000be0  4f 52 20 77 69 74 68 20  54 72 61 6e 73 70 61 72  |OR with Transpar|
00000bf0  65 6e 74 20 73 75 72 66  61 63 65 73 0a 7e 7e 7e  |ent surfaces.~~~|
00000c00  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
*
00000c20  7e 7e 7e 0a 20 0a 20 20  20 47 6c 61 73 73 20 73  |~~~. .   Glass s|
00000c30  75 72 66 61 63 65 73 20  6e 6f 74 20 6f 6e 6c 79  |urfaces not only|
00000c40  20 72 65 66 72 61 63 74  20 6c 69 67 68 74 2c 20  | refract light, |
00000c50  62 75 74 20 61 6c 73 6f  20 72 65 66 6c 65 63 74  |but also reflect|
00000c60  20 61 20 70 65 72 63 65  6e 74 61 67 65 20 6f 66  | a percentage of|
00000c70  0a 69 74 2e 20 54 68 69  73 20 6d 65 61 6e 73 20  |.it. This means |
00000c80  74 68 61 74 20 74 6f 20  72 65 61 6c 69 73 74 69  |that to realisti|
00000c90  63 61 6c 6c 79 20 6d 6f  64 65 6c 20 67 6c 61 73  |cally model glas|
00000ca0  73 2c 20 74 68 65 20 67  6c 61 73 73 20 73 68 6f  |s, the glass sho|
00000cb0  75 6c 64 20 72 65 66 6c  65 63 74 20 61 0a 73 6d  |uld reflect a.sm|
00000cc0  61 6c 6c 20 70 65 72 63  65 6e 74 61 67 65 20 6f  |all percentage o|
00000cd0  66 20 74 68 65 20 6c 69  67 68 74 2e 20 54 72 79  |f the light. Try|
00000ce0  20 73 74 61 72 74 69 6e  67 20 77 69 74 68 20 32  | starting with 2|
00000cf0  30 20 74 6f 20 32 35 20  70 65 72 63 65 6e 74 0a  |0 to 25 percent.|
00000d00  72 65 66 6c 65 63 74 69  6f 6e 2e 20 4e 6f 74 65  |reflection. Note|
00000d10  20 74 68 61 74 20 61 6c  6c 20 67 6c 61 73 73 20  | that all glass |
00000d20  6f 62 6a 65 63 74 73 20  72 65 66 6c 65 63 74 20  |objects reflect |
00000d30  6c 69 67 68 74 20 66 72  6f 6d 20 62 6f 74 68 20  |light from both |
00000d40  74 68 65 20 6f 75 74 73  69 64 65 0a 61 6e 64 20  |the outside.and |
00000d50  74 68 65 20 69 6e 73 69  64 65 20 73 75 72 66 61  |the inside surfa|
00000d60  63 65 73 20 6f 66 20 74  68 65 20 67 6c 61 73 73  |ces of the glass|
00000d70  2e 0a 20 0a 49 6e 64 65  78 20 6f 66 20 52 65 66  |.. .Index of Ref|
00000d80  72 61 63 74 69 6f 6e 0a  7e 7e 7e 7e 7e 7e 7e 7e  |raction.~~~~~~~~|
00000d90  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 0a 20 0a 20 20  |~~~~~~~~~~~. .  |
00000da0  20 54 68 65 20 69 6e 64  65 78 20 6f 66 20 72 65  | The index of re|
00000db0  66 72 61 63 74 69 6f 6e  20 66 6f 72 20 61 6e 20  |fraction for an |
00000dc0  6f 62 6a 65 63 74 20 67  6f 76 65 72 6e 73 20 68  |object governs h|
00000dd0  6f 77 20 6d 75 63 68 20  74 68 65 20 6c 69 67 68  |ow much the ligh|
00000de0  74 20 69 73 20 62 65 6e  74 0a 75 70 6f 6e 20 65  |t is bent.upon e|
00000df0  6e 74 65 72 69 6e 67 20  6f 72 20 65 78 69 74 69  |ntering or exiti|
00000e00  6e 67 20 74 68 65 20 6f  62 6a 65 63 74 2e 20 41  |ng the object. A|
00000e10  20 68 69 67 68 65 72 20  69 6e 64 65 78 20 77 69  | higher index wi|
00000e20  6c 6c 20 62 65 6e 64 20  74 68 65 20 6c 69 67 68  |ll bend the ligh|
00000e30  74 0a 6d 6f 72 65 2e 20  54 68 65 20 69 6e 64 65  |t.more. The inde|
00000e40  78 20 6f 66 20 72 65 66  72 61 63 74 69 6f 6e 20  |x of refraction |
00000e50  6f 66 20 61 69 72 20 69  73 20 31 2e 30 30 2c 20  |of air is 1.00, |
00000e60  61 6e 64 20 66 6f 72 20  67 6c 61 73 73 20 69 73  |and for glass is|
00000e70  20 72 6f 75 67 68 6c 79  20 31 2e 33 33 2e 0a 53  | roughly 1.33..S|
00000e80  6f 6d 65 20 73 75 62 73  74 61 6e 63 65 73 2c 20  |ome substances, |
00000e90  73 75 63 68 20 61 73 20  64 69 61 6d 6f 6e 64 2c  |such as diamond,|
00000ea0  20 68 61 76 65 20 61 20  68 69 67 68 65 72 20 69  | have a higher i|
00000eb0  6e 64 65 78 2e 0a 20 0a  4d 6f 64 65 6c 69 6e 67  |ndex.. .Modeling|
00000ec0  20 48 6f 6c 6c 6f 77 20  4f 62 6a 65 63 74 73 0a  | Hollow Objects.|
00000ed0  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
00000ee0  7e 7e 7e 7e 7e 7e 7e 0a  20 0a 20 20 20 57 68 65  |~~~~~~~. .   Whe|
00000ef0  6e 20 64 65 73 69 67 6e  69 6e 67 20 74 68 65 20  |n designing the |
00000f00  51 52 54 20 74 72 61 6e  73 6d 69 73 73 69 6f 6e  |QRT transmission|
00000f10  20 72 6f 75 74 69 6e 65  73 2c 20 49 20 77 61 6e  | routines, I wan|
00000f20  74 65 64 20 74 6f 20 62  65 20 61 62 6c 65 20 74  |ted to be able t|
00000f30  6f 0a 6d 6f 64 65 6c 20  62 6f 74 68 20 73 6f 6c  |o.model both sol|
00000f40  69 64 20 67 6c 61 73 73  20 61 6e 64 20 68 6f 6c  |id glass and hol|
00000f50  6c 6f 77 20 67 6c 61 73  73 20 6f 62 6a 65 63 74  |low glass object|
00000f60  73 2e 20 54 6f 20 75 6e  64 65 72 73 74 61 6e 64  |s. To understand|
00000f70  20 68 6f 77 20 74 68 69  73 20 69 73 0a 64 6f 6e  | how this is.don|
00000f80  65 2c 20 69 74 20 69 73  20 6e 65 63 65 73 73 61  |e, it is necessa|
00000f90  72 79 20 74 6f 20 75 6e  64 65 72 73 74 61 6e 64  |ry to understand|
00000fa0  20 61 20 6c 69 74 74 6c  65 20 61 62 6f 75 74 20  | a little about |
00000fb0  68 6f 77 20 51 52 54 27  73 20 74 72 61 6e 73 6d  |how QRT's transm|
00000fc0  69 73 73 69 6f 6e 0a 6d  6f 64 65 6c 20 77 6f 72  |ission.model wor|
00000fd0  6b 73 2e 0a 20 0a 20 20  20 41 20 72 61 79 2c 20  |ks.. .   A ray, |
00000fe0  61 66 74 65 72 20 6c 65  61 76 69 6e 67 20 74 68  |after leaving th|
00000ff0  65 20 6f 62 73 65 72 76  65 72 2c 20 68 61 73 20  |e observer, has |
00001000  74 77 6f 20 73 74 61 74  65 73 3a 20 65 69 74 68  |two states: eith|
00001010  65 72 20 69 74 20 69 73  20 69 6e 73 69 64 65 20  |er it is inside |
00001020  61 0a 67 6c 61 73 73 20  6f 62 6a 65 63 74 2c 20  |a.glass object, |
00001030  6f 72 20 69 74 20 69 73  20 6f 75 74 73 69 64 65  |or it is outside|
00001040  2e 20 54 68 65 20 72 61  79 20 73 74 61 72 74 73  |. The ray starts|
00001050  20 6f 75 74 20 6f 75 74  73 69 64 65 2e 20 57 68  | out outside. Wh|
00001060  65 6e 20 69 74 20 66 69  72 73 74 0a 65 6e 63 6f  |en it first.enco|
00001070  75 6e 74 65 72 73 20 61  20 67 6c 61 73 73 20 73  |unters a glass s|
00001080  75 72 66 61 63 65 2c 20  69 74 20 69 73 20 62 65  |urface, it is be|
00001090  6e 74 2c 20 61 6e 64 20  69 74 73 20 73 74 61 74  |nt, and its stat|
000010a0  65 20 69 73 20 74 6f 67  67 6c 65 64 20 66 72 6f  |e is toggled fro|
000010b0  6d 0a 4f 55 54 53 49 44  45 20 74 6f 20 49 4e 53  |m.OUTSIDE to INS|
000010c0  49 44 45 2e 20 49 74 20  63 6f 6e 74 69 6e 75 65  |IDE. It continue|
000010d0  73 20 6f 6e 20 75 6e 74  69 6c 20 65 6e 63 6f 75  |s on until encou|
000010e0  6e 74 65 72 69 6e 67 20  61 6e 6f 74 68 65 72 20  |ntering another |
000010f0  73 75 72 66 61 63 65 2c  0a 77 68 65 72 65 75 70  |surface,.whereup|
00001100  6f 6e 20 69 74 20 69 73  20 62 65 6e 74 20 61 67  |on it is bent ag|
00001110  61 69 6e 2c 20 61 6e 64  20 69 74 73 20 73 74 61  |ain, and its sta|
00001120  74 65 20 69 73 20 6f 6e  63 65 20 6d 6f 72 65 20  |te is once more |
00001130  74 6f 67 67 6c 65 64 2e  20 54 68 69 73 20 68 61  |toggled. This ha|
00001140  73 0a 73 65 76 65 72 61  6c 20 69 6d 70 6c 69 63  |s.several implic|
00001150  61 74 69 6f 6e 73 20 66  6f 72 20 6d 6f 64 65 6c  |ations for model|
00001160  69 6e 67 20 67 6c 61 73  73 2e 20 54 68 65 20 66  |ing glass. The f|
00001170  69 72 73 74 20 69 73 20  74 68 61 74 20 41 4c 4c  |irst is that ALL|
00001180  20 67 6c 61 73 73 0a 73  75 72 66 61 63 65 73 20  | glass.surfaces |
00001190  4d 55 53 54 20 68 61 76  65 20 74 77 6f 20 73 69  |MUST have two si|
000011a0  64 65 73 20 2d 20 74 68  61 74 20 69 73 2c 20 6f  |des - that is, o|
000011b0  6e 63 65 20 74 68 65 20  72 61 79 20 65 6e 74 65  |nce the ray ente|
000011c0  72 73 20 74 68 65 20 67  6c 61 73 73 2c 20 74 68  |rs the glass, th|
000011d0  65 72 65 0a 6d 75 73 74  20 62 65 20 6e 6f 20 77  |ere.must be no w|
000011e0  61 79 20 66 6f 72 20 69  74 20 74 6f 20 65 78 69  |ay for it to exi|
000011f0  74 20 77 69 74 68 6f 75  74 20 61 67 61 69 6e 20  |t without again |
00001200  70 61 73 73 69 6e 67 20  74 68 72 6f 75 67 68 20  |passing through |
00001210  61 20 73 75 72 66 61 63  65 2e 20 54 68 65 0a 73  |a surface. The.s|
00001220  65 63 6f 6e 64 20 69 73  20 74 68 61 74 20 61 20  |econd is that a |
00001230  72 61 79 20 6d 75 73 74  20 67 6f 20 66 72 6f 6d  |ray must go from|
00001240  20 67 6c 61 73 73 20 74  6f 20 61 69 72 2c 20 6f  | glass to air, o|
00001250  72 20 61 69 72 20 74 6f  20 67 6c 61 73 73 2c 20  |r air to glass, |
00001260  62 75 74 20 6e 6f 74 0a  66 72 6f 6d 20 67 6c 61  |but not.from gla|
00001270  73 73 20 77 69 74 68 20  69 6e 64 65 78 20 6f 66  |ss with index of|
00001280  20 72 65 66 72 61 63 74  69 6f 6e 20 41 20 74 6f  | refraction A to|
00001290  20 67 6c 61 73 73 20 77  69 74 68 20 69 6e 64 65  | glass with inde|
000012a0  78 20 6f 66 20 72 65 66  72 61 63 74 69 6f 6e 20  |x of refraction |
000012b0  42 3b 0a 69 2e 65 2c 20  74 68 65 20 74 77 6f 20  |B;.i.e, the two |
000012c0  67 6c 61 73 73 20 73 75  72 66 61 63 65 73 20 63  |glass surfaces c|
000012d0  61 6e 6e 6f 74 20 74 6f  75 63 68 20 65 61 63 68  |annot touch each|
000012e0  20 6f 74 68 65 72 2c 20  65 76 65 6e 20 74 68 6f  | other, even tho|
000012f0  75 67 68 20 74 68 65 79  20 6d 61 79 20 62 65 0a  |ugh they may be.|
00001300  70 6c 61 63 65 64 20 76  65 72 79 20 63 6c 6f 73  |placed very clos|
00001310  65 20 74 6f 67 65 74 68  65 72 2e 0a 20 0a 20 20  |e together.. .  |
00001320  20 41 73 20 61 6e 20 65  78 61 6d 70 6c 65 20 6f  | As an example o|
00001330  66 20 68 6f 77 20 74 68  69 73 20 77 6f 72 6b 73  |f how this works|
00001340  2c 20 63 6f 6e 73 69 64  65 72 20 61 20 73 6f 6c  |, consider a sol|
00001350  69 64 20 67 6c 61 73 73  20 73 70 68 65 72 65 2e  |id glass sphere.|
00001360  20 54 68 65 20 72 61 79  0a 65 6e 63 6f 75 6e 74  | The ray.encount|
00001370  65 72 73 20 74 68 65 20  73 70 68 65 72 65 2c 20  |ers the sphere, |
00001380  61 6e 64 20 69 73 20 62  65 6e 74 20 28 69 6e 20  |and is bent (in |
00001390  74 68 69 73 20 63 61 73  65 2c 20 74 6f 77 61 72  |this case, towar|
000013a0  64 73 20 74 68 65 20 6e  6f 72 6d 61 6c 0a 76 65  |ds the normal.ve|
000013b0  63 74 6f 72 29 2e 20 51  52 54 20 6e 6f 77 20 72  |ctor). QRT now r|
000013c0  65 6d 65 6d 62 65 72 73  20 74 68 61 74 20 74 68  |emembers that th|
000013d0  65 20 72 61 79 20 69 73  20 49 4e 53 49 44 45 20  |e ray is INSIDE |
000013e0  61 20 67 6c 61 73 73 20  73 75 72 66 61 63 65 2e  |a glass surface.|
000013f0  20 54 68 65 20 72 61 79  0a 63 6f 6e 74 69 6e 75  | The ray.continu|
00001400  65 73 20 6f 6e 20 75 6e  74 69 6c 20 69 74 20 68  |es on until it h|
00001410  69 74 73 20 74 68 65 20  62 61 63 6b 20 73 69 64  |its the back sid|
00001420  65 20 6f 66 20 74 68 65  20 73 70 68 65 72 65 2c  |e of the sphere,|
00001430  20 77 68 65 72 65 75 70  6f 6e 20 69 74 20 69 73  | whereupon it is|
00001440  20 62 65 6e 74 0a 28 61  77 61 79 20 66 72 6f 6d  | bent.(away from|
00001450  20 74 68 65 20 6e 6f 72  6d 61 6c 20 76 65 63 74  | the normal vect|
00001460  6f 72 29 2c 20 61 6e 64  20 69 74 73 20 73 74 61  |or), and its sta|
00001470  74 65 20 69 73 20 74 6f  67 67 6c 65 64 20 74 6f  |te is toggled to|
00001480  20 4f 55 54 53 49 44 45  2e 20 49 6e 0a 73 75 6d  | OUTSIDE. In.sum|
00001490  6d 61 72 79 2c 20 74 68  65 20 49 4e 53 49 44 45  |mary, the INSIDE|
000014a0  2f 4f 55 54 53 49 44 45  20 66 6c 61 67 20 74 65  |/OUTSIDE flag te|
000014b0  6c 6c 73 20 51 52 54 20  68 6f 77 20 74 6f 20 62  |lls QRT how to b|
000014c0  65 6e 64 20 74 68 65 20  72 61 79 2e 0a 20 0a 20  |end the ray.. . |
000014d0  20 20 43 6f 6e 73 69 64  65 72 20 6e 6f 77 20 74  |  Consider now t|
000014e0  68 65 20 63 61 73 65 20  6f 66 20 61 20 68 6f 6c  |he case of a hol|
000014f0  6c 6f 77 20 67 6c 61 73  73 20 73 70 68 65 72 65  |low glass sphere|
00001500  2e 20 54 68 69 73 20 69  73 20 6d 6f 64 65 6c 65  |. This is modele|
00001510  64 20 75 73 69 6e 67 20  74 77 6f 0a 63 6f 6e 63  |d using two.conc|
00001520  65 6e 74 72 69 63 20 73  70 68 65 72 65 73 2c 20  |entric spheres, |
00001530  6f 6e 65 20 77 69 74 68  20 61 20 73 6d 61 6c 6c  |one with a small|
00001540  65 72 20 72 61 64 69 75  73 2e 20 54 68 65 20 72  |er radius. The r|
00001550  61 79 20 77 69 6c 6c 20  66 69 72 73 74 20 68 69  |ay will first hi|
00001560  74 20 74 68 65 0a 6f 75  74 73 69 64 65 20 73 70  |t the.outside sp|
00001570  68 65 72 65 2c 20 62 65  20 62 65 6e 74 2c 20 61  |here, be bent, a|
00001580  6e 64 20 68 61 76 65 20  69 74 73 20 73 74 61 74  |nd have its stat|
00001590  65 20 74 6f 67 67 6c 65  64 20 74 6f 20 49 4e 53  |e toggled to INS|
000015a0  49 44 45 2e 20 54 68 65  72 65 20 61 72 65 20 6e  |IDE. There are n|
000015b0  6f 77 0a 74 77 6f 20 70  6f 73 73 69 62 6c 65 20  |ow.two possible |
000015c0  63 61 73 65 73 2e 20 46  69 72 73 74 2c 20 74 68  |cases. First, th|
000015d0  65 20 72 61 79 20 6d 61  79 20 6d 69 73 73 20 74  |e ray may miss t|
000015e0  68 65 20 69 6e 73 69 64  65 20 73 70 68 65 72 65  |he inside sphere|
000015f0  2c 20 69 6e 20 77 68 69  63 68 20 63 61 73 65 0a  |, in which case.|
00001600  74 68 65 20 73 69 6d 75  6c 61 74 69 6f 6e 20 70  |the simulation p|
00001610  72 6f 63 65 65 64 73 20  61 73 20 69 6e 20 74 68  |roceeds as in th|
00001620  65 20 61 62 6f 76 65 20  70 61 72 61 67 72 61 70  |e above paragrap|
00001630  68 2e 20 53 65 63 6f 6e  64 2c 20 69 74 20 6d 61  |h. Second, it ma|
00001640  79 20 68 69 74 20 74 68  65 0a 69 6e 73 69 64 65  |y hit the.inside|
00001650  20 73 70 68 65 72 65 2e  20 49 6e 20 74 68 69 73  | sphere. In this|
00001660  20 63 61 73 65 2c 20 69  74 20 69 73 20 62 65 6e  | case, it is ben|
00001670  74 2c 20 61 6e 64 20 69  74 73 20 73 74 61 74 65  |t, and its state|
00001680  20 69 73 20 74 6f 67 67  6c 65 64 20 74 6f 0a 4f  | is toggled to.O|
00001690  55 54 53 49 44 45 2e 20  54 68 65 20 72 61 79 20  |UTSIDE. The ray |
000016a0  69 73 20 6e 6f 77 20 63  6f 6e 73 69 64 65 72 65  |is now considere|
000016b0  64 20 74 6f 20 62 65 20  62 61 63 6b 20 69 6e 20  |d to be back in |
000016c0  61 69 72 2c 20 73 6f 20  74 68 61 74 20 74 68 65  |air, so that the|
000016d0  20 69 6e 73 69 64 65 0a  73 70 68 65 72 65 20 68  | inside.sphere h|
000016e0  61 73 20 6d 6f 64 65 6c  65 64 20 74 68 65 20 68  |as modeled the h|
000016f0  6f 6c 6c 6f 77 20 70 6f  72 74 69 6f 6e 20 6f 66  |ollow portion of|
00001700  20 74 68 65 20 67 6c 61  73 73 2e 20 49 6e 20 61  | the glass. In a|
00001710  20 73 69 6d 69 6c 61 72  20 6d 61 6e 6e 65 72 2c  | similar manner,|
00001720  20 74 68 65 0a 72 61 79  20 72 65 61 63 68 65 73  | the.ray reaches|
00001730  20 74 68 65 20 6f 74 68  65 72 20 73 69 64 65 20  | the other side |
00001740  6f 66 20 74 68 65 20 69  6e 73 69 64 65 20 73 70  |of the inside sp|
00001750  68 65 72 65 2c 20 65 6e  74 65 72 73 20 74 68 65  |here, enters the|
00001760  20 67 6c 61 73 73 20 61  67 61 69 6e 2c 20 61 6e  | glass again, an|
00001770  64 0a 66 69 6e 61 6c 6c  79 20 6c 65 61 76 65 73  |d.finally leaves|
00001780  20 74 68 65 20 6f 75 74  73 69 64 65 20 73 70 68  | the outside sph|
00001790  65 72 65 2e 20 4e 6f 74  65 20 74 68 61 74 20 65  |ere. Note that e|
000017a0  76 65 6e 20 74 68 6f 75  67 68 20 74 68 65 20 69  |ven though the i|
000017b0  6e 73 69 64 65 20 73 70  68 65 72 65 0a 69 73 20  |nside sphere.is |
000017c0  74 68 6f 75 67 68 74 20  6f 66 20 61 73 20 74 68  |thought of as th|
000017d0  65 20 22 61 69 72 22 20  69 6e 20 74 68 65 20 63  |e "air" in the c|
000017e0  65 6e 74 65 72 20 6f 66  20 74 68 65 20 6f 62 6a  |enter of the obj|
000017f0  65 63 74 2c 20 69 74 20  4d 55 53 54 20 68 61 76  |ect, it MUST hav|
00001800  65 20 74 68 65 0a 73 61  6d 65 20 69 6e 64 65 78  |e the.same index|
00001810  20 6f 66 20 72 65 66 72  61 63 74 69 6f 6e 20 61  | of refraction a|
00001820  73 20 74 68 65 20 6f 75  74 73 69 64 65 20 73 70  |s the outside sp|
00001830  68 65 72 65 2e 20 54 68  69 73 20 69 73 20 6e 65  |here. This is ne|
00001840  63 65 73 73 61 72 79 20  73 6f 20 74 68 61 74 0a  |cessary so that.|
00001850  51 52 54 20 63 61 6e 20  63 6f 72 72 65 63 74 6c  |QRT can correctl|
00001860  79 20 62 65 6e 64 20 74  68 65 20 6c 69 67 68 74  |y bend the light|
00001870  20 77 68 65 6e 20 69 74  20 65 78 69 74 73 20 74  | when it exits t|
00001880  68 65 20 67 6c 61 73 73  2e 0a 20 0a 43 68 72 6f  |he glass.. .Chro|
00001890  6d 61 74 69 63 20 41 62  65 72 72 61 74 69 6f 6e  |matic Aberration|
000018a0  0a 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |.~~~~~~~~~~~~~~~|
000018b0  7e 7e 7e 7e 7e 0a 20 0a  20 20 20 49 6e 20 51 52  |~~~~~. .   In QR|
000018c0  54 2c 20 61 6c 6c 20 72  61 79 73 2c 20 72 65 67  |T, all rays, reg|
000018d0  61 72 64 6c 65 73 73 20  6f 66 20 63 6f 6c 6f 72  |ardless of color|
000018e0  2c 20 61 72 65 20 72 65  66 72 61 63 74 65 64 20  |, are refracted |
000018f0  65 78 61 63 74 6c 79 20  74 68 65 20 73 61 6d 65  |exactly the same|
00001900  2e 0a 54 68 69 73 20 69  73 20 63 6f 6e 74 72 61  |..This is contra|
00001910  73 74 20 74 6f 20 74 68  65 20 72 65 61 6c 20 77  |st to the real w|
00001920  6f 72 6c 64 2c 20 69 6e  20 77 68 69 63 68 20 74  |orld, in which t|
00001930  68 65 20 61 6d 6f 75 6e  74 20 74 68 65 20 6c 69  |he amount the li|
00001940  67 68 74 20 69 73 20 62  65 6e 74 0a 64 65 70 65  |ght is bent.depe|
00001950  6e 64 73 20 6f 6e 20 69  74 73 20 77 61 76 65 6c  |nds on its wavel|
00001960  65 6e 67 74 68 2e 20 54  68 69 73 20 61 70 70 65  |ength. This appe|
00001970  61 72 73 2c 20 73 6f 20  66 61 72 20 61 73 20 49  |ars, so far as I|
00001980  20 63 61 6e 20 74 65 6c  6c 2c 20 74 6f 20 62 65  | can tell, to be|
00001990  20 61 20 62 75 67 0a 69  6e 20 74 68 65 20 72 65  | a bug.in the re|
000019a0  61 6c 20 77 6f 72 6c 64  2c 20 61 6e 64 20 49 20  |al world, and I |
000019b0  73 61 77 20 6e 6f 20 72  65 61 73 6f 6e 20 74 6f  |saw no reason to|
000019c0  20 69 6e 63 6c 75 64 65  20 69 74 20 69 6e 20 61  | include it in a|
000019d0  20 72 61 79 20 74 72 61  63 65 72 2e 0a 0a 54 68  | ray tracer...Th|
000019e0  72 65 73 68 6f 6c 64 20  61 74 74 72 69 62 75 74  |reshold attribut|
000019f0  65 0a 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |e.~~~~~~~~~~~~~~|
00001a00  7e 7e 7e 7e 7e 0a 20 0a  20 20 20 41 20 6e 65 77  |~~~~~. .   A new|
00001a10  20 6b 65 79 77 6f 72 64  2c 20 54 48 52 45 53 48  | keyword, THRESH|
00001a20  4f 4c 44 2c 20 68 61 73  20 62 65 65 6e 20 61 64  |OLD, has been ad|
00001a30  64 65 64 20 74 6f 20 74  68 65 20 64 65 66 61 75  |ded to the defau|
00001a40  6c 74 20 73 74 72 75 63  74 75 72 65 2e 20 49 6e  |lt structure. In|
00001a50  0a 70 72 65 76 69 6f 75  73 20 76 65 72 73 69 6f  |.previous versio|
00001a60  6e 73 20 6f 66 20 51 52  54 2c 20 74 68 65 72 65  |ns of QRT, there|
00001a70  20 77 61 73 20 61 20 6d  65 63 68 61 6e 69 73 6d  | was a mechanism|
00001a80  20 66 6f 72 20 64 65 74  65 63 74 69 6e 67 20 69  | for detecting i|
00001a90  6e 66 69 6e 69 74 65 0a  72 65 63 75 72 73 69 6f  |nfinite.recursio|
00001aa0  6e 20 70 72 6f 76 69 64  65 64 20 74 68 61 74 20  |n provided that |
00001ab0  6f 62 6a 65 63 74 73 20  72 65 66 6c 65 63 74 65  |objects reflecte|
00001ac0  64 20 6c 65 73 73 20 74  68 61 74 20 31 30 30 20  |d less that 100 |
00001ad0  70 65 72 63 65 6e 74 20  6f 66 20 74 68 65 20 6c  |percent of the l|
00001ae0  69 67 68 74 0a 72 65 61  63 68 69 6e 67 20 74 68  |ight.reaching th|
00001af0  65 6d 2e 20 51 52 54 20  73 74 6f 70 70 65 64 20  |em. QRT stopped |
00001b00  74 68 65 20 72 65 63 75  72 73 69 6f 6e 20 77 68  |the recursion wh|
00001b10  65 6e 20 74 68 65 20 69  6e 74 65 6e 73 69 74 79  |en the intensity|
00001b20  20 6f 66 20 74 68 65 20  6c 69 67 68 74 0a 72 65  | of the light.re|
00001b30  61 63 68 65 64 20 31 20  70 65 72 63 65 6e 74 20  |ached 1 percent |
00001b40  6f 66 20 69 74 73 20 6f  72 69 67 69 6e 61 6c 20  |of its original |
00001b50  76 61 6c 75 65 2e 20 57  68 65 6e 20 74 72 61 6e  |value. When tran|
00001b60  73 6d 69 73 73 69 6f 6e  20 77 61 73 20 61 64 64  |smission was add|
00001b70  65 64 2c 20 49 20 6d 61  64 65 0a 74 68 69 73 20  |ed, I made.this |
00001b80  76 61 6c 75 65 20 61 64  6a 75 73 74 61 62 6c 65  |value adjustable|
00001b90  2e 20 57 69 74 68 20 67  6c 61 73 73 20 6f 62 6a  |. With glass obj|
00001ba0  65 63 74 73 2c 20 62 6f  74 68 20 73 75 72 66 61  |ects, both surfa|
00001bb0  63 65 73 20 72 65 66 6c  65 63 74 20 6c 69 67 68  |ces reflect ligh|
00001bc0  74 2c 20 61 6e 64 0a 69  66 20 51 52 54 20 77 61  |t, and.if QRT wa|
00001bd0  69 74 73 20 75 6e 74 69  6c 20 74 68 65 20 31 20  |its until the 1 |
00001be0  70 65 72 63 65 6e 74 20  6d 61 72 6b 20 62 65 66  |percent mark bef|
00001bf0  6f 72 65 20 73 74 6f 70  70 69 6e 67 20 72 65 63  |ore stopping rec|
00001c00  75 72 73 69 6f 6e 2c 20  74 68 65 20 74 69 6d 65  |ursion, the time|
00001c10  0a 6e 65 63 65 73 73 61  72 79 20 74 6f 20 63 6f  |.necessary to co|
00001c20  6d 70 6c 65 74 65 20 74  68 65 20 69 6d 61 67 65  |mplete the image|
00001c30  20 69 73 20 67 72 65 61  74 6c 79 20 69 6e 63 72  | is greatly incr|
00001c40  65 61 73 65 64 20 77 69  74 68 20 6c 69 74 74 6c  |eased with littl|
00001c50  65 20 6f 72 20 6e 6f 0a  69 6e 63 72 65 61 73 65  |e or no.increase|
00001c60  20 69 6e 20 69 6d 61 67  65 20 71 75 61 6c 69 74  | in image qualit|
00001c70  79 2e 20 54 68 65 20 64  65 66 61 75 6c 74 20 69  |y. The default i|
00001c80  73 20 6e 6f 77 20 31 30  20 70 65 72 63 65 6e 74  |s now 10 percent|
00001c90  2c 20 61 6e 64 20 69 73  20 63 68 61 6e 67 65 61  |, and is changea|
00001ca0  62 6c 65 0a 61 73 20 66  6f 6c 6c 6f 77 73 3a 0a  |ble.as follows:.|
00001cb0  20 0a 20 20 20 44 45 46  41 55 4c 54 20 28 20 74  | .   DEFAULT ( t|
00001cc0  68 72 65 73 68 6f 6c 64  20 3d 20 2e 30 35 0a 20  |hreshold = .05. |
00001cd0  20 20 20 20 20 20 20 20  20 20 29 0a 20 0a 20 20  |          ). .  |
00001ce0  20 54 68 69 73 20 77 6f  75 6c 64 20 73 74 6f 70  | This would stop|
00001cf0  20 72 65 63 75 72 73 69  6f 6e 20 77 68 65 6e 20  | recursion when |
00001d00  74 68 65 20 69 6e 74 65  6e 73 69 74 79 20 72 65  |the intensity re|
00001d10  61 63 68 65 73 20 35 20  70 65 72 63 65 6e 74 20  |aches 5 percent |
00001d20  6f 66 20 74 68 65 0a 6f  72 69 67 69 6e 61 6c 20  |of the.original |
00001d30  76 61 6c 75 65 2e 20 41  6e 20 61 64 64 65 64 20  |value. An added |
00001d40  65 66 66 65 63 74 20 69  73 20 74 68 61 74 20 69  |effect is that i|
00001d50  66 20 74 68 65 20 6f 62  6a 65 63 74 73 20 73 75  |f the objects su|
00001d60  72 66 61 63 65 20 72 65  66 6c 65 63 74 73 20 28  |rface reflects (|
00001d70  6f 72 0a 74 72 61 6e 73  6d 69 74 73 29 20 6c 65  |or.transmits) le|
00001d80  73 73 20 74 68 61 6e 20  74 68 65 20 74 68 72 65  |ss than the thre|
00001d90  73 68 6f 6c 64 20 61 6d  6f 75 6e 74 20 6f 66 20  |shold amount of |
00001da0  6c 69 67 68 74 2c 20 74  68 65 20 72 65 66 6c 65  |light, the refle|
00001db0  63 74 69 6f 6e 20 6f 72  0a 74 72 61 6e 73 6d 69  |ction or.transmi|
00001dc0  73 73 69 6f 6e 20 77 69  6c 6c 20 62 65 20 69 67  |ssion will be ig|
00001dd0  6e 6f 72 65 64 20 63 6f  6d 70 6c 65 74 65 6c 79  |nored completely|
00001de0  2e 0a 20 0a 41 66 66 65  63 74 20 6f 66 20 47 6c  |.. .Affect of Gl|
00001df0  61 73 73 20 6f 6e 20 53  70 65 65 64 0a 7e 7e 7e  |ass on Speed.~~~|
00001e00  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |~~~~~~~~~~~~~~~~|
00001e10  7e 7e 7e 7e 7e 0a 20 0a  20 20 20 55 6e 66 6f 72  |~~~~~. .   Unfor|
00001e20  74 75 6e 61 74 65 6c 79  2c 20 74 68 65 20 70 72  |tunately, the pr|
00001e30  65 73 65 6e 63 65 20 6f  66 20 61 6e 79 20 67 6c  |esence of any gl|
00001e40  61 73 73 20 6f 62 6a 65  63 74 73 20 77 69 6c 6c  |ass objects will|
00001e50  20 73 6c 6f 77 20 74 68  65 20 72 61 79 20 74 72  | slow the ray tr|
00001e60  61 63 65 72 0a 64 6f 77  6e 2e 20 54 68 69 73 20  |acer.down. This |
00001e70  65 66 66 65 63 74 20 6d  61 79 20 72 61 6e 67 65  |effect may range|
00001e80  20 66 72 6f 6d 20 62 61  72 65 6c 79 20 6e 6f 74  | from barely not|
00001e90  69 63 65 61 62 6c 65 2c  20 66 6f 72 20 66 65 77  |iceable, for few|
00001ea0  2c 20 73 6d 61 6c 6c 20  6f 62 6a 65 63 74 73 0a  |, small objects.|
00001eb0  74 6f 20 65 78 63 72 75  63 69 61 74 69 6e 67 6c  |to excruciatingl|
00001ec0  79 20 6d 69 73 65 72 61  62 6c 79 20 73 6c 6f 77  |y miserably slow|
00001ed0  2c 20 66 6f 72 20 6d 61  6e 79 2c 20 6c 61 72 67  |, for many, larg|
00001ee0  65 20 6f 62 6a 65 63 74  73 2e 20 53 6f 72 72 79  |e objects. Sorry|
00001ef0  2c 20 74 68 65 72 65 20  69 73 0a 6e 6f 74 68 69  |, there is.nothi|
00001f00  6e 67 20 49 20 63 61 6e  20 64 6f 20 74 6f 20 73  |ng I can do to s|
00001f10  70 65 65 64 20 69 74 20  75 70 20 2d 20 74 68 65  |peed it up - the|
00001f20  20 36 38 30 30 30 20 73  69 6d 70 6c 79 20 77 6f  | 68000 simply wo|
00001f30  6e 27 74 20 67 6f 20 61  6e 79 20 66 61 73 74 65  |n't go any faste|
00001f40  72 2e 20 54 68 65 0a 72  65 61 73 6f 6e 20 66 6f  |r. The.reason fo|
00001f50  72 20 74 68 65 20 20 73  6c 6f 77 64 6f 77 6e 20  |r the  slowdown |
00001f60  69 73 20 74 68 61 74 20  66 6f 72 20 65 76 65 72  |is that for ever|
00001f70  79 20 72 61 79 2f 67 6c  61 73 73 20 73 75 72 66  |y ray/glass surf|
00001f80  61 63 65 20 69 6e 74 65  72 73 65 63 74 69 6f 6e  |ace intersection|
00001f90  2c 0a 54 57 4f 20 61 64  64 69 74 69 6f 6e 61 6c  |,.TWO additional|
00001fa0  20 72 61 79 73 20 6d 75  73 74 20 62 65 20 73 65  | rays must be se|
00001fb0  6e 74 20 6f 75 74 20 28  61 73 20 6f 70 70 6f 73  |nt out (as oppos|
00001fc0  65 64 20 74 6f 20 6f 6e  65 2c 20 66 6f 72 20 72  |ed to one, for r|
00001fd0  65 66 6c 65 63 74 69 6f  6e 29 2e 0a 41 6e 64 20  |eflection)..And |
00001fe0  72 65 6d 65 6d 62 65 72  2c 20 65 61 63 68 20 72  |remember, each r|
00001ff0  61 79 20 69 6e 74 65 72  73 65 63 74 73 20 61 20  |ay intersects a |
00002000  67 6c 61 73 73 20 6f 62  6a 65 63 74 20 74 77 69  |glass object twi|
00002010  63 65 3a 20 6f 6e 63 65  20 6f 6e 20 74 68 65 20  |ce: once on the |
00002020  77 61 79 20 69 6e 2c 0a  61 6e 64 20 6f 6e 63 65  |way in,.and once|
00002030  20 6f 6e 20 74 68 65 20  77 61 79 20 6f 75 74 2e  | on the way out.|
00002040  20 41 6c 73 6f 2c 20 74  68 65 20 74 77 6f 20 67  | Also, the two g|
00002050  65 6e 65 72 61 74 65 64  20 72 61 79 73 20 6d 61  |enerated rays ma|
00002060  79 20 69 6e 74 65 72 73  65 63 74 20 74 68 65 0a  |y intersect the.|
00002070  67 6c 61 73 73 2c 20 61  73 20 77 65 6c 6c 2e 20  |glass, as well. |
00002080  59 6f 75 20 63 61 6e 20  73 65 65 20 68 6f 77 20  |You can see how |
00002090  74 68 69 73 20 70 72 6f  63 65 73 73 20 63 6f 75  |this process cou|
000020a0  6c 64 20 67 65 74 20 76  65 72 79 20 73 6c 6f 77  |ld get very slow|
000020b0  2e 0a 20 0a 4e 6f 74 65  73 2c 20 65 74 63 2e 0a  |.. .Notes, etc..|
000020c0  7e 7e 7e 7e 7e 7e 7e 7e  7e 7e 7e 0a 20 0a 20 20  |~~~~~~~~~~~. .  |
000020d0  20 57 61 74 63 68 20 66  6f 72 20 63 6f 6e 74 72  | Watch for contr|
000020e0  6f 6c 20 63 68 61 72 61  63 74 65 72 73 20 69 6e  |ol characters in|
000020f0  20 74 68 65 20 51 52 54  20 69 6e 70 75 74 20 66  | the QRT input f|
00002100  69 6c 65 2e 20 49 20 68  61 64 20 61 63 63 69 64  |ile. I had accid|
00002110  65 6e 74 61 6c 6c 79 0a  69 6d 62 65 64 64 65 64  |entally.imbedded|
00002120  20 61 6e 20 69 6e 76 69  73 69 62 6c 65 20 63 6f  | an invisible co|
00002130  6e 74 72 6f 6c 20 63 68  61 72 61 63 74 65 72 20  |ntrol character |
00002140  69 6e 20 61 20 66 69 6c  65 20 49 20 77 61 73 20  |in a file I was |
00002150  77 6f 72 6b 69 6e 67 20  6f 6e 2c 20 61 6e 64 20  |working on, and |
00002160  74 68 65 0a 51 52 54 20  70 61 72 73 65 72 20 72  |the.QRT parser r|
00002170  65 66 75 73 65 64 20 74  6f 20 70 61 72 73 65 20  |efused to parse |
00002180  74 68 65 20 66 69 6c 65  2e 20 41 66 74 65 72 20  |the file. After |
00002190  63 6c 6f 73 65 6c 79 20  63 68 65 63 6b 69 6e 67  |closely checking|
000021a0  20 74 68 65 20 66 69 6c  65 2c 20 49 0a 62 65 67  | the file, I.beg|
000021b0  61 6e 20 74 6f 20 6c 6f  6f 6b 20 66 6f 72 20 61  |an to look for a|
000021c0  20 62 75 67 20 69 6e 20  74 68 65 20 70 61 72 73  | bug in the pars|
000021d0  65 72 20 63 6f 64 65 2e  20 46 69 6e 61 6c 6c 79  |er code. Finally|
000021e0  2c 20 49 20 64 69 73 63  6f 76 65 72 65 64 20 74  |, I discovered t|
000021f0  68 65 0a 63 6f 6e 74 72  6f 6c 20 63 68 61 72 61  |he.control chara|
00002200  63 74 65 72 2c 20 62 75  74 20 6f 6e 6c 79 20 61  |cter, but only a|
00002210  66 74 65 72 20 73 70 65  6e 64 69 6e 67 20 31 20  |fter spending 1 |
00002220  68 6f 75 72 20 63 68 65  63 6b 69 6e 67 20 74 68  |hour checking th|
00002230  65 20 70 61 72 73 65 72  20 63 6f 64 65 2e 0a 54  |e parser code..T|
00002240  68 65 20 51 52 54 20 70  61 72 73 65 72 20 77 69  |he QRT parser wi|
00002250  6c 6c 20 67 65 6e 65 72  61 74 65 20 61 20 53 59  |ll generate a SY|
00002260  4e 54 41 58 20 45 52 52  4f 52 2c 20 43 4f 44 45  |NTAX ERROR, CODE|
00002270  20 32 30 37 20 75 70 6f  6e 20 65 6e 63 6f 75 6e  | 207 upon encoun|
00002280  74 65 72 69 6e 67 20 61  6e 79 0a 73 70 65 63 69  |tering any.speci|
00002290  61 6c 20 63 68 61 72 61  63 74 65 72 73 20 69 6e  |al characters in|
000022a0  20 74 68 65 20 69 6e 70  75 74 20 66 69 6c 65 2e  | the input file.|
000022b0  0a 20 0a 20 20 20 53 69  6e 63 65 20 74 72 61 6e  |. .   Since tran|
000022c0  73 6d 69 73 73 69 6f 6e  20 69 6e 76 6f 6c 76 65  |smission involve|
000022d0  73 20 68 65 61 76 79 20  72 65 63 75 72 73 69 6f  |s heavy recursio|
000022e0  6e 2c 20 64 6f 6e 27 74  20 66 6f 72 67 65 74 20  |n, don't forget |
000022f0  74 6f 20 73 65 74 20 74  68 65 0a 64 65 66 61 75  |to set the.defau|
00002300  6c 74 20 73 74 61 63 6b  20 73 69 7a 65 20 74 6f  |lt stack size to|
00002310  20 73 6f 6d 65 74 68 69  6e 67 20 6c 61 72 67 65  | something large|
00002320  72 20 74 68 61 6e 20 74  68 65 20 64 65 66 61 75  |r than the defau|
00002330  6c 74 20 34 30 30 30 20  62 79 74 65 73 2e 20 41  |lt 4000 bytes. A|
00002340  20 73 74 61 63 6b 0a 73  69 7a 65 20 6f 66 20 34  | stack.size of 4|
00002350  30 30 30 30 20 74 6f 20  35 30 30 30 30 20 62 79  |0000 to 50000 by|
00002360  74 65 73 20 73 65 65 6d  73 20 73 61 66 65 20 66  |tes seems safe f|
00002370  6f 72 20 6d 6f 73 74 20  69 6d 61 67 65 73 2e 0a  |or most images..|
00002380  0a 0a 54 68 65 20 52 45  4d 4f 56 45 20 63 6f 6d  |..The REMOVE com|
00002390  6d 61 6e 64 0a 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |mand.===========|
000023a0  3d 3d 3d 3d 3d 3d 3d 0a  0a 20 20 20 54 68 65 20  |=======..   The |
000023b0  27 52 45 4d 4f 56 45 27  20 63 6f 6d 6d 61 6e 64  |'REMOVE' command|
000023c0  20 77 61 73 20 61 64 64  65 64 20 74 6f 20 61 6c  | was added to al|
000023d0  6c 6f 77 20 73 65 63 74  69 6f 6e 73 20 6f 66 20  |low sections of |
000023e0  61 20 70 6c 61 6e 61 72  20 70 72 69 6d 69 74 69  |a planar primiti|
000023f0  76 65 20 74 6f 0a 62 65  20 72 65 6d 6f 76 65 64  |ve to.be removed|
00002400  2e 20 54 68 69 73 20 6d  61 6b 65 73 20 69 74 20  |. This makes it |
00002410  6d 75 63 68 20 65 61 73  69 65 72 20 74 6f 20 63  |much easier to c|
00002420  72 65 61 74 65 20 66 6c  61 74 20 6f 62 6a 65 63  |reate flat objec|
00002430  74 73 20 74 68 61 74 20  61 72 65 20 6e 6f 74 0a  |ts that are not.|
00002440  73 68 61 70 65 64 20 6c  69 6b 65 20 51 52 54 27  |shaped like QRT'|
00002450  73 20 70 6c 61 6e 61 72  20 70 72 69 6d 69 74 69  |s planar primiti|
00002460  76 65 73 2e 20 46 6f 72  20 65 78 61 6d 70 6c 65  |ves. For example|
00002470  2c 20 49 20 68 61 64 20  61 20 51 52 54 20 69 6e  |, I had a QRT in|
00002480  70 75 74 20 66 69 6c 65  0a 77 68 69 63 68 20 63  |put file.which c|
00002490  72 65 61 74 65 64 20 74  68 65 20 69 6d 61 67 65  |reated the image|
000024a0  20 6f 66 20 61 20 67 72  61 6e 64 20 70 69 61 6e  | of a grand pian|
000024b0  6f 2e 20 54 68 65 20 74  6f 70 20 6f 66 20 74 68  |o. The top of th|
000024c0  65 20 70 69 61 6e 6f 2c  20 62 65 63 61 75 73 65  |e piano, because|
000024d0  20 6f 66 0a 69 74 73 20  63 6f 6d 70 6c 65 78 20  | of.its complex |
000024e0  73 68 61 70 65 2c 20 69  6e 69 74 69 61 6c 6c 79  |shape, initially|
000024f0  20 77 61 73 20 63 72 65  61 74 65 64 20 66 72 6f  | was created fro|
00002500  6d 20 31 31 20 70 6c 61  6e 61 72 20 70 72 69 6d  |m 11 planar prim|
00002510  69 74 69 76 65 73 2e 20  4e 6f 77 2c 20 69 74 0a  |itives. Now, it.|
00002520  69 73 20 6f 6e 6c 79 20  20 31 20 50 41 52 41 4c  |is only  1 PARAL|
00002530  4c 45 4c 4f 47 52 41 4d  20 70 72 69 6d 69 74 69  |LELOGRAM primiti|
00002540  76 65 2c 20 61 6e 64 20  61 20 73 65 63 74 69 6f  |ve, and a sectio|
00002550  6e 20 6f 66 20 74 68 65  20 70 61 72 61 6c 6c 65  |n of the paralle|
00002560  6c 6f 67 72 61 6d 20 69  73 0a 72 65 6d 6f 76 65  |logram is.remove|
00002570  64 20 74 6f 20 63 72 65  61 74 65 20 74 68 65 20  |d to create the |
00002580  73 68 61 70 65 20 6f 66  20 61 20 70 69 61 6e 6f  |shape of a piano|
00002590  20 74 6f 70 2e 0a 20 0a  20 20 20 42 65 66 6f 72  | top.. .   Befor|
000025a0  65 20 74 68 65 20 52 45  4d 4f 56 45 20 63 6f 6d  |e the REMOVE com|
000025b0  6d 61 6e 64 20 63 61 6e  20 62 65 20 75 73 65 64  |mand can be used|
000025c0  2c 20 61 20 70 61 74 74  65 72 6e 20 6d 75 73 74  |, a pattern must|
000025d0  20 62 65 20 63 72 65 61  74 65 64 20 75 73 69 6e  | be created usin|
000025e0  67 0a 61 6e 79 20 6f 66  20 51 52 54 27 73 20 70  |g.any of QRT's p|
000025f0  61 74 74 65 72 6e 20 70  72 69 6d 69 74 69 76 65  |attern primitive|
00002600  73 20 28 74 68 65 20 70  69 61 6e 6f 20 75 73 65  |s (the piano use|
00002610  73 20 61 20 70 6f 6c 79  67 6f 6e 29 2e 20 54 68  |s a polygon). Th|
00002620  69 73 20 70 61 74 74 65  72 6e 0a 6e 65 65 64 20  |is pattern.need |
00002630  6e 6f 74 20 62 65 20 67  69 76 65 6e 20 61 6e 79  |not be given any|
00002640  20 73 75 72 66 61 63 65  20 63 68 61 72 61 63 74  | surface charact|
00002650  65 72 69 73 74 69 63 73  20 2d 20 69 74 20 73 69  |eristics - it si|
00002660  6d 70 6c 79 20 64 65 66  69 6e 65 73 20 74 68 65  |mply defines the|
00002670  20 72 65 67 69 6f 6e 0a  74 6f 20 62 65 20 72 65  | region.to be re|
00002680  6d 6f 76 65 64 20 66 72  6f 6d 20 74 68 65 20 70  |moved from the p|
00002690  6c 61 6e 61 72 20 70 72  69 6d 69 74 69 76 65 2e  |lanar primitive.|
000026a0  20 54 68 65 20 70 61 74  74 65 72 6e 20 69 73 20  | The pattern is |
000026b0  61 74 74 61 63 68 65 64  20 74 6f 20 74 68 65 0a  |attached to the.|
000026c0  70 72 69 6d 69 74 69 76  65 20 69 6e 20 65 78 61  |primitive in exa|
000026d0  63 74 6c 79 20 74 68 65  20 73 61 6d 65 20 77 61  |ctly the same wa|
000026e0  79 20 61 73 20 61 20 6e  6f 72 6d 61 6c 20 70 61  |y as a normal pa|
000026f0  74 74 65 72 6e 2c 20 65  78 63 65 70 74 20 74 68  |ttern, except th|
00002700  61 74 20 74 68 65 0a 52  45 4d 4f 56 45 20 63 6f  |at the.REMOVE co|
00002710  6d 6d 61 6e 64 20 69 73  20 75 73 65 64 20 69 6e  |mmand is used in|
00002720  73 74 65 61 64 20 6f 66  20 74 68 65 20 50 41 54  |stead of the PAT|
00002730  54 45 52 4e 20 63 6f 6d  6d 61 6e 64 3a 0a 20 0a  |TERN command:. .|
00002740  20 20 20 50 41 52 41 4c  4c 45 4c 4f 47 52 41 4d  |   PARALLELOGRAM|
00002750  20 28 20 6c 6f 63 20 3d  20 28 30 2c 20 30 2c 20  | ( loc = (0, 0, |
00002760  30 29 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |0).             |
00002770  20 20 20 20 20 20 76 31  20 3d 20 28 31 30 2c 20  |      v1 = (10, |
00002780  30 2c 20 30 29 0a 20 20  20 20 20 20 20 20 20 20  |0, 0).          |
00002790  20 20 20 20 20 20 20 20  20 76 32 20 3d 20 28 30  |         v2 = (0|
000027a0  2c 20 30 2c 20 31 30 29  0a 20 0a 20 20 20 20 20  |, 0, 10). .     |
000027b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 64 69  |              di|
000027c0  66 66 20 3d 20 28 31 2c  20 30 2c 20 30 29 0a 20  |ff = (1, 0, 0). |
000027d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000027e0  20 20 72 65 6d 6f 76 65  20 3d 20 53 45 43 54 49  |  remove = SECTI|
000027f0  4f 4e 5f 54 4f 5f 52 45  4d 4f 56 45 0a 20 20 20  |ON_TO_REMOVE.   |
00002800  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002810  70 61 74 74 65 72 6e 20  3d 20 41 4e 59 5f 50 41  |pattern = ANY_PA|
00002820  54 54 45 52 4e 0a 20 20  20 20 20 20 20 20 20 20  |TTERN.          |
00002830  20 20 20 20 20 20 20 29  0a 20 0a 20 20 20 54 68  |       ). .   Th|
00002840  69 73 20 65 78 61 6d 70  6c 65 20 73 68 6f 77 73  |is example shows|
00002850  20 74 68 61 74 20 74 68  65 20 50 41 54 54 45 52  | that the PATTER|
00002860  4e 20 63 6f 6d 6d 61 6e  64 20 63 61 6e 20 62 65  |N command can be|
00002870  20 75 73 65 64 20 6f 6e  20 74 68 65 20 73 61 6d  | used on the sam|
00002880  65 0a 70 72 69 6d 69 74  69 76 65 20 61 73 20 74  |e.primitive as t|
00002890  68 65 20 52 45 4d 4f 56  45 20 63 6f 6d 6d 61 6e  |he REMOVE comman|
000028a0  64 2e 0a 20 0a 20 20 20  53 65 76 65 72 61 6c 20  |d.. .   Several |
000028b0  74 68 69 6e 67 73 20 73  68 6f 75 6c 64 20 62 65  |things should be|
000028c0  20 6e 6f 74 65 64 20 61  62 6f 75 74 20 74 68 65  | noted about the|
000028d0  20 52 45 4d 4f 56 45 20  63 6f 6d 6d 61 6e 64 2e  | REMOVE command.|
000028e0  20 46 69 72 73 74 2c 20  74 68 65 0a 70 61 74 74  | First, the.patt|
000028f0  65 72 6e 20 64 65 66 69  6e 65 73 20 74 68 65 20  |ern defines the |
00002900  73 65 63 74 69 6f 6e 73  20 74 6f 20 72 65 6d 6f  |sections to remo|
00002910  76 65 2c 20 6e 6f 74 20  74 68 65 20 73 65 63 74  |ve, not the sect|
00002920  69 6f 6e 73 20 77 68 69  63 68 20 77 69 6c 6c 20  |ions which will |
00002930  72 65 6d 61 69 6e 2e 0a  49 6e 20 74 68 65 20 70  |remain..In the p|
00002940  69 61 6e 6f 20 65 78 61  6d 70 6c 65 2c 20 74 68  |iano example, th|
00002950  65 20 70 61 74 74 65 72  6e 20 6d 61 70 70 65 64  |e pattern mapped|
00002960  20 61 6c 6c 20 6f 66 20  74 68 65 20 70 61 72 61  | all of the para|
00002970  6c 6c 65 6c 6f 67 72 61  6d 20 65 78 63 65 70 74  |llelogram except|
00002980  20 74 68 65 0a 70 61 72  74 20 74 68 61 74 20 63  | the.part that c|
00002990  6f 6d 70 6f 73 65 64 20  74 68 65 20 61 63 74 75  |omposed the actu|
000029a0  61 6c 20 70 69 61 6e 6f  20 74 6f 70 2e 20 53 65  |al piano top. Se|
000029b0  63 6f 6e 64 2c 20 65 76  65 6e 20 74 68 6f 75 67  |cond, even thoug|
000029c0  68 20 74 68 65 20 72 65  6d 6f 76 65 0a 63 6f 6d  |h the remove.com|
000029d0  6d 61 6e 64 20 63 61 6e  20 62 65 20 75 73 65 64  |mand can be used|
000029e0  20 77 69 74 68 20 74 68  65 20 63 75 72 76 65 64  | with the curved|
000029f0  20 73 75 72 66 61 63 65  20 70 72 69 6d 69 74 69  | surface primiti|
00002a00  76 65 73 20 28 53 50 48  45 52 45 2c 20 51 55 41  |ves (SPHERE, QUA|
00002a10  44 52 41 54 49 43 29 2c  0a 74 68 65 20 72 65 73  |DRATIC),.the res|
00002a20  75 6c 74 73 20 77 69 6c  6c 20 6e 6f 74 20 62 65  |ults will not be|
00002a30  20 71 75 69 74 65 20 72  69 67 68 74 2e 20 54 6f  | quite right. To|
00002a40  20 75 73 65 20 74 68 65  20 73 70 68 65 72 65 20  | use the sphere |
00002a50  61 73 20 61 6e 20 65 78  61 6d 70 6c 65 2c 20 74  |as an example, t|
00002a60  68 65 0a 66 72 6f 6e 74  20 73 75 72 66 61 63 65  |he.front surface|
00002a70  20 6f 66 20 74 68 65 20  73 70 68 65 72 65 20 77  | of the sphere w|
00002a80  6f 75 6c 64 20 68 61 76  65 20 74 68 65 20 63 6f  |ould have the co|
00002a90  72 72 65 63 74 20 70 61  74 74 65 72 6e 20 72 65  |rrect pattern re|
00002aa0  6d 6f 76 65 64 20 66 72  6f 6d 20 69 74 2c 0a 62  |moved from it,.b|
00002ab0  75 74 20 74 68 65 20 62  61 63 6b 20 73 75 72 66  |ut the back surf|
00002ac0  61 63 65 20 6f 66 20 74  68 65 20 73 70 68 65 72  |ace of the spher|
00002ad0  65 20 77 6f 75 6c 64 20  20 62 65 20 63 6f 6d 70  |e would  be comp|
00002ae0  6c 65 74 65 6c 79 20 67  6f 6e 65 2e 20 54 68 69  |letely gone. Thi|
00002af0  73 20 69 73 0a 62 65 63  61 75 73 65 20 74 68 65  |s is.because the|
00002b00  20 53 50 48 45 52 45 20  69 6e 74 65 72 73 65 63  | SPHERE intersec|
00002b10  74 20 72 6f 75 74 69 6e  65 20 69 67 6e 6f 72 65  |t routine ignore|
00002b20  73 20 63 6f 6d 70 6c 65  74 65 6c 79 20 74 68 65  |s completely the|
00002b30  20 62 61 63 6b 20 73 75  72 66 61 63 65 20 6f 66  | back surface of|
00002b40  0a 74 68 65 20 73 70 68  65 72 65 2e 20 49 20 77  |.the sphere. I w|
00002b50  69 6c 6c 20 70 72 6f 62  61 62 6c 79 20 66 69 78  |ill probably fix|
00002b60  20 74 68 69 73 20 69 6e  20 61 20 66 75 74 75 72  | this in a futur|
00002b70  65 20 76 65 72 73 69 6f  6e 2e 0a                 |e version..|
00002b7b