home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / doc / guide / objects.tex < prev    next >
LaTeX Document  |  1994-08-10  |  22.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: objects.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file LaTeX document, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 4f 62 6a 65 63 74 20 |\chapter|{Object |
|00000010| 44 65 66 69 6e 69 74 69 | 6f 6e 7d 0a 0a 4f 62 6a |Definiti|on}..Obj|
|00000020| 65 63 74 73 20 69 6e 20 | 7b 5c 72 61 79 73 68 61 |ects in |{\raysha|
|00000030| 64 65 7d 20 61 72 65 20 | 63 6f 6d 70 6f 73 65 64 |de} are |composed|
|00000040| 20 6f 66 20 72 65 6c 61 | 74 69 76 65 6c 79 20 73 | of rela|tively s|
|00000050| 69 6d 70 6c 65 20 7b 5c | 65 6d 20 70 72 69 6d 69 |imple {\|em primi|
|00000060| 74 69 76 65 7d 0a 6f 62 | 6a 65 63 74 73 2e 20 20 |tive}.ob|jects. |
|00000070| 54 68 65 73 65 20 70 72 | 69 6d 69 74 69 76 65 73 |These pr|imitives|
|00000080| 20 6d 61 79 20 62 65 20 | 75 73 65 64 20 62 79 20 | may be |used by |
|00000090| 74 68 65 6d 73 65 6c 76 | 65 73 2c 20 6f 72 20 74 |themselv|es, or t|
|000000a0| 68 65 79 0a 6d 61 79 20 | 62 65 20 63 6f 6d 62 69 |hey.may |be combi|
|000000b0| 6e 65 64 20 74 6f 20 66 | 6f 72 6d 20 6d 6f 72 65 |ned to f|orm more|
|000000c0| 20 63 6f 6d 70 6c 65 78 | 20 6f 62 6a 65 63 74 73 | complex| objects|
|000000d0| 20 6b 6e 6f 77 6e 20 61 | 73 20 7b 5c 65 6d 20 61 | known a|s {\em a|
|000000e0| 67 67 72 65 67 61 74 65 | 73 7d 2e 0a 41 20 73 70 |ggregate|s}..A sp|
|000000f0| 65 63 69 61 6c 20 66 61 | 6d 69 6c 79 20 6f 66 20 |ecial fa|mily of |
|00000100| 61 67 67 72 65 67 61 74 | 65 20 6f 62 6a 65 63 74 |aggregat|e object|
|00000110| 73 2c 0a 7b 5c 65 6d 20 | 43 6f 6e 73 74 72 75 63 |s,.{\em |Construc|
|00000120| 74 69 76 65 20 53 6f 6c | 69 64 20 47 65 6f 6d 65 |tive Sol|id Geome|
|00000130| 74 72 79 7d 20 6f 72 20 | 43 53 47 0a 6f 62 6a 65 |try} or |CSG.obje|
|00000140| 63 74 73 2c 20 61 72 65 | 20 74 68 65 20 72 65 73 |cts, are| the res|
|00000150| 75 6c 74 20 6f 66 20 61 | 20 62 6f 6f 6c 65 61 6e |ult of a| boolean|
|00000160| 20 6f 70 65 72 61 74 69 | 6f 6e 73 20 61 70 70 6c | operati|ons appl|
|00000170| 69 65 64 20 74 6f 0a 70 | 72 69 6d 69 74 69 76 65 |ied to.p|rimitive|
|00000180| 2c 20 61 67 67 72 65 67 | 61 74 65 2c 20 6f 72 20 |, aggreg|ate, or |
|00000190| 43 53 47 20 6f 62 6a 65 | 63 74 73 2e 0a 0a 54 68 |CSG obje|cts...Th|
|000001a0| 69 73 20 63 68 61 70 74 | 65 72 20 64 65 73 63 72 |is chapt|er descr|
|000001b0| 69 62 65 73 20 6f 62 6a | 65 63 74 73 20 66 72 6f |ibes obj|ects fro|
|000001c0| 6d 20 61 20 73 74 72 69 | 63 74 6c 79 20 67 65 6f |m a stri|ctly geo|
|000001d0| 6d 65 74 72 69 63 20 70 | 6f 69 6e 74 20 6f 66 0a |metric p|oint of.|
|000001e0| 76 69 65 77 2e 20 20 4c | 61 74 65 72 20 63 68 61 |view. L|ater cha|
|000001f0| 70 74 65 72 73 20 6f 6e | 20 73 75 72 66 61 63 65 |pters on| surface|
|00000200| 73 2c 20 74 65 78 74 75 | 72 65 73 2c 20 61 6e 64 |s, textu|res, and|
|00000210| 20 73 68 61 64 69 6e 67 | 20 64 65 73 63 72 69 62 | shading| describ|
|00000220| 65 0a 68 6f 77 20 6f 62 | 6a 65 63 74 20 61 70 70 |e.how ob|ject app|
|00000230| 65 61 72 61 6e 63 65 73 | 20 61 72 65 20 64 65 66 |earances| are def|
|00000240| 69 6e 65 64 2e 0a 0a 41 | 6e 20 7b 5c 65 6d 20 69 |ined...A|n {\em i|
|00000250| 6e 73 74 61 6e 63 65 7d | 20 69 73 20 61 6e 20 6f |nstance}| is an o|
|00000260| 62 6a 65 63 74 20 74 68 | 61 74 20 68 61 73 20 6f |bject th|at has o|
|00000270| 70 74 69 6f 6e 61 6c 6c | 79 20 62 65 65 6e 20 74 |ptionall|y been t|
|00000280| 72 61 6e 73 66 6f 72 6d | 65 64 0a 61 6e 64 0a 74 |ransform|ed.and.t|
|00000290| 65 78 74 75 72 65 64 2e | 20 20 54 68 65 79 20 61 |extured.| They a|
|000002a0| 72 65 20 74 68 65 20 65 | 6e 74 69 74 69 65 73 20 |re the e|ntities |
|000002b0| 74 68 61 74 20 61 72 65 | 20 61 63 74 75 61 6c 6c |that are| actuall|
|000002c0| 79 20 72 65 6e 64 65 72 | 65 64 20 62 79 0a 7b 5c |y render|ed by.{\|
|000002d0| 72 61 79 73 68 61 64 65 | 7d 3b 20 77 68 65 6e 20 |rayshade|}; when |
|000002e0| 79 6f 75 20 73 70 65 63 | 69 66 79 20 74 68 61 74 |you spec|ify that|
|000002f0| 2c 20 66 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 61 |, for ex|ample, a|
|00000300| 20 74 65 78 74 75 72 65 | 64 0a 73 70 68 65 72 65 | texture|d.sphere|
|00000310| 20 69 73 20 74 6f 20 62 | 65 20 72 65 6e 64 65 72 | is to b|e render|
|00000320| 65 64 2c 20 79 6f 75 20 | 61 72 65 20 73 61 69 64 |ed, you |are said|
|00000330| 20 74 6f 20 62 65 20 69 | 6e 73 74 61 6e 74 69 61 | to be i|nstantia|
|00000340| 74 69 6e 67 0a 74 68 65 | 20 74 65 78 74 75 72 65 |ting.the| texture|
|00000350| 64 20 73 70 68 65 72 65 | 2e 0a 41 6e 20 69 6e 73 |d sphere|..An ins|
|00000360| 74 61 6e 63 65 0a 69 73 | 20 73 70 65 63 69 66 69 |tance.is| specifi|
|00000370| 65 64 20 61 73 20 61 20 | 70 72 69 6d 69 74 69 76 |ed as a |primitiv|
|00000380| 65 2c 20 61 67 67 72 65 | 67 61 74 65 2c 20 6f 72 |e, aggre|gate, or|
|00000390| 20 43 53 47 20 6f 62 6a | 65 63 74 20 74 68 61 74 | CSG obj|ect that|
|000003a0| 0a 69 73 20 66 6f 6c 6c | 6f 77 65 64 20 62 79 20 |.is foll|owed by |
|000003b0| 6f 70 74 69 6f 6e 61 6c | 20 74 72 61 6e 73 66 6f |optional| transfo|
|000003c0| 72 6d 61 74 69 6f 6e 20 | 61 6e 64 20 74 65 78 74 |rmation |and text|
|000003d0| 75 72 69 6e 67 20 69 6e | 66 6f 72 6d 61 74 69 6f |uring in|formatio|
|000003e0| 6e 2e 0a 54 72 61 6e 73 | 66 6f 72 6d 61 74 69 6f |n..Trans|formatio|
|000003f0| 6e 73 20 61 6e 64 20 74 | 65 78 74 75 72 65 73 20 |ns and t|extures |
|00000400| 61 72 65 20 64 65 73 63 | 72 69 62 65 64 20 69 6e |are desc|ribed in|
|00000410| 20 43 68 61 70 74 65 72 | 73 20 37 20 61 6e 64 20 | Chapter|s 7 and |
|00000420| 38 20 72 65 73 70 65 63 | 74 69 76 65 6c 79 2e 0a |8 respec|tively..|
|00000430| 0a 5c 73 65 63 74 69 6f | 6e 7b 54 68 65 20 57 6f |.\sectio|n{The Wo|
|00000440| 72 6c 64 20 4f 62 6a 65 | 63 74 7d 0a 0a 57 72 69 |rld Obje|ct}..Wri|
|00000450| 74 69 6e 67 20 61 20 7b | 5c 72 61 79 73 68 61 64 |ting a {|\rayshad|
|00000460| 65 7d 20 69 6e 70 75 74 | 20 66 69 6c 65 20 69 73 |e} input| file is|
|00000470| 20 70 72 69 6e 63 69 70 | 61 6c 6c 79 0a 61 20 6d | princip|ally.a m|
|00000480| 61 74 74 65 72 20 6f 66 | 20 64 65 66 69 6e 69 6e |atter of| definin|
|00000490| 67 20 61 20 73 70 65 63 | 69 61 6c 20 61 67 67 72 |g a spec|ial aggr|
|000004a0| 65 67 61 74 65 20 6f 62 | 6a 65 63 74 2c 20 74 68 |egate ob|ject, th|
|000004b0| 65 20 57 6f 72 6c 64 20 | 6f 62 6a 65 63 74 2c 0a |e World |object,.|
|000004c0| 77 68 69 63 68 20 69 73 | 20 61 20 6c 69 73 74 20 |which is| a list |
|000004d0| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 73 20 69 |of the o|bjects i|
|000004e0| 6e 20 74 68 65 20 73 63 | 65 6e 65 2e 20 20 57 68 |n the sc|ene. Wh|
|000004f0| 65 6e 20 77 72 69 74 69 | 6e 67 20 61 20 7b 5c 72 |en writi|ng a {\r|
|00000500| 61 79 73 68 61 64 65 7d | 0a 69 6e 70 75 74 20 66 |ayshade}|.input f|
|00000510| 69 6c 65 2c 20 61 6c 6c | 20 6f 62 6a 65 63 74 73 |ile, all| objects|
|00000520| 20 74 68 61 74 20 61 72 | 65 20 69 6e 73 74 61 6e | that ar|e instan|
|00000530| 74 69 61 74 65 64 20 6f | 75 74 73 69 64 65 20 6f |tiated o|utside o|
|00000540| 66 20 6f 62 6a 65 63 74 | 2d 64 65 66 69 6e 69 74 |f object|-definit|
|00000550| 69 6f 6e 0a 62 6c 6f 63 | 6b 73 20 61 72 65 20 61 |ion.bloc|ks are a|
|00000560| 64 64 65 64 20 74 6f 20 | 74 68 65 20 57 6f 72 6c |dded to |the Worl|
|00000570| 64 20 6f 62 6a 65 63 74 | 3b 20 79 6f 75 20 6e 65 |d object|; you ne|
|00000580| 65 64 20 6e 6f 74 20 28 | 6e 6f 72 20 73 68 6f 75 |ed not (|nor shou|
|00000590| 6c 64 20 79 6f 75 29 0a | 64 65 66 69 6e 65 20 74 |ld you).|define t|
|000005a0| 68 65 20 57 6f 72 6c 64 | 20 6f 62 6a 65 63 74 20 |he World| object |
|000005b0| 65 78 70 6c 69 63 69 74 | 6c 79 20 69 6e 20 74 68 |explicit|ly in th|
|000005c0| 65 20 69 6e 70 75 74 20 | 66 69 6c 65 2e 0a 0a 5c |e input |file...\|
|000005d0| 73 65 63 74 69 6f 6e 7b | 50 72 69 6d 69 74 69 76 |section{|Primitiv|
|000005e0| 65 73 7d 0a 0a 50 72 69 | 6d 69 74 69 76 65 20 6f |es}..Pri|mitive o|
|000005f0| 62 6a 65 63 74 73 20 61 | 72 65 20 74 68 65 20 62 |bjects a|re the b|
|00000600| 75 69 6c 64 69 6e 67 20 | 62 6f 78 20 77 69 74 68 |uilding |box with|
|00000610| 20 77 68 69 63 68 20 6f | 74 68 65 72 20 6f 62 6a | which o|ther obj|
|00000620| 65 63 74 73 20 61 72 65 | 0a 63 72 65 61 74 65 64 |ects are|.created|
|00000630| 2e 20 20 45 61 63 68 20 | 70 72 69 6d 69 74 69 76 |. Each |primitiv|
|00000640| 65 20 74 79 70 65 20 68 | 61 73 20 61 73 73 6f 63 |e type h|as assoc|
|00000650| 69 61 74 65 64 20 77 69 | 74 68 20 69 74 20 73 70 |iated wi|th it sp|
|00000660| 65 63 69 61 6c 69 7a 65 | 64 0a 6d 65 74 68 6f 64 |ecialize|d.method|
|00000670| 73 20 66 6f 72 0a 63 72 | 65 61 74 69 6f 6e 2c 0a |s for.cr|eation,.|
|00000680| 69 6e 74 65 72 73 65 63 | 74 69 6f 6e 20 77 69 74 |intersec|tion wit|
|00000690| 68 20 61 20 72 61 79 2c | 0a 62 6f 75 6e 64 69 6e |h a ray,|.boundin|
|000006a0| 67 20 62 6f 78 20 63 61 | 6c 63 75 6c 61 74 69 6f |g box ca|lculatio|
|000006b0| 6e 2c 0a 73 75 72 66 61 | 63 65 20 6e 6f 72 6d 61 |n,.surfa|ce norma|
|000006c0| 6c 20 63 61 6c 63 75 6c | 61 74 69 6f 6e 2c 0a 72 |l calcul|ation,.r|
|000006d0| 61 79 20 65 6e 74 65 72 | 2f 65 78 69 74 20 63 6c |ay enter|/exit cl|
|000006e0| 61 73 73 69 66 69 63 61 | 74 69 6f 6e 2c 0a 61 6e |assifica|tion,.an|
|000006f0| 64 20 66 6f 72 20 74 68 | 65 20 63 6f 6d 70 75 74 |d for th|e comput|
|00000700| 61 74 69 6f 6e 20 32 44 | 20 74 65 78 74 75 72 65 |ation 2D| texture|
|00000710| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 20 74 65 72 | coordin|ates ter|
|00000720| 6d 65 64 20 7b 5c 65 6d | 20 75 2d 76 7d 0a 63 6f |med {\em| u-v}.co|
|00000730| 6f 72 64 69 6e 61 74 65 | 73 2e 0a 54 68 69 73 20 |ordinate|s..This |
|00000740| 6c 61 74 74 65 72 20 6d | 65 74 68 6f 64 20 69 73 |latter m|ethod is|
|00000750| 20 6f 66 74 65 6e 20 72 | 65 66 65 72 72 65 64 20 | often r|eferred |
|00000760| 74 6f 20 61 73 20 74 68 | 65 20 7b 5c 65 6d 20 69 |to as th|e {\em i|
|00000770| 6e 76 65 72 73 65 20 6d | 61 70 70 69 6e 67 7d 0a |nverse m|apping}.|
|00000780| 6d 65 74 68 6f 64 2e 0a | 0a 57 68 69 6c 65 20 6d |method..|.While m|
|00000790| 6f 73 74 20 6f 66 20 74 | 68 65 73 65 20 6d 65 74 |ost of t|hese met|
|000007a0| 68 6f 64 73 20 73 68 6f | 75 6c 64 20 62 65 20 6f |hods sho|uld be o|
|000007b0| 66 20 6c 69 74 74 6c 65 | 20 63 6f 6e 63 65 72 6e |f little| concern|
|000007c0| 20 74 6f 20 79 6f 75 2c | 20 74 68 65 0a 69 6e 76 | to you,| the.inv|
|000007d0| 65 72 73 65 20 6d 61 70 | 70 69 6e 67 20 6d 65 74 |erse map|ping met|
|000007e0| 68 6f 64 73 0a 77 69 6c | 6c 20 61 66 66 65 63 74 |hods.wil|l affect|
|000007f0| 20 74 68 65 20 77 61 79 | 20 69 6e 20 77 68 69 63 | the way| in whic|
|00000800| 68 20 63 65 72 74 61 69 | 6e 20 74 65 78 74 75 72 |h certai|n textur|
|00000810| 65 73 20 61 72 65 20 61 | 70 70 6c 69 65 64 20 74 |es are a|pplied t|
|00000820| 6f 20 70 72 69 6d 69 74 | 69 76 65 73 2e 0a 49 6e |o primit|ives..In|
|00000830| 76 65 72 73 65 20 6d 61 | 70 70 69 6e 67 20 69 73 |verse ma|pping is|
|00000840| 20 61 20 6d 61 74 74 65 | 72 20 6f 66 20 63 6f 6d | a matte|r of com|
|00000850| 70 75 74 69 6e 67 20 6e | 6f 72 6d 61 6c 69 7a 65 |puting n|ormalize|
|00000860| 64 20 24 75 24 20 61 6e | 64 20 24 76 24 20 63 6f |d $u$ an|d $v$ co|
|00000870| 6f 72 64 69 6e 61 74 65 | 73 0a 66 6f 72 20 61 20 |ordinate|s.for a |
|00000880| 67 69 76 65 6e 20 70 6f | 69 6e 74 20 6f 6e 20 74 |given po|int on t|
|00000890| 68 65 20 73 75 72 66 61 | 63 65 20 6f 66 20 74 68 |he surfa|ce of th|
|000008a0| 65 20 70 72 69 6d 69 74 | 69 76 65 2e 20 20 46 6f |e primit|ive. Fo|
|000008b0| 72 20 70 6c 61 6e 61 72 | 20 6f 62 6a 65 63 74 73 |r planar| objects|
|000008c0| 2c 0a 74 68 65 20 24 75 | 24 20 61 6e 64 20 24 76 |,.the $u|$ and $v|
|000008d0| 24 20 63 6f 6f 72 64 69 | 6e 61 74 65 73 20 6f 66 |$ coordi|nates of|
|000008e0| 20 61 20 70 6f 69 6e 74 | 20 61 72 65 20 63 6f 6d | a point| are com|
|000008f0| 70 75 74 65 64 0a 62 79 | 20 6c 69 6e 65 61 72 20 |puted.by| linear |
|00000900| 69 6e 74 65 72 70 6f 6c | 61 74 69 6f 6e 20 62 61 |interpol|ation ba|
|00000910| 73 65 64 20 75 70 6f 6e | 20 74 68 65 20 24 75 24 |sed upon| the $u$|
|00000920| 20 61 6e 64 20 24 76 24 | 20 63 6f 6f 72 64 69 6e | and $v$| coordin|
|00000930| 61 74 65 73 20 61 73 73 | 69 67 6e 65 64 0a 74 6f |ates ass|igned.to|
|00000940| 20 76 65 72 74 69 63 65 | 73 20 6f 72 20 6f 74 68 | vertice|s or oth|
|00000950| 65 72 20 6b 6e 6f 77 6e | 20 70 6f 69 6e 74 73 20 |er known| points |
|00000960| 6f 6e 20 74 68 65 20 70 | 72 69 6d 69 74 69 76 65 |on the p|rimitive|
|00000970| 2e 20 20 46 6f 72 20 6e | 6f 6e 2d 70 6c 61 6e 61 |. For n|on-plana|
|00000980| 72 0a 6f 62 6a 65 63 74 | 73 2c 20 24 75 76 24 20 |r.object|s, $uv$ |
|00000990| 63 6f 6d 70 75 74 61 74 | 69 6f 6e 20 63 61 6e 20 |computat|ion can |
|000009a0| 62 65 20 63 6f 6e 73 69 | 64 65 72 61 62 6c 79 20 |be consi|derably |
|000009b0| 6d 6f 72 65 20 69 6e 76 | 6f 6c 76 65 64 2e 0a 0a |more inv|olved...|
|000009c0| 54 68 69 73 20 73 65 63 | 74 69 6f 6e 20 62 72 69 |This sec|tion bri|
|000009d0| 65 66 6c 79 20 64 65 73 | 63 72 69 62 65 73 20 65 |efly des|cribes e|
|000009e0| 61 63 68 20 70 72 69 6d | 69 74 69 76 65 20 61 6e |ach prim|itive an|
|000009f0| 64 0a 74 68 65 20 73 79 | 6e 74 61 78 20 74 68 61 |d.the sy|ntax tha|
|00000a00| 74 20 73 68 6f 75 6c 64 | 20 62 65 20 75 73 65 64 |t should| be used|
|00000a10| 20 74 6f 20 63 72 65 61 | 74 65 20 61 6e 20 69 6e | to crea|te an in|
|00000a20| 73 74 61 6e 63 65 20 6f | 66 20 74 68 65 20 70 72 |stance o|f the pr|
|00000a30| 69 6d 69 74 69 76 65 2e | 0a 49 74 20 61 6c 73 6f |imitive.|.It also|
|00000a40| 20 64 65 73 63 72 69 62 | 65 73 20 74 68 65 20 69 | describ|es the i|
|00000a50| 6e 76 65 72 73 65 20 6d | 61 70 70 69 6e 67 20 6d |nverse m|apping m|
|00000a60| 65 74 68 6f 64 2c 20 69 | 66 20 61 6e 79 2c 20 66 |ethod, i|f any, f|
|00000a70| 6f 72 20 65 61 63 68 20 | 74 79 70 65 2e 0a 0a 5c |or each |type...\|
|00000a80| 62 65 67 69 6e 7b 64 65 | 66 70 72 69 6d 7d 7b 62 |begin{de|fprim}{b|
|00000a90| 6c 6f 62 7d 7b 7b 5c 65 | 6d 20 74 68 72 65 73 68 |lob}{{\e|m thresh|
|00000aa0| 20 73 74 20 72 7d 20 5c | 65 76 65 63 7b 70 7d 20 | st r} \|evec{p} |
|00000ab0| 5b 7b 5c 65 6d 20 73 74 | 20 72 7d 20 5c 65 76 65 |[{\em st| r} \eve|
|00000ac0| 63 7b 70 7d 20 5c 6c 64 | 6f 74 73 5d 7d 0a 09 44 |c{p} \ld|ots]}..D|
|00000ad0| 65 66 69 6e 65 73 20 61 | 20 62 6c 6f 62 20 77 69 |efines a| blob wi|
|00000ae0| 74 68 20 63 6f 6e 73 69 | 73 74 69 6e 67 20 6f 66 |th consi|sting of|
|00000af0| 20 61 20 74 68 72 65 73 | 68 6f 6c 64 20 65 71 75 | a thres|hold equ|
|00000b00| 61 6c 20 74 6f 20 7b 5c | 65 6d 20 74 68 72 65 73 |al to {\|em thres|
|00000b10| 68 7d 2c 0a 09 61 6e 64 | 20 61 0a 09 67 72 6f 75 |h},..and| a..grou|
|00000b20| 70 20 6f 66 20 6f 6e 65 | 20 6f 72 20 6d 6f 72 65 |p of one| or more|
|00000b30| 20 6d 65 74 61 62 61 6c | 6c 73 2e 20 20 45 61 63 | metabal|ls. Eac|
|00000b40| 68 20 6d 65 74 61 62 61 | 6c 6c 20 69 73 20 64 65 |h metaba|ll is de|
|00000b50| 66 69 6e 65 64 20 62 79 | 20 0a 09 69 74 73 20 70 |fined by| ..its p|
|00000b60| 6f 73 69 74 69 6f 6e 20 | 5c 65 76 65 63 7b 70 7d |osition |\evec{p}|
|00000b70| 2c 20 72 61 64 69 75 73 | 20 7b 5c 65 6d 20 72 7d |, radius| {\em r}|
|00000b80| 2c 20 61 6e 64 20 73 74 | 72 65 6e 67 74 68 20 7b |, and st|rength {|
|00000b90| 5c 65 6d 20 73 74 7d 2e | 0a 5c 65 6e 64 7b 64 65 |\em st}.|.\end{de|
|00000ba0| 66 70 72 69 6d 7d 0a 54 | 68 65 20 6d 65 74 61 62 |fprim}.T|he metab|
|00000bb0| 61 6c 6c 73 20 61 66 66 | 65 63 74 20 65 61 63 68 |alls aff|ect each|
|00000bc0| 20 6f 74 68 65 72 20 61 | 63 63 6f 72 64 69 6e 67 | other a|ccording|
|00000bd0| 20 74 6f 20 61 20 73 75 | 70 65 72 69 6d 70 6f 73 | to a su|perimpos|
|00000be0| 65 64 0a 64 65 6e 73 69 | 74 79 20 64 69 73 74 72 |ed.densi|ty distr|
|00000bf0| 69 62 75 74 69 6f 6e 3a | 0a 5c 5b 0a 46 28 78 2c |ibution:|.\[.F(x,|
|00000c00| 79 2c 7a 29 20 3d 20 5c | 73 75 6d 5f 7b 69 3d 30 |y,z) = \|sum_{i=0|
|00000c10| 7d 5e 6e 20 62 5f 7b 69 | 7d 65 5e 7b 2d 64 5f 7b |}^n b_{i|}e^{-d_{|
|00000c20| 69 7d 7d 20 2d 20 54 20 | 3d 20 30 0a 5c 5d 0a 54 |i}} - T |= 0.\].T|
|00000c30| 68 65 72 65 20 69 73 20 | 6e 6f 20 69 6e 76 65 72 |here is |no inver|
|00000c40| 73 65 20 6d 61 70 70 69 | 6e 67 20 6d 65 74 68 6f |se mappi|ng metho|
|00000c50| 64 20 66 6f 72 20 62 6c | 6f 62 73 2e 0a 0a 5c 62 |d for bl|obs...\b|
|00000c60| 65 67 69 6e 7b 64 65 66 | 70 72 69 6d 7d 7b 62 6f |egin{def|prim}{bo|
|00000c70| 78 7d 7b 5c 65 76 65 63 | 7b 63 6f 72 6e 65 72 31 |x}{\evec|{corner1|
|00000c80| 7d 20 5c 65 76 65 63 7b | 63 6f 72 6e 65 72 32 7d |} \evec{|corner2}|
|00000c90| 7d 0a 09 43 72 65 61 74 | 65 73 20 61 6e 20 61 78 |}..Creat|es an ax|
|00000ca0| 69 73 2d 61 6c 69 67 6e | 65 64 20 62 6f 78 0a 09 |is-align|ed box..|
|00000cb0| 77 68 69 63 68 20 68 61 | 73 20 5c 65 76 65 63 7b |which ha|s \evec{|
|00000cc0| 63 6f 72 6e 65 72 31 7d | 20 61 6e 64 20 5c 65 76 |corner1}| and \ev|
|00000cd0| 65 63 7b 63 6f 72 6e 65 | 72 32 7d 20 61 73 0a 09 |ec{corne|r2} as..|
|00000ce0| 6f 70 70 6f 73 69 74 65 | 20 63 6f 72 6e 65 72 73 |opposite| corners|
|00000cf0| 2e 0a 5c 65 6e 64 7b 64 | 65 66 70 72 69 6d 7d 0a |..\end{d|efprim}.|
|00000d00| 54 72 61 6e 73 66 6f 72 | 6d 61 74 69 6f 6e 73 20 |Transfor|mations |
|00000d10| 6d 61 79 20 62 65 20 61 | 70 70 6c 69 65 64 20 74 |may be a|pplied t|
|00000d20| 6f 20 74 68 65 20 62 6f | 78 20 69 66 20 61 20 6e |o the bo|x if a n|
|00000d30| 6f 6e 2d 61 78 69 73 2d | 61 6c 69 67 6e 65 64 20 |on-axis-|aligned |
|00000d40| 69 6e 73 74 61 6e 63 65 | 0a 69 73 20 72 65 71 75 |instance|.is requ|
|00000d50| 69 72 65 64 2e 20 20 54 | 68 65 72 65 20 69 73 20 |ired. T|here is |
|00000d60| 6e 6f 20 69 6e 76 65 72 | 73 65 20 6d 61 70 70 69 |no inver|se mappi|
|00000d70| 6e 67 20 6d 65 74 68 6f | 64 20 66 6f 72 20 62 6f |ng metho|d for bo|
|00000d80| 78 65 73 2e 0a 0a 5c 62 | 65 67 69 6e 7b 64 65 66 |xes...\b|egin{def|
|00000d90| 70 72 69 6d 7d 7b 73 70 | 68 65 72 65 7d 7b 7b 5c |prim}{sp|here}{{\|
|00000da0| 65 6d 20 72 61 64 69 75 | 73 7d 20 5c 65 76 65 63 |em radiu|s} \evec|
|00000db0| 7b 63 65 6e 74 65 72 7d | 7d 0a 09 43 72 65 61 74 |{center}|}..Creat|
|00000dc0| 65 73 20 61 20 73 70 68 | 65 72 65 20 77 69 74 68 |es a sph|ere with|
|00000dd0| 20 74 68 65 20 67 69 76 | 65 6e 20 7b 5c 65 6d 20 | the giv|en {\em |
|00000de0| 72 61 64 69 75 73 7d 20 | 61 6e 64 20 63 65 6e 74 |radius} |and cent|
|00000df0| 65 72 65 64 20 61 74 20 | 74 68 65 0a 09 67 69 76 |ered at |the..giv|
|00000e00| 65 6e 20 70 6f 73 69 74 | 69 6f 6e 2e 0a 5c 65 6e |en posit|ion..\en|
|00000e10| 64 7b 64 65 66 70 72 69 | 6d 7d 0a 4e 6f 74 65 20 |d{defpri|m}.Note |
|00000e20| 74 68 61 74 20 65 6c 6c | 69 70 73 6f 69 64 73 20 |that ell|ipsoids |
|00000e30| 6d 61 79 20 62 65 20 63 | 72 65 61 74 65 64 20 62 |may be c|reated b|
|00000e40| 79 20 61 70 70 6c 79 69 | 6e 67 20 74 68 65 20 70 |y applyi|ng the p|
|00000e50| 72 6f 70 65 72 20 73 63 | 61 6c 69 6e 67 0a 74 6f |roper sc|aling.to|
|00000e60| 20 61 20 73 70 68 65 72 | 65 2e 20 20 49 6e 76 65 | a spher|e. Inve|
|00000e70| 72 73 65 20 6d 61 70 70 | 69 6e 67 20 6f 6e 20 74 |rse mapp|ing on t|
|00000e80| 68 65 20 73 70 68 65 72 | 65 20 69 73 20 61 63 63 |he spher|e is acc|
|00000e90| 6f 6d 70 6c 69 73 68 65 | 64 0a 62 79 20 63 6f 6d |omplishe|d.by com|
|00000ea0| 70 75 74 69 6e 67 20 74 | 68 65 20 6c 6f 6e 67 69 |puting t|he longi|
|00000eb0| 74 75 64 65 20 61 6e 64 | 20 6c 61 74 69 74 75 64 |tude and| latitud|
|00000ec0| 65 20 6f 66 20 74 68 65 | 20 70 6f 69 6e 74 20 6f |e of the| point o|
|00000ed0| 6e 20 74 68 65 20 73 70 | 68 65 72 65 2c 0a 77 69 |n the sp|here,.wi|
|00000ee0| 74 68 20 74 68 65 20 24 | 75 24 20 76 61 6c 75 65 |th the $|u$ value|
|00000ef0| 20 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 20 74 | corresp|onding t|
|00000f00| 6f 20 6c 6f 6e 67 69 74 | 75 64 65 20 61 6e 64 20 |o longit|ude and |
|00000f10| 24 76 24 20 74 6f 20 6c | 61 74 69 74 75 64 65 2e |$v$ to l|atitude.|
|00000f20| 0a 4f 6e 20 61 6e 20 75 | 6e 74 72 61 6e 73 66 6f |.On an u|ntransfo|
|00000f30| 72 6d 65 64 20 73 70 68 | 65 72 65 2c 20 74 68 65 |rmed sph|ere, the|
|00000f40| 20 24 7a 24 20 61 78 69 | 73 20 64 65 66 69 6e 65 | $z$ axi|s define|
|00000f50| 73 20 74 68 65 20 70 6f | 6c 65 73 2c 20 61 6e 64 |s the po|les, and|
|00000f60| 20 74 68 65 0a 24 78 24 | 20 61 78 69 73 20 69 6e | the.$x$| axis in|
|00000f70| 74 65 72 73 65 63 74 73 | 20 74 68 65 20 73 70 68 |tersects| the sph|
|00000f80| 65 72 65 20 61 74 20 24 | 75 20 3d 20 30 24 2c 20 |ere at $|u = 0$, |
|00000f90| 24 76 20 3d 20 30 2e 35 | 24 2e 20 20 54 68 65 72 |$v = 0.5|$. Ther|
|00000fa0| 65 20 61 72 65 0a 64 65 | 67 65 6e 65 72 61 63 69 |e are.de|generaci|
|00000fb0| 65 73 20 61 74 20 74 68 | 65 20 70 6f 6c 65 73 3a |es at th|e poles:|
|00000fc0| 20 74 68 65 20 73 6f 75 | 74 68 20 70 6f 6c 65 20 | the sou|th pole |
|00000fd0| 63 6f 6e 74 61 69 6e 73 | 20 61 6c 6c 20 70 6f 69 |contains| all poi|
|00000fe0| 6e 74 73 20 6f 66 0a 6c | 61 74 69 74 75 64 65 20 |nts of.l|atitude |
|00000ff0| 30 2e 2c 20 74 68 65 20 | 6e 6f 72 74 68 20 61 6c |0., the |north al|
|00001000| 6c 20 70 6f 69 6e 74 73 | 20 6f 66 20 6c 61 74 69 |l points| of lati|
|00001010| 74 75 64 65 20 31 2e 0a | 0a 5c 62 65 67 69 6e 7b |tude 1..|.\begin{|
|00001020| 64 65 66 70 72 69 6d 7d | 7b 74 6f 72 75 73 7d 7b |defprim}|{torus}{|
|00001030| 7b 5c 65 6d 20 72 6d 61 | 6a 6f 72 20 72 6d 69 6e |{\em rma|jor rmin|
|00001040| 6f 72 7d 20 5c 65 76 65 | 63 7b 63 65 6e 74 65 72 |or} \eve|c{center|
|00001050| 7d 20 5c 65 76 65 63 7b | 75 70 7d 7d 0a 09 43 72 |} \evec{|up}}..Cr|
|00001060| 65 61 74 65 73 20 61 20 | 74 6f 72 75 73 20 63 65 |eates a |torus ce|
|00001070| 6e 74 65 72 65 64 20 61 | 74 20 5c 65 76 65 63 7b |ntered a|t \evec{|
|00001080| 63 65 6e 74 65 72 7d 20 | 62 79 20 72 6f 74 61 74 |center} |by rotat|
|00001090| 69 6e 67 0a 09 61 20 63 | 69 72 63 6c 65 20 77 69 |ing..a c|ircle wi|
|000010a0| 74 68 20 74 68 65 20 67 | 69 76 65 6e 20 6d 69 6e |th the g|iven min|
|000010b0| 6f 72 20 72 61 64 69 75 | 73 20 61 72 6f 75 6e 64 |or radiu|s around|
|000010c0| 20 74 68 65 20 63 65 6e | 74 65 72 0a 09 70 6f 69 | the cen|ter..poi|
|000010d0| 6e 74 20 61 74 20 61 20 | 64 69 73 74 61 6e 63 65 |nt at a |distance|
|000010e0| 20 65 71 75 61 6c 20 74 | 6f 20 74 68 65 20 6d 61 | equal t|o the ma|
|000010f0| 6a 6f 72 20 72 61 64 69 | 75 73 2e 20 0a 5c 65 6e |jor radi|us. .\en|
|00001100| 64 7b 64 65 66 70 72 69 | 6d 7d 0a 49 6e 20 74 6f |d{defpri|m}.In to|
|00001110| 72 69 20 69 6e 76 65 72 | 73 65 20 6d 61 70 70 69 |ri inver|se mappi|
|00001120| 6e 67 2c 0a 74 68 65 20 | 24 75 24 20 76 61 6c 75 |ng,.the |$u$ valu|
|00001130| 65 20 69 73 20 63 6f 6d | 70 75 74 65 64 20 75 73 |e is com|puted us|
|00001140| 69 6e 67 20 74 68 65 20 | 61 6e 67 6c 65 20 6f 66 |ing the |angle of|
|00001150| 20 72 6f 74 61 74 69 6f | 6e 20 61 62 6f 75 74 20 | rotatio|n about |
|00001160| 74 68 65 0a 75 70 20 76 | 65 63 74 6f 72 2c 20 61 |the.up v|ector, a|
|00001170| 6e 64 20 74 68 65 20 24 | 76 24 20 76 61 6c 75 65 |nd the $|v$ value|
|00001180| 20 69 73 20 63 6f 6d 70 | 75 74 69 6e 67 20 74 68 | is comp|uting th|
|00001190| 65 20 61 6e 67 6c 65 20 | 6f 66 20 72 6f 74 61 74 |e angle |of rotat|
|000011a0| 69 6f 6e 0a 61 72 6f 75 | 6e 64 20 74 68 65 20 74 |ion.arou|nd the t|
|000011b0| 75 62 65 2c 20 77 69 74 | 68 20 24 76 3d 30 24 20 |ube, wit|h $v=0$ |
|000011c0| 6f 63 63 75 72 69 6e 67 | 20 6f 6e 20 74 68 65 20 |occuring| on the |
|000011d0| 69 6e 6e 65 72 6d 6f 73 | 74 20 70 6f 69 6e 74 20 |innermos|t point |
|000011e0| 6f 66 20 74 68 65 20 74 | 75 62 65 2e 0a 0a 5c 62 |of the t|ube...\b|
|000011f0| 65 67 69 6e 7b 64 65 66 | 70 72 69 6d 7d 7b 74 72 |egin{def|prim}{tr|
|00001200| 69 61 6e 67 6c 65 7d 7b | 5c 65 76 65 63 7b 70 31 |iangle}{|\evec{p1|
|00001210| 7d 20 5c 65 76 65 63 7b | 70 32 7d 20 5c 65 76 65 |} \evec{|p2} \eve|
|00001220| 63 7b 70 33 7d 7d 0a 09 | 43 72 65 61 74 65 73 20 |c{p3}}..|Creates |
|00001230| 61 20 74 72 69 61 6e 67 | 6c 65 20 77 69 74 68 20 |a triang|le with |
|00001240| 74 68 65 20 67 69 76 65 | 6e 20 76 65 72 74 69 63 |the give|n vertic|
|00001250| 65 73 2e 0a 5c 65 6e 64 | 7b 64 65 66 70 72 69 6d |es..\end|{defprim|
|00001260| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 64 65 66 70 72 69 |}..\begi|n{defpri|
|00001270| 6d 7d 7b 74 72 69 61 6e | 67 6c 65 7d 7b 5c 65 76 |m}{trian|gle}{\ev|
|00001280| 65 63 7b 70 31 7d 20 5c | 65 76 65 63 7b 6e 31 7d |ec{p1} \|evec{n1}|
|00001290| 20 5c 65 76 65 63 7b 70 | 32 7d 20 5c 65 76 65 63 | \evec{p|2} \evec|
|000012a0| 7b 6e 32 7d 0a 09 5c 65 | 76 65 63 7b 70 33 7d 20 |{n2}..\e|vec{p3} |
|000012b0| 5c 65 76 65 63 7b 6e 33 | 7d 7d 0a 09 43 72 65 61 |\evec{n3|}}..Crea|
|000012c0| 74 65 73 20 61 20 50 68 | 6f 6e 67 2d 73 68 61 64 |tes a Ph|ong-shad|
|000012d0| 65 64 20 74 72 69 61 6e | 67 6c 65 20 77 69 74 68 |ed trian|gle with|
|000012e0| 20 74 68 65 20 67 69 76 | 65 6e 20 76 65 72 74 69 | the giv|en verti|
|000012f0| 63 65 73 20 61 6e 64 0a | 09 76 65 72 74 65 78 20 |ces and.|.vertex |
|00001300| 6e 6f 72 6d 61 6c 73 2e | 0a 5c 65 6e 64 7b 64 65 |normals.|.\end{de|
|00001310| 66 70 72 69 6d 7d 0a 46 | 6f 72 20 62 6f 74 68 20 |fprim}.F|or both |
|00001320| 50 68 6f 6e 67 2d 20 61 | 6e 64 20 66 6c 61 74 2d |Phong- a|nd flat-|
|00001330| 73 68 61 64 65 64 20 74 | 72 69 61 6e 67 6c 65 73 |shaded t|riangles|
|00001340| 2c 20 74 68 65 20 24 75 | 24 20 61 78 69 73 20 69 |, the $u|$ axis i|
|00001350| 73 20 74 68 65 0a 76 65 | 63 74 6f 72 20 66 72 6f |s the.ve|ctor fro|
|00001360| 6d 20 5c 65 76 65 63 7b | 70 31 7d 20 74 6f 20 5c |m \evec{|p1} to \|
|00001370| 65 76 65 63 7b 70 32 7d | 2c 20 61 6e 64 20 74 68 |evec{p2}|, and th|
|00001380| 65 20 24 76 24 20 61 78 | 69 73 20 74 68 65 20 76 |e $v$ ax|is the v|
|00001390| 65 63 74 6f 72 0a 66 72 | 6f 6d 20 5c 65 76 65 63 |ector.fr|om \evec|
|000013a0| 7b 70 31 7d 20 74 6f 20 | 5c 65 76 65 63 7b 70 33 |{p1} to |\evec{p3|
|000013b0| 7d 2e 20 20 54 68 65 72 | 65 20 69 73 20 61 20 64 |}. Ther|e is a d|
|000013c0| 65 67 65 6e 65 72 61 63 | 79 20 61 74 0a 5c 65 76 |egenerac|y at.\ev|
|000013d0| 65 63 7b 70 33 7d 2c 20 | 77 68 69 63 68 20 63 6f |ec{p3}, |which co|
|000013e0| 6e 74 61 69 6e 73 20 61 | 6c 6c 20 70 6f 69 6e 74 |ntains a|ll point|
|000013f0| 73 20 77 69 74 68 20 24 | 76 20 3d 20 31 2e 30 24 |s with $|v = 1.0$|
|00001400| 2e 20 20 54 68 69 73 20 | 64 65 66 61 75 6c 74 0a |. This |default.|
|00001410| 6d 61 70 70 69 6e 67 20 | 6d 61 79 20 62 65 20 6d |mapping |may be m|
|00001420| 6f 64 69 66 69 65 64 20 | 75 73 69 6e 67 20 74 68 |odified |using th|
|00001430| 65 20 7b 5c 74 74 20 74 | 72 69 61 6e 67 6c 65 75 |e {\tt t|riangleu|
|00001440| 76 7d 20 70 72 69 6d 69 | 74 69 76 65 20 64 65 73 |v} primi|tive des|
|00001450| 63 72 69 62 65 64 0a 62 | 65 6c 6f 77 2e 0a 0a 5c |cribed.b|elow...\|
|00001460| 62 65 67 69 6e 7b 64 65 | 66 70 72 69 6d 7d 7b 74 |begin{de|fprim}{t|
|00001470| 72 69 61 6e 67 6c 65 75 | 76 7d 7b 5c 65 76 65 63 |riangleu|v}{\evec|
|00001480| 7b 70 31 7d 20 5c 65 76 | 65 63 7b 6e 31 7d 20 5c |{p1} \ev|ec{n1} \|
|00001490| 65 76 65 63 7b 75 76 31 | 7d 0a 20 20 5c 65 76 65 |evec{uv1|}. \eve|
|000014a0| 63 7b 70 32 7d 20 5c 65 | 76 65 63 7b 6e 32 7d 20 |c{p2} \e|vec{n2} |
|000014b0| 5c 65 76 65 63 7b 75 76 | 32 7d 0a 20 20 5c 65 76 |\evec{uv|2}. \ev|
|000014c0| 65 63 7b 70 33 7d 20 5c | 65 76 65 63 7b 6e 33 7d |ec{p3} \|evec{n3}|
|000014d0| 20 5c 65 76 65 63 7b 75 | 76 33 7d 7d 0a 09 43 72 | \evec{u|v3}}..Cr|
|000014e0| 65 61 74 65 73 20 61 20 | 50 68 6f 6e 67 2d 73 68 |eates a |Phong-sh|
|000014f0| 61 64 65 64 20 74 72 69 | 61 6e 67 6c 65 20 77 69 |aded tri|angle wi|
|00001500| 74 68 20 74 68 65 20 67 | 69 76 65 6e 20 76 65 72 |th the g|iven ver|
|00001510| 74 69 63 65 73 2c 0a 09 | 76 65 72 74 65 78 20 6e |tices,..|vertex n|
|00001520| 6f 72 6d 61 6c 73 2e 20 | 20 57 68 65 6e 20 70 65 |ormals. | When pe|
|00001530| 72 66 6f 72 6d 69 6e 67 | 20 74 65 78 74 75 72 69 |rforming| texturi|
|00001540| 6e 67 2c 20 74 68 65 0a | 09 7b 5c 65 6d 20 75 76 |ng, the.|.{\em uv|
|00001550| 7d 20 67 69 76 65 6e 20 | 66 6f 72 20 65 61 63 68 |} given |for each|
|00001560| 20 76 65 72 74 65 78 20 | 61 72 65 20 75 73 65 64 | vertex |are used|
|00001570| 20 69 6e 73 74 65 61 64 | 20 6f 66 20 74 68 65 0a | instead| of the.|
|00001580| 09 64 65 66 61 75 6c 74 | 20 76 61 6c 75 65 73 2e |.default| values.|
|00001590| 0a 5c 65 6e 64 7b 64 65 | 66 70 72 69 6d 7d 0a 57 |.\end{de|fprim}.W|
|000015a0| 68 65 6e 20 63 6f 6d 70 | 75 74 69 6e 67 20 24 75 |hen comp|uting $u|
|000015b0| 76 24 20 63 6f 6f 72 64 | 69 6e 61 74 65 73 20 77 |v$ coord|inates w|
|000015c0| 69 74 68 69 6e 20 74 68 | 65 20 69 6e 74 65 72 69 |ithin th|e interi|
|000015d0| 6f 72 20 6f 66 20 74 68 | 65 0a 74 72 69 61 6e 67 |or of th|e.triang|
|000015e0| 6c 65 2c 20 6c 69 6e 65 | 61 72 20 69 6e 74 65 72 |le, line|ar inter|
|000015f0| 70 6f 6c 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |polation| of the |
|00001600| 63 6f 6f 72 64 69 6e 61 | 74 65 73 20 61 73 73 6f |coordina|tes asso|
|00001610| 63 69 61 74 65 64 20 77 | 69 74 68 0a 65 61 63 68 |ciated w|ith.each|
|00001620| 20 74 72 69 61 6e 67 6c | 65 20 76 65 72 74 65 78 | triangl|e vertex|
|00001630| 20 69 73 20 75 73 65 64 | 2e 0a 0a 5c 62 65 67 69 | is used|...\begi|
|00001640| 6e 7b 64 65 66 70 72 69 | 6d 7d 7b 70 6f 6c 79 7d |n{defpri|m}{poly}|
|00001650| 7b 5c 65 76 65 63 7b 70 | 31 7d 20 5c 65 76 65 63 |{\evec{p|1} \evec|
|00001660| 7b 70 32 7d 20 5c 65 76 | 65 63 7b 70 33 7d 20 5b |{p2} \ev|ec{p3} [|
|00001670| 5c 65 76 65 63 7b 70 34 | 7d 20 5c 6c 64 6f 74 73 |\evec{p4|} \ldots|
|00001680| 20 5d 7d 0a 09 43 72 65 | 61 74 65 73 20 61 20 70 | ]}..Cre|ates a p|
|00001690| 6f 6c 79 67 6f 6e 20 77 | 69 74 68 20 74 68 65 20 |olygon w|ith the |
|000016a0| 67 69 76 65 6e 20 76 65 | 72 74 69 63 65 73 2e 20 |given ve|rtices. |
|000016b0| 54 68 65 20 76 65 72 74 | 69 63 65 73 0a 09 73 68 |The vert|ices..sh|
|000016c0| 6f 75 6c 64 20 62 65 20 | 67 69 76 65 6e 20 69 6e |ould be |given in|
|000016d0| 20 63 6f 75 6e 74 65 72 | 2d 63 6c 6f 63 6b 77 69 | counter|-clockwi|
|000016e0| 73 65 20 6f 72 64 65 72 | 20 61 73 20 6f 6e 65 20 |se order| as one |
|000016f0| 69 73 0a 09 6c 6f 6f 6b | 69 6e 67 20 61 74 20 74 |is..look|ing at t|
|00001700| 68 65 20 60 60 66 72 6f | 6e 74 27 27 20 73 69 64 |he ``fro|nt'' sid|
|00001710| 65 20 6f 66 20 74 68 65 | 20 70 6f 6c 79 67 6f 6e |e of the| polygon|
|00001720| 2e 20 20 54 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |. The n|umber of|
|00001730| 0a 09 76 65 72 74 69 63 | 65 73 20 69 6e 20 61 20 |..vertic|es in a |
|00001740| 70 6f 6c 79 67 6f 6e 20 | 69 73 20 6c 69 6d 69 74 |polygon |is limit|
|00001750| 65 64 20 6f 6e 6c 79 20 | 62 79 20 61 76 61 69 6c |ed only |by avail|
|00001760| 61 62 6c 65 20 6d 65 6d | 6f 72 79 2e 0a 5c 65 6e |able mem|ory..\en|
|00001770| 64 7b 64 65 66 70 72 69 | 6d 7d 0a 49 6e 76 65 72 |d{defpri|m}.Inver|
|00001780| 73 65 20 6d 61 70 70 69 | 6e 67 20 66 6f 72 20 61 |se mappi|ng for a|
|00001790| 72 62 69 74 72 61 72 79 | 20 70 6f 6c 79 67 6f 6e |rbitrary| polygon|
|000017a0| 73 20 69 73 20 70 72 6f | 62 6c 65 6d 61 74 69 63 |s is pro|blematic|
|000017b0| 61 6c 2e 0a 7b 5c 52 61 | 79 73 68 61 64 65 7d 0a |al..{\Ra|yshade}.|
|000017c0| 70 75 6e 74 73 20 61 6e | 64 20 65 71 75 61 74 65 |punts an|d equate|
|000017d0| 73 20 24 75 24 20 77 69 | 74 68 20 74 68 65 20 24 |s $u$ wi|th the $|
|000017e0| 78 24 20 63 6f 6f 72 64 | 69 6e 61 74 65 20 6f 66 |x$ coord|inate of|
|000017f0| 20 74 68 65 20 70 6f 69 | 6e 74 20 6f 66 20 69 6e | the poi|nt of in|
|00001800| 74 65 72 73 65 63 74 69 | 6f 6e 2c 0a 61 6e 64 20 |tersecti|on,.and |
|00001810| 24 76 24 20 77 69 74 68 | 20 74 68 65 20 24 79 24 |$v$ with| the $y$|
|00001820| 20 63 6f 6f 72 64 69 6e | 61 74 65 2e 0a 0a 5c 62 | coordin|ate...\b|
|00001830| 65 67 69 6e 7b 64 65 66 | 70 72 69 6d 7d 7b 68 65 |egin{def|prim}{he|
|00001840| 69 67 68 74 66 69 65 6c | 64 7d 7b 7b 5c 65 6d 20 |ightfiel|d}{{\em |
|00001850| 66 69 6c 65 7d 7d 0a 09 | 43 72 65 61 74 65 73 20 |file}}..|Creates |
|00001860| 61 20 68 65 69 67 68 74 | 20 66 69 65 6c 64 20 64 |a height| field d|
|00001870| 65 66 69 6e 65 64 20 62 | 79 20 74 68 65 20 61 6c |efined b|y the al|
|00001880| 74 69 74 75 64 65 20 64 | 61 74 61 20 73 74 6f 72 |titude d|ata stor|
|00001890| 65 64 0a 09 69 6e 20 74 | 68 65 20 6e 61 6d 65 64 |ed..in t|he named|
|000018a0| 20 7b 5c 65 6d 20 66 69 | 6c 65 7d 2e 20 20 54 68 | {\em fi|le}. Th|
|000018b0| 65 20 68 65 69 67 68 74 | 20 66 69 65 6c 64 20 69 |e height| field i|
|000018c0| 73 20 62 61 73 65 64 20 | 75 70 6f 6e 0a 09 70 65 |s based |upon..pe|
|000018d0| 72 74 75 72 62 61 74 69 | 6f 6e 73 20 6f 66 20 74 |rturbati|ons of t|
|000018e0| 68 65 20 75 6e 69 74 20 | 73 71 75 61 72 65 20 69 |he unit |square i|
|000018f0| 6e 20 74 68 65 20 24 7a | 3d 30 24 20 70 6c 61 6e |n the $z|=0$ plan|
|00001900| 65 2c 20 61 6e 64 20 69 | 73 0a 09 72 65 6e 64 65 |e, and i|s..rende|
|00001910| 72 65 64 20 61 73 20 61 | 20 73 75 72 66 61 63 65 |red as a| surface|
|00001920| 20 74 65 73 73 65 6c 6c | 61 74 65 64 20 62 79 20 | tessell|ated by |
|00001930| 72 69 67 68 74 20 69 73 | 6f 73 63 65 6c 65 73 20 |right is|osceles |
|00001940| 74 72 69 61 6e 67 6c 65 | 73 2e 0a 5c 65 6e 64 7b |triangle|s..\end{|
|00001950| 64 65 66 70 72 69 6d 7d | 0a 53 65 65 20 41 70 70 |defprim}|.See App|
|00001960| 65 6e 64 69 78 20 43 20 | 66 6f 72 20 61 20 64 69 |endix C |for a di|
|00001970| 73 63 75 73 73 69 6f 6e | 20 6f 66 20 74 68 65 20 |scussion| of the |
|00001980| 66 6f 72 6d 61 74 20 6f | 66 20 61 20 68 65 69 67 |format o|f a heig|
|00001990| 68 74 20 66 69 65 6c 64 | 20 66 69 6c 65 2c 20 61 |ht field| file, a|
|000019a0| 6e 64 0a 73 65 65 20 41 | 70 70 65 6e 64 69 78 20 |nd.see A|ppendix |
|000019b0| 44 20 66 6f 72 20 69 6e | 66 6f 72 6d 61 74 69 6f |D for in|formatio|
|000019c0| 6e 20 6f 6e 20 63 72 65 | 61 74 69 6e 67 20 68 65 |n on cre|ating he|
|000019d0| 69 67 68 74 66 69 65 6c | 64 20 66 69 6c 65 73 20 |ightfiel|d files |
|000019e0| 75 73 69 6e 67 20 52 61 | 79 73 68 61 64 65 2e 0a |using Ra|yshade..|
|000019f0| 48 65 69 67 68 74 20 66 | 69 65 6c 64 20 69 6e 76 |Height f|ield inv|
|00001a00| 65 72 73 65 20 6d 61 70 | 70 69 6e 67 20 69 73 20 |erse map|ping is |
|00001a10| 73 74 72 61 69 67 68 74 | 2d 66 6f 72 77 61 72 64 |straight|-forward|
|00001a20| 3a 20 20 24 75 24 20 69 | 73 20 74 68 65 0a 24 78 |: $u$ i|s the.$x|
|00001a30| 24 20 63 6f 6f 72 64 69 | 6e 61 74 65 20 6f 66 20 |$ coordi|nate of |
|00001a40| 74 68 65 20 70 6f 69 6e | 74 20 6f 66 20 69 6e 74 |the poin|t of int|
|00001a50| 65 72 73 65 63 74 69 6f | 6e 2c 20 24 76 24 20 74 |ersectio|n, $v$ t|
|00001a60| 68 65 20 24 79 24 20 63 | 6f 6f 72 64 69 6e 61 74 |he $y$ c|oordinat|
|00001a70| 65 2e 0a 0a 5c 62 65 67 | 69 6e 7b 64 65 66 70 72 |e...\beg|in{defpr|
|00001a80| 69 6d 7d 7b 70 6c 61 6e | 65 7d 7b 5c 65 76 65 63 |im}{plan|e}{\evec|
|00001a90| 7b 70 6f 69 6e 74 7d 20 | 5c 65 76 65 63 7b 6e 6f |{point} |\evec{no|
|00001aa0| 72 6d 61 6c 7d 7d 0a 09 | 43 72 65 61 74 65 73 20 |rmal}}..|Creates |
|00001ab0| 61 20 70 6c 61 6e 65 20 | 74 68 61 74 20 70 61 73 |a plane |that pas|
|00001ac0| 73 65 73 20 74 68 72 6f | 75 67 68 20 74 68 65 20 |ses thro|ugh the |
|00001ad0| 67 69 76 65 6e 20 70 6f | 69 6e 74 20 61 6e 64 0a |given po|int and.|
|00001ae0| 09 68 61 73 20 74 68 65 | 20 73 70 65 63 69 66 69 |.has the| specifi|
|00001af0| 65 64 20 6e 6f 72 6d 61 | 6c 2e 0a 5c 65 6e 64 7b |ed norma|l..\end{|
|00001b00| 64 65 66 70 72 69 6d 7d | 0a 49 6e 76 65 72 73 65 |defprim}|.Inverse|
|00001b10| 20 6d 61 70 70 69 6e 67 | 20 6f 6e 20 74 68 65 20 | mapping| on the |
|00001b20| 70 6c 61 6e 65 20 69 73 | 20 69 64 65 6e 74 69 63 |plane is| identic|
|00001b30| 61 6c 20 74 6f 20 70 6f | 6c 79 67 6f 6e 61 6c 20 |al to po|lygonal |
|00001b40| 69 6e 76 65 72 73 65 20 | 6d 61 70 70 69 6e 67 2e |inverse |mapping.|
|00001b50| 0a 0a 5c 62 65 67 69 6e | 7b 64 65 66 70 72 69 6d |..\begin|{defprim|
|00001b60| 7d 7b 63 79 6c 69 6e 64 | 65 72 7d 7b 7b 5c 65 6d |}{cylind|er}{{\em|
|00001b70| 20 72 61 64 69 75 73 7d | 20 5c 65 76 65 63 7b 62 | radius}| \evec{b|
|00001b80| 6f 74 74 6f 6d 7d 20 5c | 65 76 65 63 7b 74 6f 70 |ottom} \|evec{top|
|00001b90| 7d 7d 0a 09 43 72 65 61 | 74 65 73 20 61 20 63 79 |}}..Crea|tes a cy|
|00001ba0| 6c 69 6e 64 65 72 20 74 | 68 61 74 20 65 78 74 65 |linder t|hat exte|
|00001bb0| 6e 64 73 20 66 72 6f 6d | 20 5c 65 76 65 63 7b 62 |nds from| \evec{b|
|00001bc0| 6f 74 74 6f 6d 7d 20 74 | 6f 20 5c 65 76 65 63 7b |ottom} t|o \evec{|
|00001bd0| 74 6f 70 7d 0a 09 61 6e | 64 20 68 61 73 20 74 68 |top}..an|d has th|
|00001be0| 65 20 69 6e 64 69 63 61 | 74 65 64 20 7b 5c 65 6d |e indica|ted {\em|
|00001bf0| 20 72 61 64 69 75 73 7d | 2e 20 20 43 79 6c 69 6e | radius}|. Cylin|
|00001c00| 64 65 72 73 20 61 72 65 | 20 72 65 6e 64 65 72 65 |ders are| rendere|
|00001c10| 64 0a 09 7b 5c 65 6d 20 | 77 69 74 68 6f 75 74 7d |d..{\em |without}|
|00001c20| 20 65 6e 64 63 61 70 73 | 2e 0a 5c 65 6e 64 7b 64 | endcaps|..\end{d|
|00001c30| 65 66 70 72 69 6d 7d 0a | 54 68 65 20 63 79 6c 69 |efprim}.|The cyli|
|00001c40| 6e 64 65 72 27 73 20 61 | 78 69 73 20 64 65 66 69 |nder's a|xis defi|
|00001c50| 6e 65 73 20 74 68 65 20 | 24 76 24 20 61 78 69 73 |nes the |$v$ axis|
|00001c60| 2e 20 20 54 68 65 20 24 | 75 24 20 61 78 69 73 20 |. The $|u$ axis |
|00001c70| 77 72 61 70 73 20 61 72 | 6f 75 6e 64 20 74 68 65 |wraps ar|ound the|
|00001c80| 0a 63 79 6c 69 6e 64 65 | 72 2c 20 77 69 74 68 20 |.cylinde|r, with |
|00001c90| 24 75 3d 30 24 20 64 65 | 70 65 6e 64 65 6e 74 20 |$u=0$ de|pendent |
|00001ca0| 75 70 6f 6e 20 74 68 65 | 20 6f 72 69 65 6e 74 61 |upon the| orienta|
|00001cb0| 74 69 6f 6e 20 6f 66 20 | 74 68 65 20 63 79 6c 69 |tion of |the cyli|
|00001cc0| 6e 64 65 72 2e 0a 0a 0a | 5c 62 65 67 69 6e 7b 64 |nder....|\begin{d|
|00001cd0| 65 66 70 72 69 6d 7d 7b | 63 6f 6e 65 7d 7b 24 72 |efprim}{|cone}{$r|
|00001ce0| 61 64 5f 7b 62 6f 74 74 | 6f 6d 7d 24 20 5c 65 76 |ad_{bott|om}$ \ev|
|00001cf0| 65 63 7b 62 6f 74 74 6f | 6d 7d 20 24 72 61 64 5f |ec{botto|m} $rad_|
|00001d00| 7b 74 6f 70 7d 24 20 5c | 65 76 65 63 7b 74 6f 70 |{top}$ \|evec{top|
|00001d10| 7d 7d 0a 09 43 72 65 61 | 74 65 73 20 61 20 28 74 |}}..Crea|tes a (t|
|00001d20| 72 75 6e 63 61 74 65 64 | 29 20 63 6f 6e 65 20 74 |runcated|) cone t|
|00001d30| 68 61 74 20 65 78 74 65 | 6e 64 73 20 66 72 6f 6d |hat exte|nds from|
|00001d40| 20 5c 65 76 65 63 7b 62 | 6f 74 74 6f 6d 7d 20 74 | \evec{b|ottom} t|
|00001d50| 6f 0a 09 5c 65 76 65 63 | 7b 74 6f 70 7d 2e 20 20 |o..\evec|{top}. |
|00001d60| 54 68 65 20 63 6f 6e 65 | 20 77 69 6c 6c 20 68 61 |The cone| will ha|
|00001d70| 76 65 20 61 20 72 61 64 | 69 75 73 20 6f 66 20 24 |ve a rad|ius of $|
|00001d80| 72 61 64 5f 7b 62 6f 74 | 74 6f 6d 7d 24 20 61 74 |rad_{bot|tom}$ at|
|00001d90| 0a 09 5c 65 76 65 63 7b | 62 6f 74 74 6f 6d 7d 20 |..\evec{|bottom} |
|00001da0| 61 6e 64 20 61 20 72 61 | 64 69 75 73 20 6f 66 20 |and a ra|dius of |
|00001db0| 24 72 61 64 5f 7b 74 6f | 70 7d 24 20 61 74 20 5c |$rad_{to|p}$ at \|
|00001dc0| 65 76 65 63 7b 74 6f 70 | 7d 2e 0a 09 43 6f 6e 65 |evec{top|}...Cone|
|00001dd0| 73 20 61 72 65 20 72 65 | 6e 64 65 72 65 64 20 7b |s are re|ndered {|
|00001de0| 5c 65 6d 20 77 69 74 68 | 6f 75 74 7d 20 65 6e 64 |\em with|out} end|
|00001df0| 63 61 70 73 2e 0a 5c 65 | 6e 64 7b 64 65 66 70 72 |caps..\e|nd{defpr|
|00001e00| 69 6d 7d 0a 43 6f 6e 65 | 20 69 6e 76 65 72 73 65 |im}.Cone| inverse|
|00001e10| 20 6d 61 70 70 69 6e 67 | 20 69 73 20 61 6e 61 6c | mapping| is anal|
|00001e20| 6f 67 6f 75 73 20 74 6f | 20 63 79 6c 69 6e 64 65 |ogous to| cylinde|
|00001e30| 72 20 6d 61 70 70 69 6e | 67 2e 0a 0a 5c 62 65 67 |r mappin|g...\beg|
|00001e40| 69 6e 7b 64 65 66 70 72 | 69 6d 7d 7b 64 69 73 63 |in{defpr|im}{disc|
|00001e50| 7d 7b 7b 5c 65 6d 20 72 | 61 64 69 75 73 7d 20 5c |}{{\em r|adius} \|
|00001e60| 65 76 65 63 7b 70 6f 73 | 7d 20 5c 65 76 65 63 7b |evec{pos|} \evec{|
|00001e70| 6e 6f 72 6d 61 6c 7d 7d | 0a 09 43 72 65 61 74 65 |normal}}|..Create|
|00001e80| 73 20 61 20 64 69 73 63 | 20 63 65 6e 74 65 72 65 |s a disc| centere|
|00001e90| 64 20 61 74 20 74 68 65 | 20 67 69 76 65 6e 20 70 |d at the| given p|
|00001ea0| 6f 73 69 74 69 6f 6e 20 | 61 6e 64 20 77 69 74 68 |osition |and with|
|00001eb0| 20 74 68 65 0a 09 69 6e | 64 69 63 61 74 65 64 20 | the..in|dicated |
|00001ec0| 73 75 72 66 61 63 65 20 | 6e 6f 72 6d 61 6c 2e 0a |surface |normal..|
|00001ed0| 5c 65 6e 64 7b 64 65 66 | 70 72 69 6d 7d 0a 44 69 |\end{def|prim}.Di|
|00001ee0| 73 63 73 20 61 72 65 20 | 75 73 65 66 75 6c 20 66 |scs are |useful f|
|00001ef0| 6f 72 20 70 6c 61 63 69 | 6e 67 0a 65 6e 64 63 61 |or placi|ng.endca|
|00001f00| 70 73 20 6f 6e 20 63 79 | 6c 69 6e 64 65 72 73 20 |ps on cy|linders |
|00001f10| 61 6e 64 20 63 6f 6e 65 | 73 2e 0a 49 6e 76 65 72 |and cone|s..Inver|
|00001f20| 73 65 20 6d 61 70 70 69 | 6e 67 20 66 6f 72 20 74 |se mappi|ng for t|
|00001f30| 68 65 20 64 69 73 63 20 | 69 73 20 62 61 73 65 64 |he disc |is based|
|00001f40| 20 6f 6e 20 74 68 65 20 | 63 6f 6d 70 75 74 61 74 | on the |computat|
|00001f50| 69 6f 6e 20 6f 66 20 74 | 68 65 0a 6e 6f 72 6d 61 |ion of t|he.norma|
|00001f60| 6c 69 7a 65 64 20 70 6f | 6c 61 72 20 63 6f 6f 72 |lized po|lar coor|
|00001f70| 64 69 6e 61 74 65 73 20 | 6f 66 20 74 68 65 20 70 |dinates |of the p|
|00001f80| 6f 69 6e 74 20 6f 66 20 | 69 6e 74 65 72 73 65 63 |oint of |intersec|
|00001f90| 74 69 6f 6e 2e 20 20 54 | 68 65 0a 6e 6f 72 6d 61 |tion. T|he.norma|
|00001fa0| 6c 69 7a 65 64 20 72 61 | 64 69 75 73 0a 6f 66 20 |lized ra|dius.of |
|00001fb0| 74 68 65 20 70 6f 69 6e | 74 20 6f 66 20 69 6e 74 |the poin|t of int|
|00001fc0| 65 72 73 65 63 74 69 6f | 6e 20 69 73 20 61 73 73 |ersectio|n is ass|
|00001fd0| 69 67 6e 65 64 20 74 6f | 20 24 75 24 2c 20 77 68 |igned to| $u$, wh|
|00001fe0| 69 6c 65 20 74 68 65 20 | 6e 6f 72 6d 61 6c 69 7a |ile the |normaliz|
|00001ff0| 65 64 20 61 6e 67 6c 65 | 0a 66 72 6f 6d 20 61 20 |ed angle|.from a |
|00002000| 72 65 66 65 72 65 6e 63 | 65 20 76 65 63 74 6f 72 |referenc|e vector|
|00002010| 20 69 73 20 61 73 73 69 | 67 6e 65 64 20 74 6f 20 | is assi|gned to |
|00002020| 24 76 24 2e 0a 0a 5c 73 | 65 63 74 69 6f 6e 7b 50 |$v$...\s|ection{P|
|00002030| 72 69 6d 69 74 69 76 65 | 73 20 61 64 64 65 64 20 |rimitive|s added |
|00002040| 69 6e 20 34 2e 30 2e 36 | 2e 33 7d 0a 0a 5c 62 65 |in 4.0.6|.3}..\be|
|00002050| 67 69 6e 7b 64 65 66 70 | 72 69 6d 7d 7b 63 62 6c |gin{defp|rim}{cbl|
|00002060| 6f 62 7d 7b 7b 5c 65 6d | 20 74 68 72 65 73 68 20 |ob}{{\em| thresh |
|00002070| 73 74 20 72 7d 20 5c 65 | 76 65 63 7b 70 7d 20 7b |st r} \e|vec{p} {|
|00002080| 5c 65 6d 20 73 75 74 66 | 61 63 65 7d 20 5b 7b 5c |\em sutf|ace} [{\|
|00002090| 65 6d 20 73 74 20 72 7d | 0a 5c 65 76 65 63 7b 70 |em st r}|.\evec{p|
|000020a0| 7d 20 7b 5c 65 6d 20 73 | 75 72 66 61 63 65 7d 20 |} {\em s|urface} |
|000020b0| 5c 6c 64 6f 74 73 5d 7d | 0a 09 43 72 65 61 74 65 |\ldots]}|..Create|
|000020c0| 73 20 61 20 6d 75 6c 74 | 69 63 6f 6c 6f 72 65 64 |s a mult|icolored|
|000020d0| 20 62 6c 6f 62 2e 20 20 | 54 68 65 20 73 79 6e 74 | blob. |The synt|
|000020e0| 61 78 20 69 73 20 74 68 | 65 20 73 61 6d 65 20 61 |ax is th|e same a|
|000020f0| 73 20 66 6f 72 20 61 20 | 62 6c 6f 62 2c 0a 77 69 |s for a |blob,.wi|
|00002100| 74 68 20 61 6e 20 61 64 | 64 69 74 69 6f 6e 61 6c |th an ad|ditional|
|00002110| 20 73 75 72 66 61 63 65 | 20 64 65 66 69 6e 69 74 | surface| definit|
|00002120| 69 6f 6e 20 66 6f 72 20 | 65 61 63 68 20 6d 65 74 |ion for |each met|
|00002130| 61 62 61 6c 6c 2e 0a 5c | 65 6e 64 7b 64 65 66 70 |aball..\|end{defp|
|00002140| 72 69 6d 7d 0a 0a 54 68 | 65 20 7b 5c 74 74 20 63 |rim}..Th|e {\tt c|
|00002150| 62 6c 6f 62 7d 20 70 72 | 69 6d 69 74 69 76 65 20 |blob} pr|imitive |
|00002160| 77 61 73 20 70 72 6f 76 | 69 64 65 64 20 62 79 20 |was prov|ided by |
|00002170| 47 65 6f 72 67 65 20 4d | 63 47 72 65 67 6f 72 20 |George M|cGregor |
|00002180| 5c 5c 0a 7b 5c 74 74 20 | 3c 6d 63 67 72 65 67 6f |\\.{\tt |<mcgrego|
|00002190| 72 40 6e 63 69 66 63 72 | 66 2e 67 6f 76 3e 7d 0a |r@ncifcr|f.gov>}.|
|000021a0| 0a 5c 62 65 67 69 6e 7b | 64 65 66 70 72 69 6d 7d |.\begin{|defprim}|
|000021b0| 7b 66 6c 61 6d 65 7d 7b | 7b 5c 65 6d 20 73 69 7a |{flame}{|{\em siz|
|000021c0| 65 7d 20 5c 65 76 65 63 | 7b 70 7d 20 7b 5c 65 6d |e} \evec|{p} {\em|
|000021d0| 20 6c 69 67 68 74 73 77 | 69 74 63 68 20 73 70 65 | lightsw|itch spe|
|000021e0| 65 64 7d 7d 0a 09 43 72 | 65 61 74 65 73 20 61 20 |ed}}..Cr|eates a |
|000021f0| 66 6c 61 6d 65 20 61 74 | 20 74 68 65 20 67 69 76 |flame at| the giv|
|00002200| 65 6e 20 70 6f 73 69 74 | 69 6f 6e 20 6f 66 20 74 |en posit|ion of t|
|00002210| 68 65 20 67 69 76 65 6e | 20 73 69 7a 65 2e 20 20 |he given| size. |
|00002220| 54 68 65 20 7b 5c 65 6d | 0a 6c 69 67 68 74 73 77 |The {\em|.lightsw|
|00002230| 69 74 63 68 7d 20 6f 70 | 74 69 6f 6e 20 61 6c 6c |itch} op|tion all|
|00002240| 6f 77 73 20 6c 69 67 68 | 74 20 73 6f 75 72 63 65 |ows ligh|t source|
|00002250| 73 20 74 6f 20 61 75 74 | 6f 6d 61 74 69 63 61 6c |s to aut|omatical|
|00002260| 6c 79 20 62 65 20 70 6c | 61 63 65 64 20 69 6e 73 |ly be pl|aced ins|
|00002270| 69 64 65 20 74 68 65 0a | 66 6c 61 6d 65 20 28 31 |ide the.|flame (1|
|00002280| 29 20 6f 72 20 6e 6f 20 | 6c 69 67 68 74 73 20 66 |) or no |lights f|
|00002290| 6f 72 20 66 61 73 74 65 | 72 20 72 75 6e 73 20 28 |or faste|r runs (|
|000022a0| 30 29 2e 20 20 54 68 65 | 20 7b 5c 65 6d 20 73 70 |0). The| {\em sp|
|000022b0| 65 65 64 7d 20 73 65 74 | 74 69 6e 67 20 69 73 20 |eed} set|ting is |
|000022c0| 75 73 65 64 0a 66 6f 72 | 20 61 6e 69 6d 61 74 69 |used.for| animati|
|000022d0| 6f 6e 20 61 6e 64 20 63 | 6f 6e 74 72 6f 6c 6c 73 |on and c|ontrolls|
|000022e0| 20 68 6f 77 20 66 61 73 | 74 20 74 68 65 20 66 6c | how fas|t the fl|
|000022f0| 61 6d 65 20 61 70 70 65 | 61 72 73 20 74 6f 20 60 |ame appe|ars to `|
|00002300| 60 6d 6f 76 65 27 27 20 | 75 70 77 61 72 64 2e 20 |`move'' |upward. |
|00002310| 20 41 0a 76 61 6c 75 65 | 20 6f 66 20 30 2e 35 20 | A.value| of 0.5 |
|00002320| 69 73 20 73 75 67 67 65 | 73 74 65 64 20 61 73 20 |is sugge|sted as |
|00002330| 61 20 73 74 61 72 74 69 | 6e 67 20 70 6f 69 6e 74 |a starti|ng point|
|00002340| 2e 0a 5c 65 6e 64 7b 64 | 65 66 70 72 69 6d 7d 0a |..\end{d|efprim}.|
|00002350| 0a 54 68 65 20 7b 5c 74 | 74 20 66 6c 61 6d 65 7d |.The {\t|t flame}|
|00002360| 20 70 72 69 6d 69 74 69 | 76 65 20 77 61 73 20 70 | primiti|ve was p|
|00002370| 72 6f 76 69 64 65 64 20 | 62 79 20 52 65 74 6f 20 |rovided |by Reto |
|00002380| 4d 61 6e 69 0a 7b 5c 74 | 74 20 3c 6d 61 6e 69 40 |Mani.{\t|t <mani@|
|00002390| 69 61 6d 2e 75 6e 69 62 | 65 2e 63 68 3e 7d 0a 0a |iam.unib|e.ch>}..|
|000023a0| 5c 62 65 67 69 6e 7b 64 | 65 66 70 72 69 6d 7d 7b |\begin{d|efprim}{|
|000023b0| 66 72 61 63 6c 61 6e 64 | 7d 7b 7b 5c 65 6d 20 73 |fracland|}{{\em s|
|000023c0| 65 65 64 20 73 75 62 64 | 69 76 7d 7d 0a 09 54 68 |eed subd|iv}}..Th|
|000023d0| 69 73 20 70 72 69 6d 69 | 74 69 76 65 20 63 72 65 |is primi|tive cre|
|000023e0| 61 74 65 73 20 61 20 66 | 72 61 63 74 61 6c 20 73 |ates a f|ractal s|
|000023f0| 75 72 66 61 63 65 20 63 | 65 6e 74 65 72 65 64 20 |urface c|entered |
|00002400| 61 74 20 0a 09 09 24 78 | 20 3d 20 30 2e 35 24 2c |at ...$x| = 0.5$,|
|00002410| 20 24 79 20 3d 20 30 2e | 35 24 20 61 6e 64 20 72 | $y = 0.|5$ and r|
|00002420| 61 6e 67 69 6e 67 20 66 | 72 6f 6d 0a 09 09 24 78 |anging f|rom...$x|
|00002430| 20 3d 20 30 2e 30 24 2c | 20 24 79 20 3d 20 30 2e | = 0.0$,| $y = 0.|
|00002440| 30 24 20 74 6f 20 24 78 | 20 3d 20 31 2e 30 24 2c |0$ to $x| = 1.0$,|
|00002450| 20 24 79 20 3d 20 31 2e | 30 24 2e 0a 49 74 20 69 | $y = 1.|0$..It i|
|00002460| 73 20 61 63 74 75 61 6c | 6c 79 20 61 20 68 65 69 |s actual|ly a hei|
|00002470| 67 68 74 66 69 65 6c 64 | 20 70 72 69 6d 69 74 69 |ghtfield| primiti|
|00002480| 76 65 20 74 68 61 74 20 | 69 73 20 67 65 6e 65 72 |ve that |is gener|
|00002490| 61 74 65 64 20 77 69 74 | 68 69 6e 20 72 61 79 73 |ated wit|hin rays|
|000024a0| 68 61 64 65 0a 72 61 74 | 68 65 72 20 74 68 61 6e |hade.rat|her than|
|000024b0| 20 62 65 69 6e 67 20 72 | 65 61 64 20 69 6e 20 66 | being r|ead in f|
|000024c0| 72 6f 6d 20 61 20 66 69 | 6c 65 2e 0a 5c 65 6e 64 |rom a fi|le..\end|
|000024d0| 7b 64 65 66 70 72 69 6d | 7d 0a 0a 20 20 20 20 20 |{defprim|}.. |
|000024e0| 20 20 20 54 68 65 20 7b | 5c 65 6d 20 73 65 65 64 | The {|\em seed|
|000024f0| 7d 20 76 61 6c 75 65 20 | 69 73 20 74 68 65 20 73 |} value |is the s|
|00002500| 65 65 64 20 66 6f 72 20 | 74 68 65 20 72 61 6e 64 |eed for |the rand|
|00002510| 6f 6d 20 6e 75 6d 62 65 | 72 20 66 75 6e 63 74 69 |om numbe|r functi|
|00002520| 6f 6e 2e 20 20 54 68 65 | 0a 73 65 65 64 20 76 61 |on. The|.seed va|
|00002530| 6c 75 65 20 73 70 65 63 | 69 66 69 65 73 20 74 68 |lue spec|ifies th|
|00002540| 65 20 73 68 61 70 65 20 | 6f 66 20 74 68 65 20 73 |e shape |of the s|
|00002550| 75 72 66 61 63 65 20 2d | 2d 20 63 68 61 6e 67 69 |urface -|- changi|
|00002560| 6e 67 20 74 68 65 20 73 | 65 65 64 20 76 61 6c 75 |ng the s|eed valu|
|00002570| 65 20 77 69 6c 6c 0a 72 | 61 6e 64 6f 6d 6c 79 20 |e will.r|andomly |
|00002580| 63 68 61 6e 67 65 20 74 | 68 65 20 73 75 72 66 61 |change t|he surfa|
|00002590| 63 65 20 73 68 61 70 65 | 2e 0a 0a 20 20 20 20 20 |ce shape|... |
|000025a0| 20 20 20 54 68 65 20 7b | 5c 65 6d 20 73 75 62 64 | The {|\em subd|
|000025b0| 69 76 7d 20 76 61 6c 75 | 65 20 69 73 20 74 68 65 |iv} valu|e is the|
|000025c0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 73 75 62 64 69 | number |of subdi|
|000025d0| 76 69 73 69 6f 6e 73 20 | 66 6f 72 20 74 68 65 20 |visions |for the |
|000025e0| 73 75 72 66 61 63 65 0a | 2d 2d 20 24 7b 5c 65 6d |surface.|-- ${\em|
|000025f0| 20 73 75 62 64 69 76 7d | 20 3d 20 30 24 20 77 69 | subdiv}| = 0$ wi|
|00002600| 6c 6c 20 70 72 6f 64 75 | 63 65 20 61 20 66 6c 61 |ll produ|ce a fla|
|00002610| 74 20 73 71 75 61 72 65 | 2c 20 24 73 75 62 64 69 |t square|, $subdi|
|00002620| 76 20 3e 20 30 24 20 77 | 69 6c 6c 20 70 72 6f 64 |v > 0$ w|ill prod|
|00002630| 75 63 65 20 61 0a 73 71 | 75 61 72 65 20 77 69 74 |uce a.sq|uare wit|
|00002640| 68 20 61 6e 20 65 76 65 | 72 20 6d 6f 72 65 20 64 |h an eve|r more d|
|00002650| 65 74 61 69 6c 65 64 20 | 73 75 72 66 61 63 65 2e |etailed |surface.|
|00002660| 20 20 53 6f 20 66 61 72 | 2c 20 72 61 79 73 68 61 | So far|, raysha|
|00002670| 64 65 20 73 65 65 6d 73 | 20 74 6f 20 68 61 76 65 |de seems| to have|
|00002680| 0a 74 72 6f 75 62 6c 65 | 20 77 69 74 68 20 73 75 |.trouble| with su|
|00002690| 62 64 69 76 69 73 69 6f | 6e 73 20 67 72 65 61 74 |bdivisio|ns great|
|000026a0| 65 72 20 74 68 61 6e 20 | 65 69 67 68 74 20 28 69 |er than |eight (i|
|000026b0| 66 20 61 6e 79 6f 6e 65 | 20 66 69 6e 64 73 20 6f |f anyone| finds o|
|000026c0| 74 68 65 72 77 69 73 65 | 20 70 6c 65 61 73 65 0a |therwise| please.|
|000026d0| 74 65 6c 6c 20 6d 65 21 | 21 29 20 61 6e 64 20 70 |tell me!|!) and p|
|000026e0| 72 6f 64 75 63 65 73 20 | 73 75 72 66 61 63 65 73 |roduces |surfaces|
|000026f0| 20 77 69 74 68 20 22 68 | 6f 6c 65 73 22 20 69 6e | with "h|oles" in|
|00002700| 20 69 74 20 66 6f 72 20 | 76 61 6c 75 65 73 20 67 | it for |values g|
|00002710| 72 65 61 74 65 72 20 74 | 68 61 6e 0a 74 68 69 73 |reater t|han.this|
|00002720| 2e 20 0a 0a 20 20 20 20 | 20 20 20 20 54 68 65 20 |. .. | The |
|00002730| 6e 75 6d 62 65 72 20 6f | 66 20 70 6f 69 6e 74 73 |number o|f points|
|00002740| 20 69 6e 20 74 68 65 20 | 73 75 72 66 61 63 65 20 | in the |surface |
|00002750| 66 6f 6c 6c 6f 77 73 20 | 74 68 65 20 66 6f 6c 6c |follows |the foll|
|00002760| 6f 77 69 6e 67 20 66 6f | 72 6d 75 6c 61 73 2c 0a |owing fo|rmulas,.|
|00002770| 77 68 65 72 65 20 7b 5c | 65 6d 20 53 69 7a 65 7d |where {\|em Size}|
|00002780| 20 69 73 20 74 68 65 20 | 74 6f 74 61 6c 20 70 6f | is the |total po|
|00002790| 69 6e 74 73 20 70 65 72 | 20 73 69 64 65 20 6f 66 |ints per| side of|
|000027a0| 20 74 68 65 20 6f 62 6a | 65 63 74 3a 0a 09 09 5c | the obj|ect:...\|
|000027b0| 5b 20 53 69 7a 65 20 3d | 20 28 32 5e 73 75 62 64 |[ Size =| (2^subd|
|000027c0| 69 76 29 20 2b 20 31 20 | 5c 5d 0a 09 09 5c 5b 20 |iv) + 1 |\]...\[ |
|000027d0| 54 6f 74 61 6c 50 6f 69 | 6e 74 73 20 3d 20 53 69 |TotalPoi|nts = Si|
|000027e0| 7a 65 5e 32 20 5c 5d 0a | 0a 20 20 20 20 20 20 20 |ze^2 \].|. |
|000027f0| 20 54 68 65 20 66 6f 75 | 72 20 63 6f 72 6e 65 72 | The fou|r corner|
|00002800| 20 70 6f 69 6e 74 73 20 | 77 69 6c 6c 20 61 6c 77 | points |will alw|
|00002810| 61 79 73 20 68 61 76 65 | 20 61 6e 20 61 6c 74 69 |ays have| an alti|
|00002820| 74 75 64 65 20 6f 66 20 | 7a 65 72 6f 2c 20 74 68 |tude of |zero, th|
|00002830| 65 0a 6d 61 78 69 6d 75 | 6d 20 61 6c 74 69 74 75 |e.maximu|m altitu|
|00002840| 64 65 20 73 68 6f 75 6c | 64 20 6e 65 76 65 72 20 |de shoul|d never |
|00002850| 62 65 20 6e 65 76 65 72 | 20 62 65 20 6d 6f 72 65 |be never| be more|
|00002860| 20 31 2e 30 20 61 6e 64 | 20 74 68 65 20 6d 69 6e | 1.0 and| the min|
|00002870| 20 73 68 6f 75 6c 64 20 | 6e 65 76 65 72 20 62 65 | should |never be|
|00002880| 0a 6c 65 73 73 20 74 68 | 61 6e 20 2d 31 2e 30 2e |.less th|an -1.0.|
|00002890| 0a 0a 54 68 65 20 7b 5c | 74 74 20 66 72 61 63 6c |..The {\|tt fracl|
|000028a0| 61 6e 64 7d 20 70 72 69 | 6d 69 74 69 76 65 20 77 |and} pri|mitive w|
|000028b0| 61 73 20 70 72 6f 76 69 | 64 65 64 20 62 79 20 4c |as provi|ded by L|
|000028c0| 61 72 72 79 20 43 6f 66 | 66 69 6e 20 5c 5c 0a 7b |arry Cof|fin \\.{|
|000028d0| 5c 74 74 20 3c 6c 63 6f | 66 66 69 6e 40 63 6c 63 |\tt <lco|ffin@clc|
|000028e0| 69 72 69 73 2e 63 68 65 | 6d 2e 75 6d 72 2e 65 64 |iris.che|m.umr.ed|
|000028f0| 75 3e 7d 0a 0a 5c 62 65 | 67 69 6e 7b 64 65 66 70 |u>}..\be|gin{defp|
|00002900| 72 69 6d 7d 7b 72 6f 74 | 73 70 6c 69 6e 65 7d 7b |rim}{rot|spline}{|
|00002910| 5c 65 76 65 63 7b 62 61 | 73 65 7d 20 5c 65 76 65 |\evec{ba|se} \eve|
|00002920| 63 7b 61 70 65 78 7d 20 | 7b 5c 74 74 20 63 6f 65 |c{apex} |{\tt coe|
|00002930| 66 66 73 7d 20 24 63 5f | 33 24 20 24 63 5f 32 24 |ffs} $c_|3$ $c_2$|
|00002940| 0a 24 63 5f 31 24 20 24 | 63 5f 30 24 7d 0a 43 72 |.$c_1$ $|c_0$}.Cr|
|00002950| 65 61 74 65 73 20 61 20 | 73 6f 6c 69 64 20 6f 66 |eates a |solid of|
|00002960| 20 72 65 76 6f 6c 75 74 | 69 6f 6e 2e 20 20 54 68 | revolut|ion. Th|
|00002970| 69 73 20 70 72 69 6d 69 | 74 69 76 65 20 63 61 6e |is primi|tive can|
|00002980| 20 62 65 20 64 65 66 69 | 6e 65 64 20 69 6e 20 74 | be defi|ned in t|
|00002990| 77 6f 20 77 61 79 73 2e | 0a 5c 65 6e 64 7b 64 65 |wo ways.|.\end{de|
|000029a0| 66 70 72 69 6d 7d 0a 0a | 5c 62 65 67 69 6e 7b 64 |fprim}..|\begin{d|
|000029b0| 65 66 70 72 69 6d 7d 7b | 72 6f 74 73 70 6c 69 6e |efprim}{|rotsplin|
|000029c0| 65 7d 7b 5c 65 76 65 63 | 7b 62 61 73 65 7d 20 24 |e}{\evec|{base} $|
|000029d0| 72 5f 7b 62 61 73 65 7d | 24 20 24 67 5f 7b 62 61 |r_{base}|$ $g_{ba|
|000029e0| 73 65 7d 24 0a 20 20 20 | 20 20 20 20 20 20 20 20 |se}$. | |
|000029f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002a00| 5c 65 76 65 63 7b 61 70 | 65 78 7d 20 24 72 5f 7b |\evec{ap|ex} $r_{|
|00002a10| 61 70 65 78 7d 24 20 24 | 67 5f 7b 61 70 65 78 7d |apex}$ $|g_{apex}|
|00002a20| 24 7d 0a 5c 65 6e 64 7b | 64 65 66 70 72 69 6d 7d |$}.\end{|defprim}|
|00002a30| 0a 0a 54 68 65 20 63 75 | 72 76 65 20 74 68 61 74 |..The cu|rve that|
|00002a40| 20 69 73 20 72 6f 74 61 | 74 65 64 20 69 73 20 6f | is rota|ted is o|
|00002a50| 66 20 74 68 65 20 66 6f | 72 6d 0a 5c 5b 0a 09 20 |f the fo|rm.\[.. |
|00002a60| 20 20 20 72 5e 32 20 3d | 20 63 5f 33 78 5e 33 20 | r^2 =| c_3x^3 |
|00002a70| 2b 20 63 5f 32 78 5e 32 | 20 2b 20 63 5f 31 78 20 |+ c_2x^2| + c_1x |
|00002a80| 2b 20 63 5f 30 0a 5c 5d | 0a 0a 5c 65 76 65 63 7b |+ c_0.\]|..\evec{|
|00002a90| 62 61 73 65 7d 20 69 73 | 20 74 68 65 20 70 6f 73 |base} is| the pos|
|00002aa0| 69 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 63 65 6e |ition of| the cen|
|00002ab0| 74 65 72 20 6f 66 20 6f | 6e 65 20 65 6e 64 20 61 |ter of o|ne end a|
|00002ac0| 6e 64 20 5c 65 76 65 63 | 7b 61 70 65 78 7d 20 69 |nd \evec|{apex} i|
|00002ad0| 73 20 74 68 65 0a 63 65 | 6e 74 65 72 20 6f 66 20 |s the.ce|nter of |
|00002ae0| 74 68 65 20 6f 74 68 65 | 72 2e 20 20 54 68 65 20 |the othe|r. The |
|00002af0| 77 6f 72 64 20 7b 5c 74 | 74 20 63 6f 65 66 66 73 |word {\t|t coeffs|
|00002b00| 7d 20 6d 75 73 74 20 62 | 65 20 69 6e 63 6c 75 64 |} must b|e includ|
|00002b10| 65 64 20 69 6e 20 74 68 | 65 20 66 69 72 73 74 0a |ed in th|e first.|
|00002b20| 6d 65 74 68 6f 64 2e 20 | 20 24 72 5f 7b 62 61 73 |method. | $r_{bas|
|00002b30| 65 7d 24 20 61 6e 64 20 | 24 72 5f 7b 61 70 65 78 |e}$ and |$r_{apex|
|00002b40| 7d 24 20 61 72 65 20 74 | 68 65 20 72 61 64 69 69 |}$ are t|he radii|
|00002b50| 20 6f 66 20 74 68 65 20 | 62 61 73 65 20 61 6e 64 | of the |base and|
|00002b60| 20 61 70 65 78 2c 20 61 | 6e 64 0a 24 67 5f 7b 62 | apex, a|nd.$g_{b|
|00002b70| 61 73 65 7d 24 20 61 6e | 64 20 24 67 5f 7b 61 70 |ase}$ an|d $g_{ap|
|00002b80| 65 78 7d 24 20 61 72 65 | 20 74 68 65 20 67 72 61 |ex}$ are| the gra|
|00002b90| 64 69 65 6e 74 73 2e 0a | 0a 54 68 65 20 7b 5c 74 |dients..|.The {\t|
|00002ba0| 74 20 72 6f 74 73 70 6c | 69 6e 65 7d 20 70 72 69 |t rotspl|ine} pri|
|00002bb0| 6d 69 74 69 76 65 20 77 | 61 73 20 70 72 6f 76 69 |mitive w|as provi|
|00002bc0| 64 65 64 20 62 79 20 47 | 65 72 61 6c 64 20 49 6c |ded by G|erald Il|
|00002bd0| 65 73 20 5c 5c 0a 7b 5c | 74 74 20 3c 69 6c 65 73 |es \\.{\|tt <iles|
|00002be0| 67 40 70 34 2e 63 73 2e | 6d 61 6e 2e 61 63 2e 75 |g@p4.cs.|man.ac.u|
|00002bf0| 6b 3e 7d 0a 0a 5c 62 65 | 67 69 6e 7b 64 65 66 70 |k>}..\be|gin{defp|
|00002c00| 72 69 6d 7d 7b 73 77 65 | 70 74 73 70 68 7d 7b 7b |rim}{swe|ptsph}{{|
|00002c10| 5c 74 74 20 62 65 7a 69 | 65 72 7d 20 5c 65 76 65 |\tt bezi|er} \eve|
|00002c20| 63 7b 70 5f 30 7d 20 5c | 65 76 65 63 7b 70 5f 31 |c{p_0} \|evec{p_1|
|00002c30| 7d 20 5c 65 76 65 63 7b | 70 5f 32 7d 0a 20 20 20 |} \evec{|p_2}. |
|00002c40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002c50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002c60| 20 20 20 20 5c 65 76 65 | 63 7b 70 5f 33 7d 20 24 | \eve|c{p_3} $|
|00002c70| 72 5f 30 24 20 24 72 5f | 31 24 20 24 72 5f 32 24 |r_0$ $r_|1$ $r_2$|
|00002c80| 20 24 72 5f 33 24 7d 0a | 20 20 20 20 20 20 20 20 | $r_3$}.| |
|00002c90| 54 68 69 73 20 70 72 69 | 6d 69 74 69 76 65 20 69 |This pri|mitive i|
|00002ca0| 73 20 64 65 66 69 6e 65 | 64 20 61 73 20 61 20 73 |s define|d as a s|
|00002cb0| 70 68 65 72 65 20 6f 66 | 20 76 61 72 79 69 6e 67 |phere of| varying|
|00002cc0| 20 72 61 64 69 75 73 20 | 73 77 65 70 74 2c 20 6f | radius |swept, o|
|00002cd0| 72 0a 65 78 74 72 75 64 | 65 64 20 61 6c 6f 6e 67 |r.extrud|ed along|
|00002ce0| 20 61 20 70 61 74 68 20 | 69 6e 20 73 70 61 63 65 | a path |in space|
|00002cf0| 2e 20 20 54 68 65 20 70 | 61 74 68 20 69 73 20 64 |. The p|ath is d|
|00002d00| 65 66 69 6e 65 64 20 69 | 6e 20 6f 6e 65 20 6f 66 |efined i|n one of|
|00002d10| 20 73 65 76 65 72 61 6c | 20 77 61 79 73 2e 0a 54 | several| ways..T|
|00002d20| 68 65 20 70 61 74 68 20 | 63 61 6e 20 65 69 74 68 |he path |can eith|
|00002d30| 65 72 20 62 65 20 64 65 | 66 69 6e 65 64 20 61 73 |er be de|fined as|
|00002d40| 20 66 6f 75 72 20 70 6f | 69 6e 74 73 20 77 68 69 | four po|ints whi|
|00002d50| 63 68 20 64 65 66 69 6e | 65 20 61 20 62 65 7a 69 |ch defin|e a bezi|
|00002d60| 65 72 20 70 61 74 68 2c | 20 77 68 65 72 65 0a 74 |er path,| where.t|
|00002d70| 68 65 20 70 61 74 68 20 | 70 61 73 73 65 73 20 74 |he path |passes t|
|00002d80| 68 72 6f 75 67 68 20 74 | 68 65 20 66 69 72 73 74 |hrough t|he first|
|00002d90| 20 61 6e 64 20 6c 61 73 | 74 20 65 6e 64 70 6f 69 | and las|t endpoi|
|00002da0| 6e 74 73 20 77 69 74 68 | 20 74 68 65 20 73 65 63 |nts with| the sec|
|00002db0| 6f 6e 64 20 61 6e 64 20 | 74 68 69 72 64 0a 70 6f |ond and |third.po|
|00002dc0| 69 6e 74 73 20 64 65 66 | 69 6e 69 6e 67 20 74 68 |ints def|ining th|
|00002dd0| 65 20 73 6c 6f 70 65 20 | 6f 72 20 74 61 6e 67 65 |e slope |or tange|
|00002de0| 6e 74 20 6c 69 6e 65 20 | 66 6f 72 20 74 68 65 20 |nt line |for the |
|00002df0| 63 75 72 76 65 20 61 74 | 20 74 68 65 20 66 69 72 |curve at| the fir|
|00002e00| 73 74 20 61 6e 64 20 6c | 61 73 74 0a 70 6f 69 6e |st and l|ast.poin|
|00002e10| 74 73 2e 0a 5c 65 6e 64 | 7b 64 65 66 70 72 69 6d |ts..\end|{defprim|
|00002e20| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 64 65 66 70 72 69 |}..\begi|n{defpri|
|00002e30| 6d 7d 7b 73 77 65 70 74 | 73 70 68 7d 7b 7b 5c 74 |m}{swept|sph}{{\t|
|00002e40| 74 20 63 6f 65 66 66 73 | 7d 20 24 78 5f 30 24 20 |t coeffs|} $x_0$ |
|00002e50| 24 78 5f 31 24 20 24 78 | 5f 32 24 20 24 78 5f 33 |$x_1$ $x|_2$ $x_3|
|00002e60| 24 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |$ . | |
|00002e70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002e80| 20 20 20 20 20 20 20 20 | 20 20 24 79 5f 30 24 20 | | $y_0$ |
|00002e90| 24 79 5f 31 24 20 24 79 | 5f 32 24 20 24 79 5f 33 |$y_1$ $y|_2$ $y_3|
|00002ea0| 24 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |$ . | |
|00002eb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002ec0| 20 20 20 20 20 20 20 20 | 20 20 24 7a 5f 30 24 20 | | $z_0$ |
|00002ed0| 24 7a 5f 31 24 20 24 7a | 5f 32 24 20 24 7a 5f 33 |$z_1$ $z|_2$ $z_3|
|00002ee0| 24 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |$ . | |
|00002ef0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002f00| 20 20 20 20 20 20 20 20 | 20 20 24 72 5f 30 24 20 | | $r_0$ |
|00002f10| 24 72 5f 31 24 20 24 72 | 5f 32 24 20 24 72 5f 33 |$r_1$ $r|_2$ $r_3|
|00002f20| 24 7d 0a 20 20 20 20 20 | 20 20 20 41 20 73 65 63 |$}. | A sec|
|00002f30| 6f 6e 64 20 77 61 79 20 | 74 6f 20 64 65 66 69 6e |ond way |to defin|
|00002f40| 65 20 74 68 65 20 63 75 | 72 76 65 20 69 73 20 74 |e the cu|rve is t|
|00002f50| 6f 20 73 70 65 63 69 66 | 79 20 74 68 65 20 63 6f |o specif|y the co|
|00002f60| 65 66 66 65 63 69 65 6e | 74 73 20 66 6f 72 0a 74 |effecien|ts for.t|
|00002f70| 68 65 20 70 61 72 61 6d | 65 74 72 69 63 20 65 71 |he param|etric eq|
|00002f80| 75 61 74 69 6f 6e 73 20 | 74 68 61 74 20 64 65 66 |uations |that def|
|00002f90| 69 6e 65 20 74 68 65 20 | 63 75 72 76 65 2e 20 54 |ine the |curve. T|
|00002fa0| 68 69 73 20 69 73 20 73 | 70 65 63 69 66 69 65 64 |his is s|pecified|
|00002fb0| 20 61 73 20 0a 60 60 7b | 5c 74 74 20 63 6f 65 66 | as .``{|\tt coef|
|00002fc0| 66 73 7d 20 24 66 5f 78 | 24 20 24 66 5f 79 24 20 |fs} $f_x|$ $f_y$ |
|00002fd0| 24 66 5f 7a 24 27 27 20 | 77 68 65 72 65 20 65 61 |$f_z$'' |where ea|
|00002fe0| 63 68 20 24 66 5f 6e 24 | 20 69 73 20 61 20 74 68 |ch $f_n$| is a th|
|00002ff0| 69 72 64 20 6f 72 64 65 | 72 20 65 71 75 61 74 69 |ird orde|r equati|
|00003000| 6f 6e 2c 0a 24 63 5f 30 | 24 20 24 63 5f 31 24 20 |on,.$c_0|$ $c_1$ |
|00003010| 24 63 5f 32 24 20 24 63 | 5f 33 24 2c 20 77 68 65 |$c_2$ $c|_3$, whe|
|00003020| 72 65 0a 5c 5b 20 66 5f | 6e 20 3d 20 63 5f 30 20 |re.\[ f_|n = c_0 |
|00003030| 2b 20 63 5f 31 78 20 2b | 20 63 5f 32 78 5e 32 20 |+ c_1x +| c_2x^2 |
|00003040| 2b 20 63 5f 33 78 5e 33 | 20 5c 5d 0a 5c 65 6e 64 |+ c_3x^3| \].\end|
|00003050| 7b 64 65 66 70 72 69 6d | 7d 0a 0a 5c 62 65 67 69 |{defprim|}..\begi|
|00003060| 6e 7b 64 65 66 70 72 69 | 6d 7d 7b 73 77 65 70 74 |n{defpri|m}{swept|
|00003070| 73 70 68 7d 7b 5b 7b 5c | 74 74 20 6e 62 65 7a 69 |sph}{[{\|tt nbezi|
|00003080| 65 72 7d 20 24 6e 5f 30 | 24 20 24 6e 5f 31 24 20 |er} $n_0|$ $n_1$ |
|00003090| 24 6e 5f 32 24 20 24 6e | 5f 33 24 5d 0a 20 20 20 |$n_2$ $n|_3$]. |
|000030a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000030b0| 20 20 20 20 20 20 20 5b | 7b 5c 74 74 20 6e 63 6f | [|{\tt nco|
|000030c0| 65 66 66 73 7d 20 24 63 | 6e 5f 30 24 20 24 63 6e |effs} $c|n_0$ $cn|
|000030d0| 5f 31 24 20 24 63 6e 5f | 32 24 20 24 63 6e 5f 33 |_1$ $cn_|2$ $cn_3|
|000030e0| 24 5d 7d 0a 20 20 20 20 | 20 20 20 20 41 20 74 68 |$]}. | A th|
|000030f0| 69 72 64 20 77 61 79 20 | 69 73 20 74 6f 20 75 73 |ird way |is to us|
|00003100| 65 20 61 6e 79 20 63 6f | 6d 62 69 6e 61 74 69 6f |e any co|mbinatio|
|00003110| 6e 20 6f 66 20 70 61 72 | 61 6d 65 74 72 69 63 20 |n of par|ametric |
|00003120| 62 65 7a 69 65 72 20 63 | 75 72 76 65 73 0a 6f 72 |bezier c|urves.or|
|00003130| 20 66 75 6e 63 74 69 6f | 6e 20 63 6f 65 66 66 73 | functio|n coeffs|
|00003140| 2e 20 20 54 68 65 73 65 | 20 61 72 65 20 73 70 65 |. These| are spe|
|00003150| 63 69 66 69 65 64 20 61 | 73 20 7b 5c 74 74 20 6e |cified a|s {\tt n|
|00003160| 62 65 7a 69 65 72 7d 20 | 6f 72 20 7b 5c 74 74 20 |bezier} |or {\tt |
|00003170| 6e 63 6f 65 66 66 73 7d | 0a 77 68 65 72 65 20 24 |ncoeffs}|.where $|
|00003180| 6e 24 20 69 73 20 24 78 | 24 2c 20 24 79 24 2c 20 |n$ is $x|$, $y$, |
|00003190| 6f 72 20 24 7a 24 2e 20 | 20 54 68 65 73 65 20 61 |or $z$. | These a|
|000031a0| 72 65 20 66 6f 6c 6c 6f | 77 65 64 20 62 79 20 66 |re follo|wed by f|
|000031b0| 6f 75 72 20 6e 75 6d 62 | 65 72 73 20 74 68 61 74 |our numb|ers that|
|000031c0| 20 61 72 65 0a 69 6e 74 | 65 72 70 72 65 74 65 64 | are.int|erpreted|
|000031d0| 20 61 73 20 74 68 65 20 | 63 6f 65 66 66 65 63 69 | as the |coeffeci|
|000031e0| 65 6e 74 73 20 66 6f 72 | 20 74 68 65 20 70 61 72 |ents for| the par|
|000031f0| 61 6d 65 74 72 69 63 20 | 76 61 72 69 61 62 6c 65 |ametric |variable|
|00003200| 20 24 78 24 2c 20 24 79 | 24 2c 20 6f 72 20 24 7a | $x$, $y|$, or $z|
|00003210| 24 0a 69 6e 20 74 68 65 | 20 63 61 73 65 20 6f 66 |$.in the| case of|
|00003220| 20 7b 5c 74 74 20 6e 63 | 6f 65 66 66 73 7d 20 6f | {\tt nc|oeffs} o|
|00003230| 72 20 61 73 20 74 68 65 | 20 62 65 7a 69 65 72 20 |r as the| bezier |
|00003240| 63 75 72 76 65 20 77 68 | 65 72 65 20 74 68 65 20 |curve wh|ere the |
|00003250| 66 69 72 73 74 20 6e 75 | 6d 62 65 72 20 69 73 0a |first nu|mber is.|
|00003260| 74 68 65 20 73 74 61 72 | 74 69 6e 67 20 76 61 6c |the star|ting val|
|00003270| 75 65 2c 20 74 68 65 20 | 6c 61 73 74 20 76 61 6c |ue, the |last val|
|00003280| 75 65 20 69 73 20 74 68 | 65 20 65 6e 64 69 6e 67 |ue is th|e ending|
|00003290| 20 76 61 6c 75 65 2c 20 | 61 6e 64 20 74 68 65 20 | value, |and the |
|000032a0| 73 65 63 6f 6e 64 20 61 | 6e 64 0a 74 68 69 72 64 |second a|nd.third|
|000032b0| 20 76 61 6c 75 65 73 20 | 64 65 66 69 6e 65 20 74 | values |define t|
|000032c0| 68 65 20 60 60 73 70 65 | 65 64 27 27 20 61 74 20 |he ``spe|ed'' at |
|000032d0| 77 68 69 63 68 20 74 68 | 65 20 63 75 72 76 65 20 |which th|e curve |
|000032e0| 6c 65 61 76 65 73 20 74 | 68 65 20 65 6e 64 70 6f |leaves t|he endpo|
|000032f0| 69 6e 74 73 2e 0a 5c 65 | 6e 64 7b 64 65 66 70 72 |ints..\e|nd{defpr|
|00003300| 69 6d 7d 0a 0a 48 6f 70 | 65 66 69 6c 6c 79 20 74 |im}..Hop|efilly t|
|00003310| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 65 78 61 |he follo|wing exa|
|00003320| 6d 70 6c 65 73 20 6d 61 | 6b 65 20 74 68 69 73 20 |mples ma|ke this |
|00003330| 63 6c 65 61 72 65 72 3a | 0a 0a 5c 62 65 67 69 6e |clearer:|..\begin|
|00003340| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 73 77 65 70 74 |{verbati|m}.swept|
|00003350| 73 70 68 20 62 65 7a 69 | 65 72 20 20 2d 31 30 20 |sph bezi|er -10 |
|00003360| 30 20 30 20 20 20 2d 31 | 30 20 30 20 31 30 20 20 |0 0 -1|0 0 10 |
|00003370| 20 31 30 20 30 20 2d 31 | 30 20 20 20 31 30 20 30 | 10 0 -1|0 10 0|
|00003380| 20 30 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | 0. | |
|00003390| 20 20 20 20 31 20 30 20 | 30 20 30 0a 0a 73 77 65 | 1 0 |0 0..swe|
|000033a0| 70 74 73 70 68 20 63 6f | 65 66 66 73 20 20 2e 36 |ptsph co|effs .6|
|000033b0| 35 20 31 35 2e 37 20 2d | 32 32 2e 32 20 30 20 20 |5 15.7 -|22.2 0 |
|000033c0| 20 20 30 20 30 20 30 20 | 30 20 20 20 20 31 20 35 | 0 0 0 |0 1 5|
|000033d0| 36 20 2d 31 31 30 20 36 | 35 2e 35 0a 20 20 20 20 |6 -110 6|5.5. |
|000033e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 31 20 2d | | 1 -|
|000033f0| 31 20 30 20 30 0a 0a 73 | 77 65 70 74 73 70 68 0a |1 0 0..s|weptsph.|
|00003400| 20 20 20 20 20 20 20 20 | 20 78 62 65 7a 69 65 72 | | xbezier|
|00003410| 20 30 20 31 30 20 2d 31 | 30 20 30 0a 20 20 20 20 | 0 10 -1|0 0. |
|00003420| 20 20 20 20 20 79 63 6f | 65 66 66 73 20 30 20 31 | yco|effs 0 1|
|00003430| 30 20 2d 31 30 20 30 0a | 20 20 20 20 20 20 20 20 |0 -10 0.| |
|00003440| 20 7a 62 65 7a 69 65 72 | 20 31 30 20 30 20 30 20 | zbezier| 10 0 0 |
|00003450| 2d 31 30 0a 20 20 20 20 | 20 20 20 20 20 2e 35 20 |-10. | .5 |
|00003460| 36 20 2d 36 20 30 0a 5c | 65 6e 64 7b 76 65 72 62 |6 -6 0.\|end{verb|
|00003470| 61 74 69 6d 7d 0a 0a 54 | 68 65 72 65 20 61 72 65 |atim}..T|here are|
|00003480| 20 61 20 66 65 77 20 6b | 6e 6f 77 6e 20 62 75 67 | a few k|nown bug|
|00003490| 73 3a 0a 0a 5c 62 65 67 | 69 6e 7b 69 74 65 6d 69 |s:..\beg|in{itemi|
|000034a0| 7a 65 7d 0a 5c 69 74 65 | 6d 20 4f 66 74 65 6e 20 |ze}.\ite|m Often |
|000034b0| 74 68 65 72 65 20 69 73 | 20 61 20 60 60 73 68 61 |there is| a ``sha|
|000034c0| 64 6f 77 27 27 20 72 69 | 6e 67 20 61 72 6f 75 6e |dow'' ri|ng aroun|
|000034d0| 64 20 74 68 65 20 64 69 | 61 6d 65 74 65 72 20 6f |d the di|ameter o|
|000034e0| 66 20 74 68 65 20 70 72 | 69 6d 69 74 69 76 65 0a |f the pr|imitive.|
|000034f0| 77 68 65 72 65 20 74 68 | 65 20 66 75 6e 63 74 69 |where th|e functi|
|00003500| 6f 6e 73 20 61 72 65 20 | 65 76 61 6c 75 61 74 65 |ons are |evaluate|
|00003510| 64 20 61 74 20 24 74 20 | 3d 20 30 2e 35 24 2e 20 |d at $t |= 0.5$. |
|00003520| 20 50 72 65 73 75 6d 61 | 62 6c 79 20 74 68 69 73 | Presuma|bly this|
|00003530| 20 69 73 20 64 75 65 20 | 74 6f 0a 72 6f 75 6e 64 | is due |to.round|
|00003540| 6f 66 66 20 65 72 72 6f | 72 20 70 6f 73 73 69 62 |off erro|r possib|
|00003550| 6c 79 20 69 6e 20 74 68 | 65 20 72 6f 6f 74 20 66 |ly in th|e root f|
|00003560| 69 6e 64 69 6e 67 20 61 | 6c 67 6f 72 69 74 68 6d |inding a|lgorithm|
|00003570| 73 2c 20 70 65 72 68 61 | 70 73 20 65 6c 73 65 77 |s, perha|ps elsew|
|00003580| 68 65 72 65 2e 0a 0a 5c | 69 74 65 6d 20 53 6f 6d |here...\|item Som|
|00003590| 65 20 63 6f 6e 66 69 67 | 75 72 61 74 69 6f 6e 73 |e config|urations|
|000035a0| 20 75 73 69 6e 67 20 74 | 68 65 20 7b 5c 74 74 20 | using t|he {\tt |
|000035b0| 62 65 7a 69 65 72 7d 20 | 73 70 65 63 69 66 69 63 |bezier} |specific|
|000035c0| 61 74 69 6f 6e 20 72 65 | 73 75 6c 74 20 69 6e 0a |ation re|sult in.|
|000035d0| 67 61 72 62 61 67 65 2e | 20 20 55 73 75 61 6c 6c |garbage.| Usuall|
|000035e0| 79 20 74 68 69 73 20 63 | 61 6e 20 62 65 20 61 76 |y this c|an be av|
|000035f0| 6f 69 64 65 64 20 62 79 | 20 63 68 61 6e 67 69 6e |oided by| changin|
|00003600| 67 20 74 68 65 20 64 65 | 66 69 6e 69 6e 67 20 70 |g the de|fining p|
|00003610| 6f 69 6e 74 27 73 20 76 | 61 6c 75 65 73 0a 73 6c |oint's v|alues.sl|
|00003620| 69 67 68 74 6c 79 20 77 | 69 74 68 6f 75 74 20 61 |ightly w|ithout a|
|00003630| 66 66 65 63 74 69 6e 67 | 20 74 68 65 20 63 75 72 |ffecting| the cur|
|00003640| 76 65 20 6e 6f 74 69 63 | 65 61 62 6c 79 2e 20 20 |ve notic|eably. |
|00003650| 45 78 61 6d 70 6c 65 73 | 20 61 72 65 5c 5c 0a 7b |Examples| are\\.{|
|00003660| 5c 74 74 20 62 65 7a 69 | 65 72 20 2d 31 30 20 30 |\tt bezi|er -10 0|
|00003670| 20 30 20 2d 31 30 20 30 | 20 30 20 20 31 30 20 30 | 0 -10 0| 0 10 0|
|00003680| 20 30 20 20 31 30 20 30 | 20 30 7d 20 5c 5c 0a 61 | 0 10 0| 0} \\.a|
|00003690| 6e 64 20 7b 5c 74 74 20 | 62 65 7a 69 65 72 20 2d |nd {\tt |bezier -|
|000036a0| 31 30 20 30 20 30 20 20 | 31 30 20 30 20 31 30 20 |10 0 0 |10 0 10 |
|000036b0| 20 2d 31 30 20 30 20 31 | 30 20 20 31 30 20 30 20 | -10 0 1|0 10 0 |
|000036c0| 30 7d 2e 0a 5c 65 6e 64 | 7b 69 74 65 6d 69 7a 65 |0}..\end|{itemize|
|000036d0| 7d 0a 0a 4f 74 68 65 72 | 20 70 72 6f 62 6c 65 6d |}..Other| problem|
|000036e0| 73 3a 0a 0a 20 20 20 20 | 20 20 20 20 55 73 69 6e |s:.. | Usin|
|000036f0| 67 20 74 68 69 72 64 20 | 6f 72 64 65 72 20 65 71 |g third |order eq|
|00003700| 75 61 74 69 6f 6e 73 20 | 74 6f 20 64 65 66 69 6e |uations |to defin|
|00003710| 65 20 74 68 65 20 63 65 | 6e 74 65 72 20 70 61 74 |e the ce|nter pat|
|00003720| 68 20 6f 72 20 74 68 65 | 20 72 61 64 69 75 73 0a |h or the| radius.|
|00003730| 72 65 71 75 69 72 65 73 | 20 73 6f 6c 76 69 6e 67 |requires| solving|
|00003740| 20 61 20 74 65 6e 74 68 | 20 6f 72 64 65 72 20 65 | a tenth| order e|
|00003750| 71 75 61 74 69 6f 6e 20 | 77 68 65 6e 20 63 68 65 |quation |when che|
|00003760| 63 6b 69 6e 67 20 66 6f | 72 20 69 6e 74 65 72 73 |cking fo|r inters|
|00003770| 65 63 74 69 6f 6e 2e 20 | 20 41 6c 6c 0a 72 6f 6f |ection. | All.roo|
|00003780| 74 73 20 6f 76 65 72 20 | 74 68 65 20 69 6e 74 65 |ts over |the inte|
|00003790| 72 76 61 6c 20 24 28 30 | 2c 31 29 24 20 6d 75 73 |rval $(0|,1)$ mus|
|000037a0| 74 20 62 65 20 66 6f 75 | 6e 64 2c 20 6e 6f 74 20 |t be fou|nd, not |
|000037b0| 6a 75 73 74 20 74 68 65 | 20 73 6d 61 6c 6c 65 73 |just the| smalles|
|000037c0| 74 2e 20 20 54 68 65 20 | 72 6f 6f 74 0a 66 69 6e |t. The |root.fin|
|000037d0| 64 65 72 20 75 73 65 64 | 20 77 61 73 20 6f 6e 65 |der used| was one|
|000037e0| 20 74 68 61 74 20 49 20 | 77 72 6f 74 65 20 74 68 | that I |wrote th|
|000037f0| 61 74 20 75 73 65 73 20 | 61 20 63 6f 6d 62 69 6e |at uses |a combin|
|00003800| 61 74 69 6f 6e 20 6f 66 | 20 4e 65 77 74 6f 6e 2d |ation of| Newton-|
|00003810| 52 61 73 70 68 73 6f 6e | 20 61 6e 64 0a 62 69 73 |Rasphson| and.bis|
|00003820| 65 63 74 69 6f 6e 2e 20 | 20 49 74 20 65 6e 64 73 |ection. | It ends|
|00003830| 20 75 70 20 62 65 69 6e | 67 20 66 61 69 72 6c 79 | up bein|g fairly|
|00003840| 20 73 6c 6f 77 20 61 6e | 64 20 70 72 6f 62 61 62 | slow an|d probab|
|00003850| 6c 79 20 63 6f 75 6c 64 | 20 75 73 65 20 73 6f 6d |ly could| use som|
|00003860| 65 20 73 70 65 65 64 69 | 6e 67 0a 75 70 2e 20 20 |e speedi|ng.up. |
|00003870| 41 20 66 65 77 20 70 6f | 73 73 69 62 69 6c 69 74 |A few po|ssibilit|
|00003880| 69 65 73 20 77 6f 75 6c | 64 20 62 65 20 75 73 69 |ies woul|d be usi|
|00003890| 6e 67 20 53 74 75 72 6d | 20 73 65 71 75 65 6e 63 |ng Sturm| sequenc|
|000038a0| 65 73 20 74 6f 20 66 69 | 6e 64 20 74 68 65 20 6e |es to fi|nd the n|
|000038b0| 75 6d 62 65 72 0a 6f 66 | 20 72 6f 6f 74 73 20 6f |umber.of| roots o|
|000038c0| 76 65 72 20 61 6e 20 69 | 6e 74 65 72 76 61 6c 20 |ver an i|nterval |
|000038d0| 28 49 20 74 72 69 65 64 | 20 74 68 69 73 20 62 75 |(I tried| this bu|
|000038e0| 74 20 6d 79 20 61 6c 67 | 6f 72 69 74 68 6d 20 64 |t my alg|orithm d|
|000038f0| 69 64 20 6e 6f 74 20 66 | 69 6e 64 20 61 6c 6c 20 |id not f|ind all |
|00003900| 74 68 65 0a 72 6f 6f 74 | 73 20 61 6e 64 20 74 68 |the.root|s and th|
|00003910| 75 73 20 70 72 6f 64 75 | 63 65 64 20 67 61 70 73 |us produ|ced gaps|
|00003920| 20 69 6e 20 74 68 65 20 | 73 75 72 66 61 63 65 2e | in the |surface.|
|00003930| 20 20 49 20 70 6c 61 6e | 20 6f 6e 20 74 72 79 69 | I plan| on tryi|
|00003940| 6e 67 20 74 6f 20 66 69 | 78 20 69 74 20 69 66 20 |ng to fi|x it if |
|00003950| 49 0a 63 61 6e 29 20 61 | 6e 64 20 74 6f 20 72 65 |I.can) a|nd to re|
|00003960| 64 75 63 65 20 74 68 65 | 20 70 6f 6c 79 6e 6f 6d |duce the| polynom|
|00003970| 69 61 6c 20 62 79 20 64 | 69 76 69 64 69 6e 67 20 |ial by d|ividing |
|00003980| 74 68 72 6f 75 67 68 20 | 62 79 20 6b 6e 6f 77 6e |through |by known|
|00003990| 20 72 6f 6f 74 73 20 62 | 65 66 6f 72 65 0a 73 6f | roots b|efore.so|
|000039a0| 6c 76 69 6e 67 20 66 6f | 72 20 72 65 6d 61 69 6e |lving fo|r remain|
|000039b0| 69 6e 67 20 72 6f 6f 74 | 73 2e 0a 0a 20 20 20 20 |ing root|s... |
|000039c0| 20 20 20 20 41 6e 79 20 | 63 6f 6d 6d 65 6e 74 73 | Any |comments|
|000039d0| 2c 20 62 75 67 20 72 65 | 70 6f 72 74 73 2c 20 6f |, bug re|ports, o|
|000039e0| 72 20 73 75 67 67 65 73 | 74 69 6f 6e 73 20 66 6f |r sugges|tions fo|
|000039f0| 72 20 63 68 61 6e 67 65 | 73 20 6f 72 20 69 6d 70 |r change|s or imp|
|00003a00| 72 6f 76 65 6d 65 6e 74 | 73 0a 77 69 6c 6c 20 62 |rovement|s.will b|
|00003a10| 65 20 67 72 65 61 74 6c | 79 20 61 70 70 72 65 63 |e greatl|y apprec|
|00003a20| 69 61 74 65 64 2e 0a 0a | 54 68 69 73 20 61 64 64 |iated...|This add|
|00003a30| 69 74 69 6f 6e 20 70 72 | 6f 76 69 64 65 64 20 62 |ition pr|ovided b|
|00003a40| 79 20 4c 61 72 72 79 20 | 43 6f 66 66 69 6e 20 5c |y Larry |Coffin \|
|00003a50| 5c 0a 7b 5c 74 74 20 6c | 63 6f 66 66 69 6e 40 63 |\.{\tt l|coffin@c|
|00003a60| 6c 63 69 72 69 73 2e 63 | 68 65 6d 2e 75 6d 72 2e |lciris.c|hem.umr.|
|00003a70| 65 64 75 7d 0a 0a 5c 73 | 65 63 74 69 6f 6e 7b 41 |edu}..\s|ection{A|
|00003a80| 67 67 72 65 67 61 74 65 | 20 4f 62 6a 65 63 74 73 |ggregate| Objects|
|00003a90| 7d 0a 0a 41 6e 20 61 67 | 67 72 65 67 61 74 65 20 |}..An ag|gregate |
|00003aa0| 69 73 20 61 20 63 6f 6c | 6c 65 63 74 69 6f 6e 20 |is a col|lection |
|00003ab0| 6f 66 20 70 72 69 6d 69 | 74 69 76 65 73 2c 20 61 |of primi|tives, a|
|00003ac0| 67 67 72 65 67 61 74 65 | 2c 20 61 6e 64 20 43 53 |ggregate|, and CS|
|00003ad0| 47 0a 6f 62 6a 65 63 74 | 73 2e 20 20 41 6e 20 61 |G.object|s. An a|
|00003ae0| 67 67 72 65 67 61 74 65 | 2c 20 6f 6e 63 65 20 64 |ggregate|, once d|
|00003af0| 65 66 69 6e 65 64 2c 20 | 6d 61 79 20 62 65 20 69 |efined, |may be i|
|00003b00| 6e 73 74 61 6e 74 69 61 | 74 65 64 20 61 74 20 77 |nstantia|ted at w|
|00003b10| 69 6c 6c 2c 0a 77 68 69 | 63 68 20 6d 65 61 6e 73 |ill,.whi|ch means|
|00003b20| 20 74 68 61 74 0a 63 6f | 70 69 65 73 20 74 68 61 | that.co|pies tha|
|00003b30| 74 20 61 72 65 20 6f 70 | 74 69 6f 6e 61 6c 6c 79 |t are op|tionally|
|00003b40| 20 74 72 61 6e 73 66 6f | 72 6d 65 64 20 61 6e 64 | transfo|rmed and|
|00003b50| 20 74 65 78 74 75 72 65 | 64 20 6d 61 79 20 62 65 | texture|d may be|
|00003b60| 20 6d 61 64 65 2e 0a 49 | 66 20 61 20 73 63 65 6e | made..I|f a scen|
|00003b70| 65 20 63 61 6c 6c 73 20 | 66 6f 72 20 74 68 65 20 |e calls |for the |
|00003b80| 70 72 65 73 65 6e 63 65 | 20 6f 66 20 6d 61 6e 79 |presence| of many|
|00003b90| 20 67 65 6f 6d 65 74 72 | 69 63 61 6c 6c 79 20 69 | geometr|ically i|
|00003ba0| 64 65 6e 74 69 63 61 6c | 0a 6f 62 6a 65 63 74 73 |dentical|.objects|
|00003bb0| 2c 20 6f 6e 6c 79 20 6f | 6e 65 20 73 75 63 68 20 |, only o|ne such |
|00003bc0| 6f 62 6a 65 63 74 20 6e | 65 65 64 20 62 65 20 64 |object n|eed be d|
|00003bd0| 65 66 69 6e 65 64 3b 20 | 74 68 65 20 6f 6e 65 20 |efined; |the one |
|00003be0| 64 65 66 69 6e 65 64 20 | 6f 62 6a 65 63 74 0a 6d |defined |object.m|
|00003bf0| 61 79 20 74 68 65 6e 20 | 62 65 20 69 6e 73 74 61 |ay then |be insta|
|00003c00| 6e 74 69 61 74 65 64 20 | 6d 61 6e 79 20 74 69 6d |ntiated |many tim|
|00003c10| 65 73 2e 0a 0a 41 6e 20 | 61 67 67 72 65 67 61 74 |es...An |aggregat|
|00003c20| 65 20 69 73 20 6f 6e 65 | 20 6f 66 20 73 65 76 65 |e is one| of seve|
|00003c30| 72 61 6c 20 70 6f 73 73 | 69 62 6c 65 20 74 79 70 |ral poss|ible typ|
|00003c40| 65 73 2e 20 20 54 68 65 | 73 65 20 61 67 67 72 65 |es. The|se aggre|
|00003c50| 67 61 74 65 20 74 79 70 | 65 73 0a 61 72 65 20 64 |gate typ|es.are d|
|00003c60| 69 66 66 65 72 65 6e 74 | 69 61 74 65 64 20 62 79 |ifferent|iated by|
|00003c70| 20 74 68 65 20 74 79 70 | 65 20 6f 66 20 72 61 79 | the typ|e of ray|
|00003c80| 2f 61 67 67 72 65 67 61 | 74 65 20 69 6e 74 65 72 |/aggrega|te inter|
|00003c90| 73 65 63 74 69 6f 6e 20 | 61 6c 67 6f 72 69 74 68 |section |algorith|
|00003ca0| 6d 0a 28 6f 66 74 65 6e | 20 74 65 72 6d 65 64 20 |m.(often| termed |
|00003cb0| 61 6e 20 7b 5c 65 6d 20 | 61 63 63 65 6c 65 72 61 |an {\em |accelera|
|00003cc0| 74 69 6f 6e 20 74 65 63 | 68 6e 69 71 75 65 7d 20 |tion tec|hnique} |
|00003cd0| 6f 72 20 7b 5c 65 6d 20 | 65 66 66 69 63 69 65 6e |or {\em |efficien|
|00003ce0| 63 79 20 73 63 68 65 6d | 65 7d 29 0a 74 68 61 74 |cy schem|e}).that|
|00003cf0| 20 69 73 20 75 73 65 64 | 2e 0a 0a 41 67 67 72 65 | is used|...Aggre|
|00003d00| 67 61 74 65 73 20 61 72 | 65 20 64 65 66 69 6e 65 |gates ar|e define|
|00003d10| 64 20 62 79 20 67 69 76 | 69 6e 67 20 61 20 6b 65 |d by giv|ing a ke|
|00003d20| 79 77 6f 72 64 20 74 68 | 61 74 20 64 65 66 69 6e |yword th|at defin|
|00003d30| 65 73 20 74 68 65 0a 74 | 79 70 65 20 6f 66 20 74 |es the.t|ype of t|
|00003d40| 68 65 20 61 67 67 72 65 | 67 61 74 65 2c 20 66 6f |he aggre|gate, fo|
|00003d50| 6c 6c 6f 77 65 64 20 62 | 79 0a 61 20 73 65 72 69 |llowed b|y.a seri|
|00003d60| 65 73 20 6f 66 20 6f 62 | 6a 65 63 74 20 69 6e 73 |es of ob|ject ins|
|00003d70| 74 61 6e 74 69 61 74 69 | 6f 6e 73 20 61 6e 64 0a |tantiati|ons and.|
|00003d80| 73 75 72 66 61 63 65 20 | 64 65 66 69 6e 69 74 69 |surface |definiti|
|00003d90| 6f 6e 73 2c 20 61 6e 64 | 20 74 65 72 6d 69 6e 61 |ons, and| termina|
|00003da0| 74 65 64 20 75 73 69 6e | 67 20 74 68 65 20 7b 5c |ted usin|g the {\|
|00003db0| 74 74 20 65 6e 64 7d 20 | 6b 65 79 77 6f 72 64 2e |tt end} |keyword.|
|00003dc0| 0a 49 66 20 61 20 64 65 | 66 69 6e 65 64 20 6f 62 |.If a de|fined ob|
|00003dd0| 6a 65 63 74 20 63 6f 6e | 74 61 69 6e 73 20 6e 6f |ject con|tains no|
|00003de0| 20 69 6e 73 74 61 6e 74 | 69 61 74 69 6f 6e 73 2c | instant|iations,|
|00003df0| 20 61 20 77 61 72 6e 69 | 6e 67 20 6d 65 73 73 61 | a warni|ng messa|
|00003e00| 67 65 0a 69 73 20 70 72 | 69 6e 74 65 64 2e 0a 0a |ge.is pr|inted...|
|00003e10| 54 68 65 20 6d 6f 73 74 | 20 62 61 73 69 63 20 74 |The most| basic t|
|00003e20| 79 70 65 20 6f 66 20 61 | 67 67 72 65 67 61 74 65 |ype of a|ggregate|
|00003e30| 2c 20 74 68 65 20 7b 5c | 65 6d 20 6c 69 73 74 7d |, the {\|em list}|
|00003e40| 2c 20 70 65 72 66 6f 72 | 6d 73 0a 69 6e 74 65 72 |, perfor|ms.inter|
|00003e50| 73 65 63 74 69 6f 6e 20 | 74 65 73 74 69 6e 67 20 |section |testing |
|00003e60| 69 6e 20 74 68 65 20 73 | 69 6d 70 6c 65 73 74 20 |in the s|implest |
|00003e70| 70 6f 73 73 69 62 6c 65 | 20 77 61 79 3a 20 20 45 |possible| way: E|
|00003e80| 61 63 68 20 6f 62 6a 65 | 63 74 20 69 6e 20 74 68 |ach obje|ct in th|
|00003e90| 65 0a 6c 69 73 74 20 69 | 73 20 74 65 73 74 65 64 |e.list i|s tested|
|00003ea0| 20 66 6f 72 20 69 6e 74 | 65 72 73 65 63 74 69 6f | for int|ersectio|
|00003eb0| 6e 20 77 69 74 68 20 74 | 68 65 20 72 61 79 20 69 |n with t|he ray i|
|00003ec0| 6e 20 74 75 72 6e 2c 20 | 61 6e 64 20 74 68 65 20 |n turn, |and the |
|00003ed0| 63 6c 6f 73 65 73 74 0a | 69 6e 74 65 72 73 65 63 |closest.|intersec|
|00003ee0| 74 69 6f 6e 20 69 73 20 | 72 65 74 75 72 6e 65 64 |tion is |returned|
|00003ef0| 2e 0a 0a 5c 62 65 67 69 | 6e 7b 64 65 66 6b 65 79 |...\begi|n{defkey|
|00003f00| 7d 7b 6c 69 73 74 7d 7b | 5c 6c 64 6f 74 73 20 7b |}{list}{|\ldots {|
|00003f10| 5c 74 74 20 65 6e 64 7d | 7d 0a 09 43 72 65 61 74 |\tt end}|}..Creat|
|00003f20| 65 20 61 20 4c 69 73 74 | 20 6f 62 6a 65 63 74 20 |e a List| object |
|00003f30| 63 6f 6e 74 61 69 6e 69 | 6e 67 20 74 68 6f 73 65 |containi|ng those|
|00003f40| 20 6f 62 6a 65 63 74 73 | 20 69 6e 73 74 61 6e 74 | objects| instant|
|00003f50| 69 61 74 65 64 20 62 65 | 74 77 65 65 6e 0a 09 74 |iated be|tween..t|
|00003f60| 68 65 20 7b 5c 74 74 20 | 6c 69 73 74 7d 2f 7b 5c |he {\tt |list}/{\|
|00003f70| 74 74 20 65 6e 64 7d 20 | 70 61 69 72 2e 0a 5c 65 |tt end} |pair..\e|
|00003f80| 6e 64 7b 64 65 66 6b 65 | 79 7d 0a 0a 54 68 65 20 |nd{defke|y}..The |
|00003f90| 7b 5c 65 6d 20 67 72 69 | 64 7d 20 61 67 67 72 65 |{\em gri|d} aggre|
|00003fa0| 67 61 74 65 0a 64 69 76 | 69 64 65 73 20 74 68 65 |gate.div|ides the|
|00003fb0| 20 72 65 67 69 6f 6e 20 | 6f 66 20 73 70 61 63 65 | region |of space|
|00003fc0| 20 69 74 20 6f 63 63 75 | 70 69 65 73 20 69 6e 74 | it occu|pies int|
|00003fd0| 6f 20 61 20 6e 75 6d 62 | 65 72 20 6f 66 20 64 69 |o a numb|er of di|
|00003fe0| 73 63 72 65 74 65 0a 62 | 6f 78 2d 73 68 61 70 65 |screte.b|ox-shape|
|00003ff0| 64 0a 76 6f 78 65 6c 73 | 2e 20 20 45 61 63 68 20 |d.voxels|. Each |
|00004000| 6f 66 20 74 68 65 73 65 | 20 76 6f 78 65 6c 73 20 |of these| voxels |
|00004010| 63 6f 6e 74 61 69 6e 73 | 20 61 20 6c 69 73 74 20 |contains| a list |
|00004020| 6f 66 20 74 68 65 20 6f | 62 6a 65 63 74 73 20 74 |of the o|bjects t|
|00004030| 68 61 74 0a 69 6e 74 65 | 72 73 65 63 74 20 74 68 |hat.inte|rsect th|
|00004040| 65 20 76 6f 78 65 6c 2e | 20 20 54 68 69 73 20 64 |e voxel.| This d|
|00004050| 69 73 63 72 65 74 69 7a | 61 74 69 6f 6e 20 6d 61 |iscretiz|ation ma|
|00004060| 6b 65 73 20 69 74 20 70 | 6f 73 73 69 62 6c 65 20 |kes it p|ossible |
|00004070| 74 6f 0a 72 65 73 74 72 | 69 63 74 20 74 68 65 20 |to.restr|ict the |
|00004080| 6f 62 6a 65 63 74 73 0a | 74 65 73 74 65 64 20 66 |objects.|tested f|
|00004090| 6f 72 20 69 6e 74 65 72 | 73 65 63 74 69 6f 6e 20 |or inter|section |
|000040a0| 74 6f 20 74 68 6f 73 65 | 20 74 68 61 74 20 61 72 |to those| that ar|
|000040b0| 65 20 6c 69 6b 65 6c 79 | 20 74 6f 20 68 69 74 20 |e likely| to hit |
|000040c0| 74 68 65 20 72 61 79 2c | 0a 61 6e 64 20 74 6f 20 |the ray,|.and to |
|000040d0| 74 65 73 74 0a 74 68 65 | 20 6f 62 6a 65 63 74 73 |test.the| objects|
|000040e0| 20 69 6e 20 6e 65 61 72 | 6c 79 20 60 60 63 6c 6f | in near|ly ``clo|
|000040f0| 73 65 73 74 2d 66 69 72 | 73 74 27 27 20 6f 72 64 |sest-fir|st'' ord|
|00004100| 65 72 2e 0a 0a 5c 62 65 | 67 69 6e 7b 64 65 66 6b |er...\be|gin{defk|
|00004110| 65 79 7d 7b 67 72 69 64 | 7d 7b 7b 5c 65 6d 20 78 |ey}{grid|}{{\em x|
|00004120| 76 6f 78 20 79 76 6f 78 | 20 7a 76 6f 78 7d 20 5c |vox yvox| zvox} \|
|00004130| 6c 64 6f 74 73 20 7b 5c | 74 74 20 65 6e 64 7d 7d |ldots {\|tt end}}|
|00004140| 0a 09 43 72 65 61 74 65 | 20 61 20 47 72 69 64 20 |..Create| a Grid |
|00004150| 6f 62 6a 65 63 74 73 20 | 63 6f 6d 70 6f 73 65 64 |objects |composed|
|00004160| 20 6f 66 20 7b 5c 65 6d | 20 78 76 6f 78 7d 20 62 | of {\em| xvox} b|
|00004170| 79 20 7b 5c 65 6d 20 79 | 76 6f 78 7d 20 62 79 0a |y {\em y|vox} by.|
|00004180| 09 7b 5c 65 6d 20 7a 76 | 6f 78 7d 20 76 6f 78 65 |.{\em zv|ox} voxe|
|00004190| 6c 73 20 63 6f 6e 74 61 | 69 6e 69 6e 67 20 74 68 |ls conta|ining th|
|000041a0| 6f 73 65 20 6f 62 6a 65 | 63 74 73 0a 09 69 6e 73 |ose obje|cts..ins|
|000041b0| 74 61 6e 74 69 61 74 65 | 64 20 62 65 74 77 65 65 |tantiate|d betwee|
|000041c0| 6e 20 74 68 65 20 7b 5c | 74 74 20 67 72 69 64 7d |n the {\|tt grid}|
|000041d0| 2f 7b 5c 74 74 20 65 6e | 64 7d 20 70 61 69 72 2e |/{\tt en|d} pair.|
|000041e0| 0a 5c 65 6e 64 7b 64 65 | 66 6b 65 79 7d 0a 49 74 |.\end{de|fkey}.It|
|000041f0| 20 69 73 20 75 73 75 61 | 6c 6c 79 20 6f 6e 6c 79 | is usua|lly only|
|00004200| 20 77 6f 72 74 68 77 68 | 69 6c 65 20 74 6f 20 60 | worthwh|ile to `|
|00004210| 60 65 6e 67 72 69 64 27 | 27 20 72 61 74 68 65 72 |`engrid'|' rather|
|00004220| 20 6c 61 72 67 65 2c 0a | 63 6f 6d 70 6c 65 78 20 | large,.|complex |
|00004230| 63 6f 6c 6c 65 63 74 69 | 6f 6e 73 20 6f 66 20 6f |collecti|ons of o|
|00004240| 62 6a 65 63 74 73 2e 20 | 20 47 72 69 64 73 20 61 |bjects. | Grids a|
|00004250| 6c 73 6f 20 75 73 65 20 | 61 20 67 72 65 61 74 20 |lso use |a great |
|00004260| 64 65 61 6c 20 6d 6f 72 | 65 0a 6d 65 6d 6f 72 79 |deal mor|e.memory|
|00004270| 20 74 68 61 6e 20 4c 69 | 73 74 20 6f 62 6a 65 63 | than Li|st objec|
|00004280| 74 73 2e 0a 0a 5c 73 65 | 63 74 69 6f 6e 20 7b 43 |ts...\se|ction {C|
|00004290| 6f 6e 73 74 72 75 63 74 | 69 76 65 20 53 6f 6c 69 |onstruct|ive Soli|
|000042a0| 64 20 47 65 6f 6d 65 74 | 72 79 7d 0a 0a 43 6f 6e |d Geomet|ry}..Con|
|000042b0| 73 74 72 75 63 74 69 76 | 65 20 53 6f 6c 69 64 20 |structiv|e Solid |
|000042c0| 47 65 6f 6d 65 74 72 79 | 20 69 73 0a 74 68 65 20 |Geometry| is.the |
|000042d0| 70 72 6f 63 65 73 73 20 | 6f 66 20 62 75 69 6c 64 |process |of build|
|000042e0| 69 6e 67 20 73 6f 6c 69 | 64 20 6f 62 6a 65 63 74 |ing soli|d object|
|000042f0| 73 20 66 72 6f 6d 20 6f | 74 68 65 72 20 73 6f 6c |s from o|ther sol|
|00004300| 69 64 73 2e 0a 54 68 65 | 20 74 68 72 65 65 20 43 |ids..The| three C|
|00004310| 53 47 0a 6f 70 65 72 61 | 74 6f 72 73 20 61 72 65 |SG.opera|tors are|
|00004320| 20 55 6e 69 6f 6e 2c 20 | 49 6e 74 65 72 73 65 63 | Union, |Intersec|
|00004330| 74 69 6f 6e 2c 20 61 6e | 64 20 44 69 66 66 65 72 |tion, an|d Differ|
|00004340| 65 6e 63 65 2e 20 20 45 | 61 63 68 20 6f 70 65 72 |ence. E|ach oper|
|00004350| 61 74 6f 72 0a 61 63 74 | 73 20 75 70 6f 6e 20 74 |ator.act|s upon t|
|00004360| 77 6f 20 6f 62 6a 65 63 | 74 73 20 61 6e 64 20 70 |wo objec|ts and p|
|00004370| 72 6f 64 75 63 65 73 20 | 61 20 73 69 6e 67 6c 65 |roduces |a single|
|00004380| 20 6f 62 6a 65 63 74 20 | 72 65 73 75 6c 74 2e 0a | object |result..|
|00004390| 42 79 20 63 6f 6d 62 69 | 6e 69 6e 67 20 6d 75 6c |By combi|ning mul|
|000043a0| 74 69 70 6c 65 20 6c 65 | 76 65 6c 73 20 6f 66 20 |tiple le|vels of |
|000043b0| 43 53 47 20 6f 70 65 72 | 61 74 6f 72 73 2c 20 63 |CSG oper|ators, c|
|000043c0| 6f 6d 70 6c 65 78 0a 6f | 62 6a 65 63 74 73 20 63 |omplex.o|bjects c|
|000043d0| 61 6e 20 62 65 20 70 72 | 6f 64 75 63 65 64 20 66 |an be pr|oduced f|
|000043e0| 72 6f 6d 20 73 69 6d 70 | 6c 65 20 70 72 69 6d 69 |rom simp|le primi|
|000043f0| 74 69 76 65 73 2e 0a 0a | 54 68 65 20 75 6e 69 6f |tives...|The unio|
|00004400| 6e 20 6f 66 20 74 77 6f | 20 6f 62 6a 65 63 74 73 |n of two| objects|
|00004410| 20 72 65 73 75 6c 74 73 | 20 69 6e 20 61 6e 0a 6f | results| in an.o|
|00004420| 62 6a 65 63 74 20 74 68 | 61 74 20 65 6e 63 6c 6f |bject th|at enclo|
|00004430| 73 65 73 20 74 68 65 20 | 73 70 61 63 65 20 6f 63 |ses the |space oc|
|00004440| 63 75 70 69 65 64 20 62 | 79 20 74 68 65 20 74 77 |cupied b|y the tw|
|00004450| 6f 20 67 69 76 65 6e 20 | 6f 62 6a 65 63 74 73 2e |o given |objects.|
|00004460| 0a 49 6e 74 65 72 73 65 | 63 74 69 6f 6e 20 72 65 |.Interse|ction re|
|00004470| 73 75 6c 74 73 20 69 6e | 20 61 6e 20 6f 62 6a 65 |sults in| an obje|
|00004480| 63 74 20 74 68 61 74 20 | 65 6e 63 6c 6f 73 65 73 |ct that |encloses|
|00004490| 20 74 68 65 20 73 70 61 | 63 65 20 77 68 65 72 65 | the spa|ce where|
|000044a0| 20 74 68 65 20 74 77 6f | 0a 67 69 76 65 6e 20 6f | the two|.given o|
|000044b0| 62 6a 65 63 74 73 20 6f | 76 65 72 6c 61 70 2e 20 |bjects o|verlap. |
|000044c0| 20 44 69 66 66 65 72 65 | 6e 63 65 20 69 73 20 61 | Differe|nce is a|
|000044d0| 6e 20 6f 72 64 65 72 20 | 64 65 70 65 6e 64 65 6e |n order |dependen|
|000044e0| 74 20 6f 70 65 72 61 74 | 6f 72 3b 20 69 74 0a 72 |t operat|or; it.r|
|000044f0| 65 73 75 6c 74 73 20 69 | 6e 20 74 68 65 0a 66 69 |esults i|n the.fi|
|00004500| 72 73 74 20 67 69 76 65 | 6e 20 6f 62 6a 65 63 74 |rst give|n object|
|00004510| 20 6d 69 6e 75 73 20 74 | 68 65 20 73 70 61 63 65 | minus t|he space|
|00004520| 20 77 68 65 72 65 20 74 | 68 65 20 73 65 63 6f 6e | where t|he secon|
|00004530| 64 20 69 6e 74 65 72 73 | 65 63 74 65 64 0a 74 68 |d inters|ected.th|
|00004540| 65 20 66 69 72 73 74 2e | 0a 0a 5c 73 75 62 73 65 |e first.|..\subse|
|00004550| 63 74 69 6f 6e 7b 43 53 | 47 20 69 6e 20 7b 5c 52 |ction{CS|G in {\R|
|00004560| 61 79 73 68 61 64 65 7d | 7d 0a 0a 43 53 47 20 69 |ayshade}|}..CSG i|
|00004570| 6e 20 7b 5c 72 61 79 73 | 68 61 64 65 7d 20 77 69 |n {\rays|hade} wi|
|00004580| 6c 6c 20 67 65 6e 65 72 | 61 6c 6c 79 20 6f 70 65 |ll gener|ally ope|
|00004590| 72 61 74 65 20 70 72 6f | 70 65 72 6c 79 20 77 68 |rate pro|perly wh|
|000045a0| 65 6e 20 61 70 70 6c 69 | 65 64 20 74 6f 0a 63 6f |en appli|ed to.co|
|000045b0| 6e 6a 75 6e 63 74 69 6f | 6e 20 77 69 74 68 0a 6f |njunctio|n with.o|
|000045c0| 6e 20 62 6f 78 65 73 2c | 20 73 70 68 65 72 65 73 |n boxes,| spheres|
|000045d0| 2c 0a 74 6f 72 69 2c 20 | 61 6e 64 20 62 6c 6f 62 |,.tori, |and blob|
|000045e0| 73 2e 0a 54 68 65 73 65 | 20 70 72 69 6d 69 74 69 |s..These| primiti|
|000045f0| 76 65 73 20 61 72 65 20 | 62 79 20 6e 61 74 75 72 |ves are |by natur|
|00004600| 65 20 63 6f 6e 73 69 73 | 74 65 6e 74 2c 20 61 73 |e consis|tent, as|
|00004610| 20 74 68 65 79 20 61 6c | 6c 0a 65 6e 63 6c 6f 73 | they al|l.enclos|
|00004620| 65 20 61 20 70 6f 72 74 | 69 6f 6e 20 6f 66 20 73 |e a port|ion of s|
|00004630| 70 61 63 65 20 28 6e 6f | 20 68 6f 6c 65 20 66 72 |pace (no| hole fr|
|00004640| 6f 6d 20 74 68 65 20 60 | 60 69 6e 73 69 64 65 27 |om the `|`inside'|
|00004650| 27 20 74 6f 20 74 68 65 | 0a 60 60 6f 75 74 73 69 |' to the|.``outsi|
|00004660| 64 65 27 27 29 2c 20 68 | 61 76 65 20 73 75 72 66 |de''), h|ave surf|
|00004670| 61 63 65 20 6e 6f 72 6d | 61 6c 73 20 77 68 69 63 |ace norm|als whic|
|00004680| 68 20 70 6f 69 6e 74 20 | 6f 75 74 77 61 72 64 20 |h point |outward |
|00004690| 28 74 68 65 79 0a 61 72 | 65 20 6e 6f 74 20 60 60 |(they.ar|e not ``|
|000046a0| 69 6e 73 69 64 65 2d 6f | 75 74 27 27 29 2c 20 61 |inside-o|ut''), a|
|000046b0| 6e 64 20 64 6f 20 6e 6f | 74 20 68 61 76 65 20 61 |nd do no|t have a|
|000046c0| 6e 79 20 65 78 74 72 61 | 6e 65 6f 75 73 20 73 75 |ny extra|neous su|
|000046d0| 72 66 61 63 65 73 2e 0a | 0a 43 53 47 20 6f 62 6a |rfaces..|.CSG obj|
|000046e0| 65 63 74 73 20 6d 61 79 | 20 61 6c 73 6f 20 62 65 |ects may| also be|
|000046f0| 20 63 6f 6e 73 74 72 75 | 63 74 65 64 20 66 72 6f | constru|cted fro|
|00004700| 6d 20 61 67 67 72 65 67 | 61 74 65 20 6f 62 6a 65 |m aggreg|ate obje|
|00004710| 63 74 73 2e 0a 54 68 65 | 73 65 20 61 67 67 72 65 |cts..The|se aggre|
|00004720| 67 61 74 65 73 20 63 6f | 6e 74 61 69 6e 0a 77 68 |gates co|ntain.wh|
|00004730| 61 74 65 76 65 72 20 69 | 73 20 6c 69 73 74 65 64 |atever i|s listed|
|00004740| 20 69 6e 73 69 64 65 2c | 20 61 6e 64 20 6d 61 79 | inside,| and may|
|00004750| 20 74 68 65 72 65 66 6f | 72 65 20 62 65 20 69 6e | therefo|re be in|
|00004760| 63 6f 6e 73 69 73 74 65 | 6e 74 2e 0a 46 6f 72 20 |consiste|nt..For |
|00004770| 65 78 61 6d 70 6c 65 2c | 20 61 6e 20 6f 62 6a 65 |example,| an obje|
|00004780| 63 74 20 77 68 69 63 68 | 20 63 6f 6e 74 61 69 6e |ct which| contain|
|00004790| 73 20 61 20 73 69 6e 67 | 6c 65 20 74 72 69 61 6e |s a sing|le trian|
|000047a0| 67 6c 65 20 77 69 6c 6c | 20 6e 6f 74 0a 70 72 6f |gle will| not.pro|
|000047b0| 64 75 63 65 20 63 6f 72 | 72 65 63 74 20 72 65 73 |duce cor|rect res|
|000047c0| 75 6c 74 73 20 69 6e 20 | 43 53 47 20 6d 6f 64 65 |ults in |CSG mode|
|000047d0| 6c 73 2c 20 62 65 63 61 | 75 73 65 20 74 68 65 20 |ls, beca|use the |
|000047e0| 74 72 69 61 6e 67 6c 65 | 20 64 6f 65 73 20 6e 6f |triangle| does no|
|000047f0| 74 20 65 6e 63 6c 6f 73 | 65 0a 73 70 61 63 65 2e |t enclos|e.space.|
|00004800| 20 20 48 6f 77 65 76 65 | 72 2c 20 61 20 63 6f 6c | Howeve|r, a col|
|00004810| 6c 65 63 74 69 6f 6e 20 | 6f 66 20 66 6f 75 72 20 |lection |of four |
|00004820| 74 72 69 61 6e 67 6c 65 | 73 20 77 68 69 63 68 20 |triangle|s which |
|00004830| 66 6f 72 6d 20 61 20 70 | 79 72 61 6d 69 64 0a 64 |form a p|yramid.d|
|00004840| 6f 65 73 20 65 6e 63 6c | 6f 73 65 20 73 70 61 63 |oes encl|ose spac|
|00004850| 65 2c 20 61 6e 64 20 69 | 66 20 74 68 65 20 74 72 |e, and i|f the tr|
|00004860| 69 61 6e 67 6c 65 20 6e | 6f 72 6d 61 6c 73 0a 61 |iangle n|ormals.a|
|00004870| 72 65 20 6f 72 69 65 6e | 74 65 64 20 63 6f 72 72 |re orien|ted corr|
|00004880| 65 63 74 6c 79 2c 0a 74 | 68 65 20 43 53 47 20 6f |ectly,.t|he CSG o|
|00004890| 70 65 72 61 74 6f 72 73 | 20 73 68 6f 75 6c 64 20 |perators| should |
|000048a0| 77 6f 72 6b 20 63 6f 72 | 72 65 63 74 6c 79 20 6f |work cor|rectly o|
|000048b0| 6e 20 74 68 65 20 70 79 | 72 61 6d 69 64 2e 0a 0a |n the py|ramid...|
|000048c0| 43 53 47 20 6f 62 6a 65 | 63 74 73 20 61 72 65 20 |CSG obje|cts are |
|000048d0| 73 70 65 63 69 66 69 65 | 64 20 62 79 20 73 75 72 |specifie|d by sur|
|000048e0| 72 6f 75 6e 64 69 6e 67 | 20 74 68 65 20 6f 62 6a |rounding| the obj|
|000048f0| 65 63 74 73 20 75 70 6f | 6e 0a 77 68 69 63 68 20 |ects upo|n.which |
|00004900| 74 6f 20 6f 70 65 72 61 | 74 65 2c 20 61 73 20 77 |to opera|te, as w|
|00004910| 65 6c 6c 20 61 73 20 61 | 6e 79 20 61 73 73 6f 63 |ell as a|ny assoc|
|00004920| 69 61 74 65 64 20 73 75 | 72 66 61 63 65 2d 62 69 |iated su|rface-bi|
|00004930| 6e 64 69 6e 67 20 63 6f | 6d 6d 61 6e 64 73 2c 0a |nding co|mmands,.|
|00004940| 62 79 20 74 68 65 20 6f | 70 65 72 61 74 6f 72 20 |by the o|perator |
|00004950| 76 65 72 62 20 6f 6e 20 | 6f 6e 65 20 73 69 64 65 |verb on |one side|
|00004960| 20 61 6e 64 20 74 68 65 | 20 7b 5c 74 74 20 65 6e | and the| {\tt en|
|00004970| 64 7d 0a 6b 65 79 77 6f | 72 64 20 6f 6e 20 74 68 |d}.keywo|rd on th|
|00004980| 65 20 6f 74 68 65 72 3a | 0a 0a 5c 62 65 67 69 6e |e other:|..\begin|
|00004990| 7b 64 65 66 6b 65 79 7d | 7b 75 6e 69 6f 6e 7d 7b |{defkey}|{union}{|
|000049a0| 24 3c 24 7b 5c 65 6d 20 | 4f 62 6a 65 63 74 7d 24 |$<${\em |Object}$|
|000049b0| 3e 24 20 24 3c 24 7b 5c | 65 6d 20 4f 62 6a 65 63 |>$ $<${\|em Objec|
|000049c0| 74 7d 24 3e 24 0a 5b 24 | 3c 24 7b 5c 65 6d 20 4f |t}$>$.[$|<${\em O|
|000049d0| 62 6a 65 63 74 7d 24 3e | 24 20 5c 6c 64 6f 74 73 |bject}$>|$ \ldots|
|000049e0| 5d 20 7b 5c 74 74 20 65 | 6e 64 7d 7d 0a 09 53 70 |] {\tt e|nd}}..Sp|
|000049f0| 65 63 69 66 79 20 61 20 | 6e 65 77 20 6f 62 6a 65 |ecify a |new obje|
|00004a00| 63 74 20 64 65 66 69 6e | 65 64 20 61 73 20 74 68 |ct defin|ed as th|
|00004a10| 65 20 75 6e 69 6f 6e 20 | 6f 66 20 74 68 65 0a 09 |e union |of the..|
|00004a20| 67 69 76 65 6e 20 6f 62 | 6a 65 63 74 73 2e 0a 5c |given ob|jects..\|
|00004a30| 65 6e 64 7b 64 65 66 6b | 65 79 7d 0a 0a 5c 62 65 |end{defk|ey}..\be|
|00004a40| 67 69 6e 7b 64 65 66 6b | 65 79 7d 7b 64 69 66 66 |gin{defk|ey}{diff|
|00004a50| 65 72 65 6e 63 65 7d 7b | 24 3c 24 7b 5c 65 6d 20 |erence}{|$<${\em |
|00004a60| 4f 62 6a 65 63 74 7d 24 | 3e 24 20 24 3c 24 7b 5c |Object}$|>$ $<${\|
|00004a70| 65 6d 20 4f 62 6a 65 63 | 74 7d 24 3e 24 20 0a 5b |em Objec|t}$>$ .[|
|00004a80| 24 3c 24 7b 5c 65 6d 20 | 4f 62 6a 65 63 74 7d 24 |$<${\em |Object}$|
|00004a90| 3e 24 20 5c 6c 64 6f 74 | 73 5d 20 7b 5c 74 74 20 |>$ \ldot|s] {\tt |
|00004aa0| 65 6e 64 7d 7d 0a 09 53 | 70 65 63 69 66 79 20 61 |end}}..S|pecify a|
|00004ab0| 20 6e 65 77 20 6f 62 6a | 65 63 74 20 64 65 66 69 | new obj|ect defi|
|00004ac0| 6e 65 64 20 61 73 20 74 | 68 65 20 64 69 66 66 65 |ned as t|he diffe|
|00004ad0| 72 65 6e 63 65 20 6f 66 | 20 74 68 65 0a 09 67 69 |rence of| the..gi|
|00004ae0| 76 65 6e 20 6f 62 6a 65 | 63 74 73 2e 0a 5c 65 6e |ven obje|cts..\en|
|00004af0| 64 7b 64 65 66 6b 65 79 | 7d 0a 0a 5c 62 65 67 69 |d{defkey|}..\begi|
|00004b00| 6e 7b 64 65 66 6b 65 79 | 7d 7b 69 6e 74 65 72 73 |n{defkey|}{inters|
|00004b10| 65 63 74 7d 7b 24 3c 24 | 7b 5c 65 6d 20 4f 62 6a |ect}{$<$|{\em Obj|
|00004b20| 65 63 74 7d 24 3e 24 20 | 24 3c 24 7b 5c 65 6d 20 |ect}$>$ |$<${\em |
|00004b30| 4f 62 6a 65 63 74 7d 24 | 3e 24 0a 5b 24 3c 24 7b |Object}$|>$.[$<${|
|00004b40| 5c 65 6d 20 4f 62 6a 65 | 63 74 7d 24 3e 24 20 5c |\em Obje|ct}$>$ \|
|00004b50| 6c 64 6f 74 73 5d 20 7b | 5c 74 74 20 65 6e 64 7d |ldots] {|\tt end}|
|00004b60| 7d 0a 09 53 70 65 63 69 | 66 79 20 61 20 6e 65 77 |}..Speci|fy a new|
|00004b70| 20 6f 62 6a 65 63 74 20 | 64 65 66 69 6e 65 64 20 | object |defined |
|00004b80| 61 73 20 74 68 65 20 69 | 6e 74 65 72 73 65 63 74 |as the i|ntersect|
|00004b90| 69 6f 6e 20 6f 66 20 74 | 68 65 0a 09 67 69 76 65 |ion of t|he..give|
|00004ba0| 6e 20 6f 62 6a 65 63 74 | 73 2e 0a 5c 65 6e 64 7b |n object|s..\end{|
|00004bb0| 64 65 66 6b 65 79 7d 0a | 0a 25 4e 6f 74 65 20 74 |defkey}.|.%Note t|
|00004bc0| 68 61 74 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |hat the |current |
|00004bd0| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 64 |implemen|tation d|
|00004be0| 6f 65 73 20 6e 6f 74 20 | 73 75 70 70 6f 72 74 20 |oes not |support |
|00004bf0| 6d 6f 72 65 20 74 68 61 | 74 20 74 77 6f 0a 25 6f |more tha|t two.%o|
|00004c00| 62 6a 65 63 74 73 20 69 | 6e 20 61 20 43 53 47 20 |bjects i|n a CSG |
|00004c10| 6c 69 73 74 20 28 62 75 | 74 20 69 74 20 69 73 20 |list (bu|t it is |
|00004c20| 70 6c 61 6e 6e 65 64 20 | 66 6f 72 20 61 20 66 75 |planned |for a fu|
|00004c30| 74 75 72 65 20 76 65 72 | 73 69 6f 6e 29 2e 0a 25 |ture ver|sion)..%|
|00004c40| 20 5b 20 74 68 69 73 20 | 69 73 20 6e 6f 20 6c 6f | [ this |is no lo|
|00004c50| 6e 67 65 72 20 74 72 75 | 65 2e 2e 2e 20 5d 0a 0a |nger tru|e... ]..|
|00004c60| 25 20 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |% The fo|llowing |
|00004c70| 61 72 65 6e 20 73 69 6d | 70 6c 65 20 43 53 47 20 |aren sim|ple CSG |
|00004c80| 6f 62 6a 65 63 74 73 20 | 75 73 69 6e 67 20 74 68 |objects |using th|
|00004c90| 65 20 66 6f 75 72 20 63 | 6f 6e 73 69 73 74 65 6e |e four c|onsisten|
|00004ca0| 74 0a 25 20 70 72 69 6d | 69 74 69 76 65 73 3a 0a |t.% prim|itives:.|
|00004cb0| 25 20 0a 25 20 75 6e 69 | 6f 6e 20 62 6f 78 20 2e |% .% uni|on box .|
|00004cc0| 2e 2e 20 64 69 66 66 65 | 72 65 6e 63 65 20 2e 2e |.. diffe|rence ..|
|00004cd0| 2e 0a 0a 5c 73 75 62 73 | 65 63 74 69 6f 6e 7b 50 |...\subs|ection{P|
|00004ce0| 6f 74 65 6e 74 69 61 6c | 20 43 53 47 20 50 72 6f |otential| CSG Pro|
|00004cf0| 62 6c 65 6d 73 7d 0a 0a | 41 20 63 6f 6e 73 69 73 |blems}..|A consis|
|00004d00| 74 65 6e 74 20 43 53 47 | 20 6d 6f 64 65 6c 20 69 |tent CSG| model i|
|00004d10| 73 20 6f 6e 65 20 77 68 | 69 63 68 20 69 73 20 6d |s one wh|ich is m|
|00004d20| 61 64 65 0a 75 70 20 6f | 66 20 73 6f 6c 69 64 20 |ade.up o|f solid |
|00004d30| 6f 62 6a 65 63 74 73 20 | 77 69 74 68 20 6e 6f 20 |objects |with no |
|00004d40| 64 61 6e 67 6c 69 6e 67 | 20 73 75 72 66 61 63 65 |dangling| surface|
|00004d50| 73 2e 20 20 49 6e 20 7b | 5c 72 61 79 73 68 61 64 |s. In {|\rayshad|
|00004d60| 65 7d 2c 0a 69 74 20 69 | 73 20 71 75 69 74 65 20 |e},.it i|s quite |
|00004d70| 65 61 73 79 20 74 6f 20 | 63 6f 6e 73 74 72 75 63 |easy to |construc|
|00004d80| 74 20 69 6e 63 6f 6e 73 | 69 73 74 65 6e 74 20 6d |t incons|istent m|
|00004d90| 6f 64 65 6c 73 2c 20 77 | 68 69 63 68 20 77 69 6c |odels, w|hich wil|
|00004da0| 6c 20 75 73 75 61 6c 6c | 79 0a 61 70 70 65 61 72 |l usuall|y.appear|
|00004db0| 20 69 6e 63 6f 72 72 65 | 63 74 20 69 6e 20 74 68 | incorre|ct in th|
|00004dc0| 65 20 66 69 6e 61 6c 20 | 69 6d 61 67 65 73 2e 0a |e final |images..|
|00004dd0| 49 6e 20 7b 5c 72 61 79 | 73 68 61 64 65 7d 2c 20 |In {\ray|shade}, |
|00004de0| 43 53 47 20 69 73 20 69 | 6d 70 6c 65 6d 65 6e 74 |CSG is i|mplement|
|00004df0| 65 64 20 62 79 20 6d 61 | 69 6e 74 61 69 6e 69 6e |ed by ma|intainin|
|00004e00| 67 0a 74 68 65 20 74 72 | 65 65 20 73 74 72 75 63 |g.the tr|ee struc|
|00004e10| 74 75 72 65 20 6f 66 20 | 74 68 65 20 43 53 47 20 |ture of |the CSG |
|00004e20| 6f 70 65 72 61 74 69 6f | 6e 73 2e 20 20 54 68 69 |operatio|ns. Thi|
|00004e30| 73 20 74 72 65 65 20 69 | 73 20 74 72 61 76 65 72 |s tree i|s traver|
|00004e40| 73 65 64 2c 0a 61 6e 64 | 20 74 68 65 20 6f 70 65 |sed,.and| the ope|
|00004e50| 72 61 74 6f 72 73 20 74 | 68 65 72 65 69 6e 20 61 |rators t|herein a|
|00004e60| 70 70 6c 69 65 64 2c 20 | 6f 6e 20 61 20 70 65 72 |pplied, |on a per|
|00004e70| 2d 72 61 79 20 62 61 73 | 69 73 2e 0a 49 74 20 69 |-ray bas|is..It i|
|00004e80| 73 20 74 68 65 72 65 66 | 6f 72 65 20 64 69 66 66 |s theref|ore diff|
|00004e90| 69 63 75 6c 74 20 74 6f | 20 76 65 72 69 66 79 20 |icult to| verify |
|00004ea0| 74 68 65 20 63 6f 6e 73 | 69 73 74 65 6e 63 79 20 |the cons|istency |
|00004eb0| 6f 66 0a 74 68 65 20 6d | 6f 64 65 6c 20 60 60 6f |of.the m|odel ``o|
|00004ec0| 6e 20 74 68 65 20 66 6c | 79 2e 27 27 0a 0a 4f 6e |n the fl|y.''..On|
|00004ed0| 65 20 63 6c 61 73 73 20 | 6f 66 20 43 53 47 20 70 |e class |of CSG p|
|00004ee0| 72 6f 62 6c 65 6d 73 20 | 6f 63 63 75 72 20 77 68 |roblems |occur wh|
|00004ef0| 65 6e 0a 73 75 72 66 61 | 63 65 73 20 6f 66 20 6f |en.surfa|ces of o|
|00004f00| 62 6a 65 63 74 73 20 62 | 65 69 6e 67 20 6f 70 65 |bjects b|eing ope|
|00004f10| 72 61 74 65 64 20 75 70 | 6f 6e 0a 63 6f 69 6e 63 |rated up|on.coinc|
|00004f20| 69 64 65 2e 20 20 46 6f | 72 20 65 78 61 6d 70 6c |ide. Fo|r exampl|
|00004f30| 65 2c 20 77 68 65 6e 20 | 73 75 62 74 72 61 63 74 |e, when |subtract|
|00004f40| 69 6e 67 20 61 20 62 6f | 78 20 66 72 6f 6d 20 61 |ing a bo|x from a|
|00004f50| 6e 6f 74 68 65 72 20 62 | 6f 78 20 74 6f 20 6d 61 |nother b|ox to ma|
|00004f60| 6b 65 20 61 0a 73 71 75 | 61 72 65 20 63 75 70 2c |ke a.squ|are cup,|
|00004f70| 20 74 68 65 20 72 65 73 | 75 6c 74 20 77 69 6c 6c | the res|ult will|
|00004f80| 20 62 65 20 77 72 6f 6e | 67 20 69 66 20 74 68 65 | be wron|g if the|
|00004f90| 20 74 6f 70 73 20 6f 66 | 20 74 68 65 20 74 77 6f | tops of| the two|
|00004fa0| 20 62 6f 78 65 73 0a 63 | 6f 69 6e 63 69 64 65 2e | boxes.c|oincide.|
|00004fb0| 20 20 54 6f 20 63 6f 72 | 72 65 63 74 20 74 68 69 | To cor|rect thi|
|00004fc0| 73 2c 20 74 68 65 20 69 | 6e 6e 65 72 20 62 6f 78 |s, the i|nner box|
|00004fd0| 20 73 68 6f 75 6c 64 20 | 62 65 20 6d 61 64 65 0a | should |be made.|
|00004fe0| 73 6c 69 67 68 74 6c 79 | 20 74 61 6c 6c 65 72 20 |slightly| taller |
|00004ff0| 74 68 61 6e 20 74 68 65 | 20 6f 75 74 65 72 20 62 |than the| outer b|
|00005000| 6f 78 2e 0a 41 20 72 65 | 6c 61 74 65 64 20 70 72 |ox..A re|lated pr|
|00005010| 6f 62 6c 65 6d 20 74 68 | 61 74 20 6d 75 73 74 20 |oblem th|at must |
|00005020| 62 65 0a 61 76 6f 69 64 | 65 64 20 6f 63 63 75 72 |be.avoid|ed occur|
|00005030| 73 20 77 68 65 6e 20 74 | 77 6f 20 63 6f 69 6e 63 |s when t|wo coinc|
|00005040| 69 64 65 6e 74 20 73 75 | 72 66 61 63 65 73 20 61 |ident su|rfaces a|
|00005050| 72 65 20 61 73 73 69 67 | 6e 65 64 0a 64 69 66 66 |re assig|ned.diff|
|00005060| 65 72 65 6e 74 20 73 75 | 72 66 61 63 65 20 70 72 |erent su|rface pr|
|00005070| 6f 70 65 72 74 69 65 73 | 2e 0a 0a 49 74 20 6d 61 |operties|...It ma|
|00005080| 79 20 73 65 65 6d 20 74 | 68 61 74 20 74 68 65 20 |y seem t|hat the |
|00005090| 75 6e 69 6f 6e 20 6f 70 | 65 72 61 74 6f 72 20 69 |union op|erator i|
|000050a0| 73 20 75 6e 6e 65 63 65 | 73 73 61 72 79 2c 20 73 |s unnece|ssary, s|
|000050b0| 69 6e 63 65 0a 6c 69 73 | 74 69 6e 67 20 74 77 6f |ince.lis|ting two|
|000050c0| 20 6f 62 6a 65 63 74 73 | 20 74 6f 67 65 74 68 65 | objects| togethe|
|000050d0| 72 20 69 6e 20 61 6e 20 | 61 67 67 72 65 67 61 74 |r in an |aggregat|
|000050e0| 65 20 72 65 73 75 6c 74 | 73 0a 69 6e 20 61 6e 20 |e result|s.in an |
|000050f0| 69 6d 61 67 65 20 74 68 | 61 74 20 61 70 70 65 61 |image th|at appea|
|00005100| 72 73 20 74 6f 20 62 65 | 20 74 68 65 20 73 61 6d |rs to be| the sam|
|00005110| 65 2e 0a 57 68 69 6c 65 | 20 74 68 65 20 72 65 73 |e..While| the res|
|00005120| 75 6c 74 20 6f 66 20 73 | 75 63 68 20 61 20 73 68 |ult of s|uch a sh|
|00005130| 6f 72 74 2d 63 75 74 0a | 6d 61 79 20 61 70 70 65 |ort-cut.|may appe|
|00005140| 61 72 20 74 68 65 20 73 | 61 6d 65 20 6f 6e 20 74 |ar the s|ame on t|
|00005150| 68 65 20 65 78 74 65 72 | 69 6f 72 2c 20 74 68 65 |he exter|ior, the|
|00005160| 20 69 6e 74 65 72 69 6f | 72 0a 6f 66 20 74 68 65 | interio|r.of the|
|00005170| 20 72 65 73 75 6c 74 69 | 6e 67 20 6f 62 6a 65 63 | resulti|ng objec|
|00005180| 74 20 77 69 6c 6c 20 63 | 6f 6e 74 61 69 6e 0a 65 |t will c|ontain.e|
|00005190| 78 74 72 61 6e 65 6f 75 | 73 20 73 75 72 66 61 63 |xtraneou|s surfac|
|000051a0| 65 73 2e 0a 54 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |es..The |followin|
|000051b0| 67 20 65 78 61 6d 70 6c | 65 73 20 73 68 6f 77 20 |g exampl|es show |
|000051c0| 74 68 69 73 20 71 75 69 | 74 65 20 63 6c 65 61 72 |this qui|te clear|
|000051d0| 6c 79 2e 0a 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |ly...\be|gin{verb|
|000051e0| 61 74 69 6d 7d 0a 20 20 | 20 20 64 69 66 66 65 72 |atim}. | differ|
|000051f0| 65 6e 63 65 0a 20 20 20 | 20 20 20 62 6f 78 20 2d |ence. | box -|
|00005200| 32 20 30 20 2d 33 20 20 | 32 20 33 20 33 0a 20 20 |2 0 -3 |2 3 3. |
|00005210| 20 20 20 20 75 6e 69 6f | 6e 20 20 2f 2a 20 63 68 | unio|n /* ch|
|00005220| 61 6e 67 65 20 74 6f 20 | 6c 69 73 74 3b 20 6e 6f |ange to |list; no|
|00005230| 74 65 20 62 61 64 20 69 | 6e 74 65 72 6e 61 6c 20 |te bad i|nternal |
|00005240| 73 75 72 66 61 63 65 73 | 20 2a 2f 0a 20 20 20 20 |surfaces| */. |
|00005250| 20 20 20 20 73 70 68 65 | 72 65 20 32 20 31 20 30 | sphe|re 2 1 0|
|00005260| 20 30 0a 20 20 20 20 20 | 20 20 20 73 70 68 65 72 | 0. | spher|
|00005270| 65 20 32 20 2d 31 20 30 | 20 30 0a 20 20 20 20 20 |e 2 -1 0| 0. |
|00005280| 20 65 6e 64 0a 20 20 20 | 20 65 6e 64 20 72 6f 74 | end. | end rot|
|00005290| 61 74 65 20 31 20 30 20 | 30 20 2d 34 30 20 20 72 |ate 1 0 |0 -40 r|
|000052a0| 6f 74 61 74 65 20 30 20 | 30 20 31 20 35 30 0a 5c |otate 0 |0 1 50.\|
|000052b0| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 0a 54 |end{verb|atim}..T|
|000052c0| 68 65 20 76 69 73 75 61 | 6c 20 65 76 69 64 65 6e |he visua|l eviden|
|000052d0| 63 65 20 6f 66 20 61 6e | 20 69 6e 63 6f 6e 73 69 |ce of an| inconsi|
|000052e0| 73 74 65 6e 74 20 43 53 | 47 20 6f 62 6a 65 63 74 |stent CS|G object|
|000052f0| 20 76 61 72 69 65 73 20 | 64 65 70 65 6e 64 69 6e | varies |dependin|
|00005300| 67 0a 75 70 6f 6e 20 74 | 68 65 20 6f 70 65 72 61 |g.upon t|he opera|
|00005310| 74 6f 72 20 62 65 69 6e | 67 20 75 73 65 64 2e 0a |tor bein|g used..|
|00005320| 57 68 65 6e 20 73 75 62 | 74 72 61 63 74 69 6e 67 |When sub|tracting|
|00005330| 20 61 20 63 6f 6e 73 69 | 73 74 65 6e 74 20 6f 62 | a consi|stent ob|
|00005340| 6a 65 63 74 20 66 72 6f | 6d 20 61 6e 64 0a 69 6e |ject fro|m and.in|
|00005350| 63 6f 6e 73 69 73 74 65 | 6e 74 20 6f 6e 65 2c 20 |consiste|nt one, |
|00005360| 74 68 65 20 72 65 73 75 | 6c 74 69 6e 67 20 6f 62 |the resu|lting ob|
|00005370| 6a 65 63 74 20 77 69 6c | 6c 20 61 70 70 65 61 72 |ject wil|l appear|
|00005380| 20 74 6f 20 62 65 0a 74 | 68 65 20 75 6e 69 6f 6e | to be.t|he union|
|00005390| 20 6f 66 20 74 68 65 20 | 74 77 6f 20 6f 62 6a 65 | of the |two obje|
|000053a0| 63 74 73 2c 20 62 75 74 | 20 74 68 65 20 73 68 61 |cts, but| the sha|
|000053b0| 64 69 6e 67 20 77 69 6c | 6c 20 62 65 20 69 6e 63 |ding wil|l be inc|
|000053c0| 6f 72 72 65 63 74 2e 0a | 49 74 20 77 69 6c 6c 20 |orrect..|It will |
|000053d0| 61 70 70 65 61 72 20 74 | 6f 20 62 65 20 69 6e 73 |appear t|o be ins|
|000053e0| 69 64 65 2d 6f 75 74 20 | 69 6e 20 70 6c 61 63 65 |ide-out |in place|
|000053f0| 73 2c 20 77 68 69 6c 65 | 20 63 6f 72 72 65 63 74 |s, while| correct|
|00005400| 0a 69 6e 20 6f 74 68 65 | 72 20 70 6c 61 63 65 73 |.in othe|r places|
|00005410| 2e 20 20 54 68 65 20 69 | 6e 73 69 64 65 2d 6f 75 |. The i|nside-ou|
|00005420| 74 20 73 65 63 74 69 6f | 6e 73 20 69 6e 64 69 63 |t sectio|ns indic|
|00005430| 61 74 65 20 74 68 65 20 | 61 72 65 61 73 0a 77 68 |ate the |areas.wh|
|00005440| 65 72 65 20 74 68 65 20 | 70 72 6f 62 6c 65 6d 73 |ere the |problems|
|00005450| 20 6f 63 63 75 72 2e 0a | 53 75 63 68 20 70 72 6f | occur..|Such pro|
|00005460| 62 6c 65 6d 73 20 61 72 | 65 20 6f 66 74 65 6e 20 |blems ar|e often |
|00005470| 63 61 75 73 65 64 20 62 | 79 0a 70 6f 6c 79 67 6f |caused b|y.polygo|
|00005480| 6e 73 20 77 69 74 68 20 | 69 6e 63 6f 72 72 65 63 |ns with |incorrec|
|00005490| 74 6c 79 20 73 70 65 63 | 69 66 69 65 64 0a 6e 6f |tly spec|ified.no|
|000054a0| 72 6d 61 6c 73 2c 20 6f | 72 20 62 79 20 73 75 72 |rmals, o|r by sur|
|000054b0| 66 61 63 65 73 20 74 68 | 61 74 20 65 78 61 63 74 |faces th|at exact|
|000054c0| 6c 79 20 63 6f 69 6e 63 | 69 64 65 20 28 77 68 69 |ly coinc|ide (whi|
|000054d0| 63 68 0a 61 70 70 65 61 | 72 20 61 73 20 70 61 72 |ch.appea|r as par|
|000054e0| 74 69 61 6c 20 60 60 53 | 77 69 73 73 20 63 68 65 |tial ``S|wiss che|
|000054f0| 65 73 65 27 27 20 6f 62 | 6a 65 63 74 73 29 2e 0a |ese'' ob|jects)..|
|00005500| 0a 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 65 |.The fol|lowing e|
|00005510| 78 61 6d 70 6c 65 20 69 | 6c 6c 75 73 74 72 61 74 |xample i|llustrat|
|00005520| 65 73 20 61 6e 20 61 74 | 74 65 6d 70 74 20 74 6f |es an at|tempt to|
|00005530| 20 73 75 62 74 72 61 63 | 74 20 61 20 73 70 68 65 | subtrac|t a sphe|
|00005540| 72 65 20 66 72 6f 6d 0a | 61 20 70 79 72 61 6d 69 |re from.|a pyrami|
|00005550| 64 20 64 65 66 69 6e 65 | 64 20 75 73 69 6e 67 20 |d define|d using |
|00005560| 61 6e 20 69 6e 63 6f 72 | 72 65 63 74 6c 79 20 66 |an incor|rectly f|
|00005570| 61 63 69 6e 67 20 74 72 | 69 61 6e 67 6c 65 2e 20 |acing tr|iangle. |
|00005580| 20 4e 6f 74 65 0a 74 68 | 61 74 20 74 68 65 20 72 | Note.th|at the r|
|00005590| 65 73 75 6c 74 69 6e 67 | 20 69 6d 61 67 65 20 6f |esulting| image o|
|000055a0| 62 76 69 6f 75 73 6c 79 | 20 70 6f 69 6e 74 73 20 |bviously| points |
|000055b0| 74 6f 20 77 68 69 63 68 | 20 74 72 69 61 6e 67 6c |to which| triangl|
|000055c0| 65 20 69 73 0a 72 65 76 | 65 72 73 65 64 2e 0a 0a |e is.rev|ersed...|
|000055d0| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|000055e0| 0a 20 20 20 20 6e 61 6d | 65 20 70 79 72 61 6d 69 |. nam|e pyrami|
|000055f0| 64 20 6c 69 73 74 0a 20 | 20 20 20 20 20 20 20 74 |d list. | t|
|00005600| 72 69 61 6e 67 6c 65 20 | 31 20 30 20 30 20 20 30 |riangle |1 0 0 0|
|00005610| 20 31 20 30 20 20 30 20 | 30 20 31 0a 20 20 20 20 | 1 0 0 |0 1. |
|00005620| 20 20 20 20 74 72 69 61 | 6e 67 6c 65 20 31 20 30 | tria|ngle 1 0|
|00005630| 20 30 20 20 30 20 30 20 | 30 20 20 30 20 31 20 30 | 0 0 0 |0 0 1 0|
|00005640| 0a 20 20 20 20 20 20 20 | 20 74 72 69 61 6e 67 6c |. | triangl|
|00005650| 65 20 30 20 31 20 30 20 | 20 30 20 30 20 30 20 20 |e 0 1 0 | 0 0 0 |
|00005660| 30 20 30 20 31 0a 20 20 | 20 20 20 20 20 20 74 72 |0 0 1. | tr|
|00005670| 69 61 6e 67 6c 65 20 30 | 20 30 20 31 20 20 31 20 |iangle 0| 0 1 1 |
|00005680| 30 20 30 20 20 30 20 30 | 20 30 20 20 2f 2a 20 77 |0 0 0 0| 0 /* w|
|00005690| 72 6f 6e 67 20 6f 72 64 | 65 72 20 2a 2f 0a 20 20 |rong ord|er */. |
|000056a0| 20 20 65 6e 64 0a 0a 20 | 20 20 20 64 69 66 66 65 | end.. | diffe|
|000056b0| 72 65 6e 63 65 0a 20 20 | 20 20 20 20 20 20 6f 62 |rence. | ob|
|000056c0| 6a 65 63 74 20 70 79 72 | 61 6d 69 64 20 73 63 61 |ject pyr|amid sca|
|000056d0| 6c 65 20 33 20 33 20 33 | 20 72 6f 74 61 74 65 20 |le 3 3 3| rotate |
|000056e0| 30 20 30 20 31 20 34 35 | 0a 20 20 20 20 20 20 20 |0 0 1 45|. |
|000056f0| 20 20 20 20 20 72 6f 74 | 61 74 65 20 31 20 30 20 | rot|ate 1 0 |
|00005700| 30 20 2d 33 30 20 74 72 | 61 6e 73 6c 61 74 65 20 |0 -30 tr|anslate |
|00005710| 30 20 2d 33 2e 35 20 30 | 0a 20 20 20 20 20 20 20 |0 -3.5 0|. |
|00005720| 20 73 70 68 65 72 65 20 | 32 2e 34 20 30 20 30 20 | sphere |2.4 0 0 |
|00005730| 30 0a 20 20 20 20 65 6e | 64 0a 5c 65 6e 64 7b 76 |0. en|d.\end{v|
|00005740| 65 72 62 61 74 69 6d 7d | 0a 0a 42 79 20 64 65 66 |erbatim}|..By def|
|00005750| 61 75 6c 74 2c 20 63 79 | 6c 69 6e 64 65 72 73 20 |ault, cy|linders |
|00005760| 61 6e 64 20 63 6f 6e 65 | 73 20 64 6f 20 6e 6f 74 |and cone|s do not|
|00005770| 20 68 61 76 65 20 65 6e | 64 20 63 61 70 73 2c 20 | have en|d caps, |
|00005780| 61 6e 64 20 74 68 75 73 | 0a 61 72 65 20 6e 6f 74 |and thus|.are not|
|00005790| 20 63 6f 6e 73 69 73 74 | 65 6e 74 20 70 72 69 6d | consist|ent prim|
|000057a0| 69 74 69 76 65 73 2e 20 | 20 4f 6e 65 20 6d 75 73 |itives. | One mus|
|000057b0| 74 20 75 73 75 61 6c 6c | 79 0a 61 64 64 20 65 6e |t usuall|y.add en|
|000057c0| 64 63 61 70 73 20 62 79 | 20 6c 69 73 74 69 6e 67 |dcaps by| listing|
|000057d0| 20 74 68 65 0a 63 79 6c | 69 6e 64 65 72 20 6f 72 | the.cyl|inder or|
|000057e0| 20 63 6f 6e 65 20 77 69 | 74 68 20 28 63 6f 72 72 | cone wi|th (corr|
|000057f0| 65 63 74 6c 79 2d 6f 72 | 69 65 6e 74 65 64 29 20 |ectly-or|iented) |
|00005800| 65 6e 64 63 61 70 20 64 | 69 73 63 73 20 69 6e 20 |endcap d|iscs in |
|00005810| 61 6e 20 61 67 67 72 65 | 67 61 74 65 2e 0a 0a 5c |an aggre|gate...\|
|00005820| 73 65 63 74 69 6f 6e 20 | 7b 4e 61 6d 65 64 20 4f |section |{Named O|
|00005830| 62 6a 65 63 74 73 7d 0a | 0a 41 20 6e 61 6d 65 20 |bjects}.|.A name |
|00005840| 6d 61 79 20 62 65 20 61 | 73 73 6f 63 69 61 74 65 |may be a|ssociate|
|00005850| 64 20 77 69 74 68 20 61 | 6e 79 20 70 72 69 6d 69 |d with a|ny primi|
|00005860| 74 69 76 65 2c 20 61 67 | 67 72 65 67 61 74 65 2c |tive, ag|gregate,|
|00005870| 20 6f 72 20 43 53 47 0a | 6f 62 6a 65 63 74 20 74 | or CSG.|object t|
|00005880| 68 72 6f 75 67 68 20 74 | 68 65 20 75 73 65 20 6f |hrough t|he use o|
|00005890| 66 20 74 68 65 20 7b 5c | 74 74 20 6e 61 6d 65 7d |f the {\|tt name}|
|000058a0| 0a 6b 65 79 77 6f 72 64 | 3a 0a 0a 5c 62 65 67 69 |.keyword|:..\begi|
|000058b0| 6e 7b 64 65 66 6b 65 79 | 7d 7b 6e 61 6d 65 7d 7b |n{defkey|}{name}{|
|000058c0| 7b 5c 65 6d 20 6f 62 6a | 6e 61 6d 65 7d 20 24 3c |{\em obj|name} $<|
|000058d0| 24 7b 5c 65 6d 20 49 6e | 73 74 61 6e 63 65 5c 2f |${\em In|stance\/|
|000058e0| 7d 24 3e 24 7d 0a 09 41 | 73 73 6f 63 69 61 74 65 |}$>$}..A|ssociate|
|000058f0| 20 7b 5c 65 6d 20 6f 62 | 6a 6e 61 6d 65 7d 20 77 | {\em ob|jname} w|
|00005900| 69 74 68 20 74 68 65 20 | 67 69 76 65 6e 20 6f 62 |ith the |given ob|
|00005910| 6a 65 63 74 2e 20 20 54 | 68 65 0a 09 73 70 65 63 |ject. T|he..spec|
|00005920| 69 66 69 65 64 20 6f 62 | 6a 65 63 74 20 69 73 20 |ified ob|ject is |
|00005930| 6e 6f 74 20 61 63 74 75 | 61 6c 6c 79 20 69 6e 73 |not actu|ally ins|
|00005940| 74 61 6e 74 69 61 74 65 | 64 3b 20 69 74 0a 09 69 |tantiate|d; it..i|
|00005950| 73 20 6f 6e 6c 79 20 73 | 74 6f 72 65 64 20 75 6e |s only s|tored un|
|00005960| 64 65 72 20 74 68 65 20 | 67 69 76 65 6e 20 6e 61 |der the |given na|
|00005970| 6d 65 2e 0a 5c 65 6e 64 | 7b 64 65 66 6b 65 79 7d |me..\end|{defkey}|
|00005980| 0a 0a 41 6e 20 6f 62 6a | 65 63 74 20 74 68 75 73 |..An obj|ect thus|
|00005990| 20 6e 61 6d 65 64 20 6d | 61 79 20 74 68 65 6e 20 | named m|ay then |
|000059a0| 62 65 20 69 6e 73 74 61 | 6e 74 69 61 74 65 64 20 |be insta|ntiated |
|000059b0| 28 77 69 74 68 20 70 6f | 73 73 69 62 6c 65 0a 61 |(with po|ssible.a|
|000059c0| 64 64 69 74 69 6f 6e 61 | 6c 20 74 72 61 6e 73 66 |dditiona|l transf|
|000059d0| 6f 72 6d 69 6e 67 20 61 | 6e 64 20 74 65 78 74 75 |orming a|nd textu|
|000059e0| 72 69 6e 67 29 20 76 69 | 61 20 74 68 65 20 7b 5c |ring) vi|a the {\|
|000059f0| 74 74 20 6f 62 6a 65 63 | 74 7d 20 6b 65 79 77 6f |tt objec|t} keywo|
|00005a00| 72 64 3a 0a 0a 5c 62 65 | 67 69 6e 7b 64 65 66 6b |rd:..\be|gin{defk|
|00005a10| 65 79 7d 7b 6f 62 6a 65 | 63 74 7d 7b 7b 5c 65 6d |ey}{obje|ct}{{\em|
|00005a20| 20 6f 62 6a 6e 61 6d 65 | 7d 20 5b 24 3c 24 54 72 | objname|} [$<$Tr|
|00005a30| 61 6e 73 66 6f 72 6d 61 | 74 69 6f 6e 73 24 3e 24 |ansforma|tions$>$|
|00005a40| 5d 20 5b 24 3c 24 54 65 | 78 74 75 72 65 73 24 3e |] [$<$Te|xtures$>|
|00005a50| 24 5d 7d 0a 09 49 6e 73 | 74 61 6e 74 69 61 74 65 |$]}..Ins|tantiate|
|00005a60| 20 61 20 63 6f 70 79 20 | 6f 66 20 74 68 65 20 6f | a copy |of the o|
|00005a70| 62 6a 65 63 74 20 61 73 | 73 6f 63 69 61 74 65 64 |bject as|sociated|
|00005a80| 20 77 69 74 68 20 7b 5c | 65 6d 20 6f 62 6a 6e 61 | with {\|em objna|
|00005a90| 6d 65 7d 2e 0a 09 49 66 | 20 67 69 76 65 6e 2c 20 |me}...If| given, |
|00005aa0| 74 68 65 20 74 72 61 6e | 73 66 6f 72 6d 61 74 69 |the tran|sformati|
|00005ab0| 6f 6e 73 20 61 6e 64 20 | 74 65 78 74 75 72 65 73 |ons and |textures|
|00005ac0| 20 61 72 65 20 63 6f 6d | 70 6f 73 65 64 0a 09 77 | are com|posed..w|
|00005ad0| 69 74 68 20 61 6e 79 20 | 61 6c 72 65 61 64 79 20 |ith any |already |
|00005ae0| 61 73 73 6f 63 69 61 74 | 65 64 20 77 69 74 68 0a |associat|ed with.|
|00005af0| 09 74 68 65 20 6f 62 6a | 65 63 74 20 62 65 69 6e |.the obj|ect bein|
|00005b00| 67 20 69 6e 73 74 61 6e | 74 69 61 74 65 64 2e 0a |g instan|tiated..|
|00005b10| 5c 65 6e 64 7b 64 65 66 | 6b 65 79 7d 0a |\end{def|key}. |
+--------+-------------------------+-------------------------+--------+--------+