home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: Mailbox/MIME Entity
(archive/mbox).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| Mailbox/MIME Entity (archive/mbox)
| magic
| Supported |
100%
| dexvert
| Internet Message Format (text/imf)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| Mailbox text, 1st line "From pat@mail.csh.rit.edu Sat Aug 6 17:09:13 1994"
| default
| |
99%
| file
| C source text
| default
| |
98%
| file
| C source, ASCII text
| default
| |
100%
| TrID
| E-Mail message (Var. 2)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| x-fmt/111 Plain Text File
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| application/mbox
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 46 72 6f 6d 20 70 61 74 | 40 6d 61 69 6c 2e 63 73 |From pat|@mail.cs|
|00000010| 68 2e 72 69 74 2e 65 64 | 75 20 53 61 74 20 41 75 |h.rit.ed|u Sat Au|
|00000020| 67 20 20 36 20 31 37 3a | 30 39 3a 31 33 20 31 39 |g 6 17:|09:13 19|
|00000030| 39 34 0a 4e 65 77 73 67 | 72 6f 75 70 73 3a 20 72 |94.Newsg|roups: r|
|00000040| 65 63 2e 67 61 6d 65 73 | 2e 70 72 6f 67 72 61 6d |ec.games|.program|
|00000050| 6d 65 72 2c 63 6f 6d 70 | 2e 67 72 61 70 68 69 63 |mer,comp|.graphic|
|00000060| 73 2c 72 65 63 2e 61 6e | 73 77 65 72 73 2c 63 6f |s,rec.an|swers,co|
|00000070| 6d 70 2e 61 6e 73 77 65 | 72 73 2c 6e 65 77 73 2e |mp.answe|rs,news.|
|00000080| 61 6e 73 77 65 72 73 0a | 46 72 6f 6d 3a 20 70 61 |answers.|From: pa|
|00000090| 74 40 6d 61 69 6c 2e 63 | 73 68 2e 72 69 74 2e 65 |t@mail.c|sh.rit.e|
|000000a0| 64 75 0a 53 75 62 6a 65 | 63 74 3a 20 46 41 51 3a |du.Subje|ct: FAQ:|
|000000b0| 20 33 2d 44 20 49 6e 66 | 6f 72 6d 61 74 69 6f 6e | 3-D Inf|ormation|
|000000c0| 20 66 6f 72 20 74 68 65 | 20 50 72 6f 67 72 61 6d | for the| Program|
|000000d0| 6d 65 72 0a 58 2d 41 72 | 63 68 69 76 65 2d 49 6e |mer.X-Ar|chive-In|
|000000e0| 66 6f 72 6d 61 74 69 6f | 6e 3a 20 2f 70 75 62 2f |formatio|n: /pub/|
|000000f0| 33 64 66 61 71 2f 46 41 | 51 2e 6e 20 40 20 66 74 |3dfaq/FA|Q.n @ ft|
|00000100| 70 2e 63 73 68 2e 72 69 | 74 2e 65 64 75 0a 46 6f |p.csh.ri|t.edu.Fo|
|00000110| 6c 6c 6f 77 75 70 2d 54 | 6f 3a 20 72 65 63 2e 67 |llowup-T|o: rec.g|
|00000120| 61 6d 65 73 2e 70 72 6f | 67 72 61 6d 6d 65 72 0a |ames.pro|grammer.|
|00000130| 53 75 6d 6d 61 72 79 3a | 20 53 74 69 6c 6c 20 69 |Summary:| Still i|
|00000140| 6e 20 70 72 6f 67 72 65 | 73 73 2c 20 66 69 6c 6c |n progre|ss, fill|
|00000150| 2d 69 6e 2d 74 68 65 2d | 62 6c 61 6e 6b 73 2e 2e |-in-the-|blanks..|
|00000160| 2e 0a 4f 72 69 67 69 6e | 61 74 6f 72 3a 20 70 61 |..Origin|ator: pa|
|00000170| 74 40 6e 69 63 6b 2e 63 | 73 68 2e 72 69 74 2e 65 |t@nick.c|sh.rit.e|
|00000180| 64 75 0a 4b 65 79 77 6f | 72 64 73 3a 20 67 61 6d |du.Keywo|rds: gam|
|00000190| 65 2d 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 33 64 |e-progra|mming 3d|
|000001a0| 2d 74 72 61 6e 73 66 6f | 72 6d 73 20 66 61 71 0a |-transfo|rms faq.|
|000001b0| 4e 6e 74 70 2d 50 6f 73 | 74 69 6e 67 2d 48 6f 73 |Nntp-Pos|ting-Hos|
|000001c0| 74 3a 20 6e 69 63 6b 2e | 63 73 68 2e 72 69 74 2e |t: nick.|csh.rit.|
|000001d0| 65 64 75 0a 52 65 70 6c | 79 2d 54 6f 3a 20 70 61 |edu.Repl|y-To: pa|
|000001e0| 74 40 6d 61 69 6c 2e 63 | 73 68 2e 72 69 74 2e 65 |t@mail.c|sh.rit.e|
|000001f0| 64 75 0a 4f 72 67 61 6e | 69 7a 61 74 69 6f 6e 3a |du.Organ|ization:|
|00000200| 20 43 6f 6d 70 75 74 65 | 72 20 53 63 69 65 6e 63 | Compute|r Scienc|
|00000210| 65 20 48 6f 75 73 65 20 | 40 20 52 49 54 0a 58 2d |e House |@ RIT.X-|
|00000220| 50 6f 73 74 69 6e 67 2d | 49 6e 66 6f 72 6d 61 74 |Posting-|Informat|
|00000230| 69 6f 6e 3a 20 54 68 69 | 73 20 61 72 74 69 63 6c |ion: Thi|s articl|
|00000240| 65 20 70 6f 73 74 65 64 | 20 61 75 74 6f 6d 61 67 |e posted| automag|
|00000250| 69 63 61 6c 6c 79 2c 20 | 77 65 65 6b 6c 79 2e 0a |ically, |weekly..|
|00000260| 44 61 74 65 3a 20 57 65 | 64 2c 20 33 20 41 75 67 |Date: We|d, 3 Aug|
|00000270| 20 31 39 39 34 20 30 38 | 3a 34 36 3a 30 32 20 47 | 1994 08|:46:02 G|
|00000280| 4d 54 0a 0a 41 72 63 68 | 69 76 65 2d 6e 61 6d 65 |MT..Arch|ive-name|
|00000290| 3a 20 33 64 2d 70 72 6f | 67 72 61 6d 6d 65 72 2d |: 3d-pro|grammer-|
|000002a0| 69 6e 66 6f 0a 56 65 72 | 73 69 6f 6e 3a 20 24 49 |info.Ver|sion: $I|
|000002b0| 64 3a 20 2e 68 65 61 64 | 65 72 2c 76 20 31 2e 38 |d: .head|er,v 1.8|
|000002c0| 20 31 39 39 34 2f 30 35 | 2f 32 33 20 31 35 3a 35 | 1994/05|/23 15:5|
|000002d0| 35 3a 35 39 20 70 61 74 | 20 45 78 70 20 70 61 74 |5:59 pat| Exp pat|
|000002e0| 20 24 0a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | $.. | |
|000002f0| 20 20 20 20 20 20 20 20 | 20 20 4f 20 20 20 20 20 | | O |
|00000300| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000310| 20 20 20 20 20 20 20 20 | 20 20 20 4f 0a 0a 20 2d | | O.. -|
|00000320| 2d 2d 2b 20 20 2b 2d 2d | 2d 2d 20 46 20 41 20 51 |--+ +--|-- F A Q|
|00000330| 20 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | -------|--------|
|00000340| 2d 2d 2d 2b 20 20 2b 2d | 2d 2d 2d 2d 2d 2d 20 46 |---+ +-|------ F|
|00000350| 20 41 20 51 20 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | A Q ---|--------|
|00000360| 2d 2d 2d 2d 2b 20 20 2b | 2d 2d 2d 0a 20 25 5b 25 |----+ +|---. %[%|
|00000370| 7c 20 20 7c 58 24 48 4f | 4f 52 24 48 5c 5b 5b 38 || |X$HO|OR$H\[[8|
|00000380| 40 44 6f 6f 6f 44 44 44 | 44 44 38 40 40 5b 25 5b |@DoooDDD|DD8@@[%[|
|00000390| 25 7c 20 20 7c 58 24 48 | 4f 4f 52 24 48 5c 5b 5b |%| |X$H|OOR$H\[[|
|000003a0| 38 40 44 6f 6f 6f 44 44 | 44 44 44 38 40 40 5b 25 |8@DoooDD|DDD8@@[%|
|000003b0| 5b 25 7c 20 20 7c 58 24 | 48 0a 20 5b 5b 25 7c 20 |[%| |X$|H. [[%| |
|000003c0| 20 7c 24 43 24 4f 4f 52 | 24 48 5c 25 5b 38 44 6f | |$C$OOR|$H\%[8Do|
|000003d0| 6f 6f 6f 44 44 44 44 38 | 44 40 40 5b 5b 5b 25 7c |oooDDDD8|D@@[[[%||
|000003e0| 20 20 7c 24 43 24 4f 4f | 52 24 48 5c 25 5b 38 44 | |$C$OO|R$H\%[8D|
|000003f0| 6f 6f 6f 6f 44 44 44 44 | 38 44 40 40 5b 5b 5b 25 |ooooDDDD|8D@@[[[%|
|00000400| 7c 20 20 7c 24 43 24 0a | 20 5b 5b 25 7c 20 20 7c || |$C$.| [[%| ||
|00000410| 58 24 48 48 52 52 24 48 | 40 5b 20 20 20 20 20 20 |X$HHRR$H|@[ |
|00000420| 20 20 20 20 20 20 38 38 | 40 40 5b 5b 25 7c 20 20 | 88|@@[[%| |
|00000430| 7c 58 24 48 48 52 52 20 | 20 20 20 20 20 20 20 20 ||X$HHRR | |
|00000440| 20 20 20 44 44 44 44 38 | 38 40 40 5b 5b 25 7c 20 | DDDD8|8@@[[%| |
|00000450| 20 7c 58 24 48 0a 20 5b | 5b 5b 7c 20 20 7c 24 24 | |X$H. [|[[| |$$|
|00000460| 24 48 52 52 24 48 40 25 | 5b 40 38 6f 6f 6f 6f 44 |$HRR$H@%|[@8ooooD|
|00000470| 20 20 20 38 38 38 40 5b | 5b 5b 5b 7c 20 20 7c 24 | 888@[|[[[| |$|
|00000480| 24 24 48 52 52 24 48 40 | 25 5b 40 38 6f 20 20 20 |$$HRR$H@|%[@8o |
|00000490| 44 44 44 44 38 38 38 40 | 5b 5b 5b 5b 7c 20 20 7c |DDDD888@|[[[[| ||
|000004a0| 24 24 24 0a 20 5b 5b 5b | 7c 20 20 7c 58 24 24 48 |$$$. [[[|| |X$$H|
|000004b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 20 20 20 | | / |
|000004c0| 2f 20 20 38 38 5b 5b 5b | 5b 7c 20 20 7c 58 24 20 |/ 88[[[|[| |X$ |
|000004d0| 20 20 20 20 20 20 20 20 | 20 2f 20 20 20 2f 20 20 | | / / |
|000004e0| 20 20 44 38 38 38 5b 5b | 5b 5b 7c 20 20 7c 58 24 | D888[[|[[| |X$|
|000004f0| 24 0a 20 5b 25 5b 7c 20 | 20 7c 58 43 24 48 20 20 |$. [%[| | |XC$H |
|00000500| 20 20 5c 25 5b 40 38 44 | 44 44 20 20 20 44 44 20 | \%[@8D|DD DD |
|00000510| 20 20 40 5b 5b 25 5b 7c | 20 20 7c 58 43 20 20 20 | @[[%[|| |XC |
|00000520| 20 24 48 5c 25 5b 40 20 | 20 20 44 44 44 44 20 20 | $H\%[@ | DDDD |
|00000530| 20 38 38 40 5b 5b 25 5b | 7c 20 20 7c 58 43 24 0a | 88@[[%[|| |XC$.|
|00000540| 20 5b 5b 25 7c 20 20 7c | 58 43 24 48 20 20 20 20 | [[%| ||XC$H |
|00000550| 5c 25 25 40 38 44 44 20 | 20 20 44 44 44 44 20 20 |\%%@8DD | DDDD |
|00000560| 20 40 5b 5b 25 7c 20 20 | 7c 58 43 20 20 20 20 24 | @[[%| ||XC $|
|00000570| 48 5c 25 25 20 20 20 44 | 44 44 44 44 44 20 20 20 |H\%% D|DDDDD |
|00000580| 38 40 40 5b 5b 25 7c 20 | 20 7c 58 43 24 0a 20 5b |8@@[[%| | |XC$. [|
|00000590| 25 5b 7c 20 20 7c 58 24 | 24 48 20 20 20 20 5c 25 |%[| |X$|$H \%|
|000005a0| 25 40 38 38 44 44 44 20 | 20 20 44 38 20 20 20 40 |%@88DDD | D8 @|
|000005b0| 5b 25 5b 7c 20 20 7c 58 | 24 20 20 20 20 24 48 5c |[%[| |X|$ $H\|
|000005c0| 25 25 40 38 20 20 20 44 | 44 44 38 20 20 20 38 40 |%%@8 D|DD8 8@|
|000005d0| 40 5b 25 5b 7c 20 20 7c | 58 24 24 0a 20 5b 25 5b |@[%[| ||X$$. [%[|
|000005e0| 7c 20 20 7c 43 58 24 48 | 20 20 20 20 5c 25 25 5b || |CX$H| \%%[|
|000005f0| 38 38 44 44 44 38 38 20 | 20 44 20 20 20 40 5b 25 |88DDD88 | D @[%|
|00000600| 5b 7c 20 20 7c 43 58 20 | 20 20 20 24 48 5c 25 25 |[| |CX | $H\%%|
|00000610| 5b 38 38 44 20 20 38 38 | 44 20 20 20 38 40 40 5b |[88D 88|D 8@@[|
|00000620| 25 5b 7c 20 20 7c 43 58 | 24 0a 20 5b 25 5b 7c 20 |%[| |CX|$. [%[| |
|00000630| 20 7c 58 24 43 48 20 20 | 20 20 5c 25 5b 5b 40 38 | |X$CH | \%[[@8|
|00000640| 38 38 44 38 44 38 20 20 | 7c 20 20 40 5b 25 5b 7c |88D8D8 || @[%[||
|00000650| 20 20 7c 58 24 20 20 20 | 5f 24 48 5c 25 5b 5b 40 | |X$ |_$H\%[[@|
|00000660| 38 38 38 20 20 38 38 20 | 20 20 38 38 40 5b 25 5b |888 88 | 88@[%[|
|00000670| 7c 20 20 7c 58 24 43 0a | 20 5b 25 5b 7c 20 20 7c || |X$C.| [%[| ||
|00000680| 58 58 43 48 20 20 20 20 | 7c 20 20 5b 40 38 38 38 |XXCH || [@888|
|00000690| 44 38 38 38 20 20 7c 20 | 40 40 5b 25 5b 7c 20 20 |D888 | |@@[%[| |
|000006a0| 7c 58 58 20 20 7c 20 20 | 48 5c 40 5b 5b 40 38 38 ||XX | |H\@[[@88|
|000006b0| 38 20 20 38 20 20 20 38 | 38 40 40 5b 25 5b 7c 20 |8 8 8|8@@[%[| |
|000006c0| 20 7c 58 58 43 0a 20 5b | 25 5b 7c 20 20 7c 58 43 | |XXC. [|%[| |XC|
|000006d0| 24 24 20 20 20 20 5c 20 | 20 5c 20 20 20 20 20 20 |$$ \ | \ |
|000006e0| 20 7c 20 20 7c 38 38 40 | 5b 25 5b 7c 20 20 7c 58 | | |88@|[%[| |X|
|000006f0| 43 20 20 5c 20 20 5c 20 | 20 20 20 20 20 20 7c 20 |C \ \ | | |
|00000700| 20 7c 20 20 38 38 38 38 | 40 5b 25 5b 7c 20 20 7c | | 8888|@[%[| ||
|00000710| 58 43 24 0a 20 5b 25 5b | 7c 20 20 7c 58 58 24 48 |XC$. [%[|| |XX$H|
|00000720| 4f 52 24 48 48 40 20 20 | 5b 40 38 38 38 38 38 20 |OR$HH@ |[@88888 |
|00000730| 20 38 44 38 40 40 5b 25 | 5b 7c 20 20 7c 58 58 24 | 8D8@@[%|[| |XX$|
|00000740| 48 4f 52 20 20 48 40 5b | 25 5b 40 38 20 20 40 38 |HOR H@[|%[@8 @8|
|00000750| 38 38 38 44 38 40 40 5b | 25 5b 7c 20 20 7c 58 58 |888D8@@[|%[| |XX|
|00000760| 24 0a 20 5b 25 5b 7c 20 | 20 7c 58 24 43 48 4f 52 |$. [%[| | |X$CHOR|
|00000770| 24 48 5c 40 25 20 20 40 | 40 40 40 59 20 20 38 38 |$H\@% @|@@@Y 88|
|00000780| 38 38 40 40 5b 25 5b 7c | 20 20 7c 58 24 43 48 4f |88@@[%[|| |X$CHO|
|00000790| 52 24 20 20 40 25 25 5b | 59 20 20 40 38 38 38 38 |R$ @%%[|Y @8888|
|000007a0| 38 38 38 40 40 5b 25 5b | 7c 20 20 7c 58 24 43 0a |888@@[%[|| |X$C.|
|000007b0| 20 5b 25 5b 7c 20 20 7c | 43 58 24 24 4f 52 24 48 | [%[| ||CX$$OR$H|
|000007c0| 48 40 25 25 20 20 20 20 | 20 20 2e 64 38 44 38 38 |H@%% | .d8D88|
|000007d0| 40 40 5b 25 5b 7c 20 20 | 7c 43 58 24 24 4f 52 24 |@@[%[| ||CX$$OR$|
|000007e0| 48 20 20 20 20 20 20 2e | 64 40 40 38 38 38 44 38 |H .|d@@888D8|
|000007f0| 38 40 40 5b 25 5b 7c 20 | 20 7c 43 58 24 0a 20 5b |8@@[%[| | |CX$. [|
|00000800| 5b 5b 7c 20 20 7c 58 24 | 24 48 4f 52 24 48 48 40 |[[| |X$|$HOR$HH@|
|00000810| 25 25 5b 5b 40 40 40 40 | 38 38 44 38 44 38 38 40 |%%[[@@@@|88D8D88@|
|00000820| 5b 5b 5b 7c 20 20 7c 58 | 24 24 48 4f 52 24 48 48 |[[[| |X|$$HOR$HH|
|00000830| 40 25 25 5b 5b 40 40 40 | 40 38 38 44 38 44 38 38 |@%%[[@@@|@88D8D88|
|00000840| 40 5b 5b 5b 7c 20 20 7c | 58 24 24 0a 20 5b 25 5b |@[[[| ||X$$. [%[|
|00000850| 7c 20 20 7c 43 58 24 48 | 4f 52 24 48 48 5c 25 5b || |CX$H|OR$HH\%[|
|00000860| 25 5b 40 40 40 40 38 38 | 38 44 38 38 40 40 5b 25 |%[@@@@88|8D88@@[%|
|00000870| 5b 7c 20 20 7c 43 58 24 | 48 4f 52 24 48 48 5c 25 |[| |CX$|HOR$HH\%|
|00000880| 5b 25 5b 40 40 40 40 38 | 38 38 44 38 38 40 40 5b |[%[@@@@8|88D88@@[|
|00000890| 25 5b 7c 20 20 7c 43 58 | 24 0a 20 2d 2d 2d 2b 20 |%[| |CX|$. ---+ |
|000008a0| 20 2b 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | +------|--------|
|000008b0| 2d 20 46 20 41 20 51 20 | 2d 2d 2d 2d 2d 2d 2d 2b |- F A Q |-------+|
|000008c0| 20 20 2b 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | +-----|--------|
|000008d0| 2d 2d 2d 2d 2d 20 46 20 | 41 20 51 20 2d 2d 2d 2d |----- F |A Q ----|
|000008e0| 2b 20 20 2b 2d 2d 2d 0a | 0a 43 6f 6e 74 65 6e 74 |+ +---.|.Content|
|000008f0| 73 3a 0a 31 29 20 47 65 | 6e 65 72 61 6c 20 72 65 |s:.1) Ge|neral re|
|00000900| 66 65 72 65 6e 63 65 73 | 20 66 6f 72 20 33 2d 64 |ferences| for 3-d|
|00000910| 20 67 72 61 70 68 69 63 | 73 20 71 75 65 73 74 69 | graphic|s questi|
|00000920| 6f 6e 73 2e 0a 32 29 20 | 48 6f 77 20 64 6f 20 49 |ons..2) |How do I|
|00000930| 20 64 65 66 69 6e 65 20 | 61 6e 20 6f 62 6a 65 63 | define |an objec|
|00000940| 74 3f 0a 33 29 20 48 6f | 77 20 64 6f 20 49 20 64 |t?.3) Ho|w do I d|
|00000950| 65 66 69 6e 65 20 73 70 | 61 63 65 3f 0a 34 29 20 |efine sp|ace?.4) |
|00000960| 48 6f 77 20 64 6f 20 49 | 20 64 65 66 69 6e 65 20 |How do I| define |
|00000970| 70 6f 73 69 74 69 6f 6e | 3f 0a 35 29 20 48 6f 77 |position|?.5) How|
|00000980| 20 64 6f 20 49 20 64 65 | 66 69 6e 65 20 6f 72 69 | do I de|fine ori|
|00000990| 65 6e 74 61 74 69 6f 6e | 3f 0a 36 29 20 48 6f 77 |entation|?.6) How|
|000009a0| 20 64 6f 20 49 20 64 65 | 66 69 6e 65 20 61 20 76 | do I de|fine a v|
|000009b0| 65 6c 6f 63 69 74 79 3f | 0a 37 29 20 44 72 61 77 |elocity?|.7) Draw|
|000009c0| 69 6e 67 20 74 68 72 65 | 65 2d 64 69 6d 65 6e 73 |ing thre|e-dimens|
|000009d0| 69 6f 6e 61 6c 20 6f 62 | 6a 65 63 74 73 20 6f 6e |ional ob|jects on|
|000009e0| 20 61 20 74 77 6f 2d 64 | 69 6d 65 6e 73 69 6f 6e | a two-d|imension|
|000009f0| 61 6c 20 73 63 72 65 65 | 6e 2e 0a 38 29 20 56 65 |al scree|n..8) Ve|
|00000a00| 63 74 6f 72 20 4d 61 74 | 68 20 2d 20 44 6f 74 20 |ctor Mat|h - Dot |
|00000a10| 50 72 6f 64 75 63 74 20 | 61 6e 64 20 43 72 6f 73 |Product |and Cros|
|00000a20| 73 2d 50 72 6f 64 75 63 | 74 2e 0a 39 29 20 4d 61 |s-Produc|t..9) Ma|
|00000a30| 74 72 69 78 20 4d 61 74 | 68 0a 31 30 29 20 43 6f |trix Mat|h.10) Co|
|00000a40| 6c 6c 69 73 69 6f 6e 73 | 2e 0a 31 31 29 20 50 65 |llisions|..11) Pe|
|00000a50| 72 73 70 65 63 74 69 76 | 65 2e 0a 31 32 29 20 5a |rspectiv|e..12) Z|
|00000a60| 2d 42 75 66 66 65 72 69 | 6e 67 20 26 20 74 68 65 |-Bufferi|ng & the|
|00000a70| 20 50 61 69 6e 74 65 72 | 73 20 41 6c 67 6f 72 69 | Painter|s Algori|
|00000a80| 74 68 6d 20 26 20 42 53 | 50 2d 54 72 65 65 73 2e |thm & BS|P-Trees.|
|00000a90| 0a 31 33 29 20 53 68 61 | 64 69 6e 67 2e 0a 31 34 |.13) Sha|ding..14|
|00000aa0| 29 20 33 2d 73 70 61 63 | 65 20 63 6c 69 70 70 69 |) 3-spac|e clippi|
|00000ab0| 6e 67 2e 0a 31 35 29 20 | 33 2d 64 20 73 63 61 6e |ng..15) |3-d scan|
|00000ac0| 6e 69 6e 67 2e 0a 31 36 | 29 20 50 75 62 6c 69 63 |ning..16|) Public|
|00000ad0| 61 6c 6c 79 20 61 76 61 | 69 6c 61 62 6c 65 20 73 |ally ava|ilable s|
|00000ae0| 6f 75 72 63 65 2d 63 6f | 64 65 2e 0a 31 37 29 20 |ource-co|de..17) |
|00000af0| 42 6f 6f 6b 73 20 6f 6e | 20 74 68 65 20 74 6f 70 |Books on| the top|
|00000b00| 69 63 73 2e 0a 31 38 29 | 20 4f 74 68 65 72 20 66 |ics..18)| Other f|
|00000b10| 6f 72 75 6d 73 2e 0a 31 | 39 29 20 43 75 72 72 65 |orums..1|9) Curre|
|00000b20| 6e 74 20 43 6f 6e 74 65 | 6e 74 73 20 6f 66 20 41 |nt Conte|nts of A|
|00000b30| 72 63 68 69 76 65 20 66 | 74 70 2e 63 73 68 2e 72 |rchive f|tp.csh.r|
|00000b40| 69 74 2e 65 64 75 3a 3a | 2f 70 75 62 2f 33 64 66 |it.edu::|/pub/3df|
|00000b50| 61 71 0a 0a 4c 61 73 74 | 20 75 70 64 61 74 65 3a |aq..Last| update:|
|00000b60| 0a 20 20 20 20 20 32 33 | 4d 61 79 39 34 0a 0a 57 |. 23|May94..W|
|00000b70| 68 61 74 27 73 20 6e 65 | 77 3f 0a 0a 20 20 20 20 |hat's ne|w?.. |
|00000b80| 20 44 65 73 63 72 69 70 | 74 69 6f 6e 20 6f 66 20 | Descrip|tion of |
|00000b90| 5a 2d 42 75 66 66 65 72 | 69 6e 67 2c 20 50 61 69 |Z-Buffer|ing, Pai|
|00000ba0| 6e 74 65 72 27 73 20 41 | 6c 67 6f 72 69 74 68 6d |nter's A|lgorithm|
|00000bb0| 2c 20 61 6e 64 20 42 53 | 50 2d 74 72 65 65 73 2e |, and BS|P-trees.|
|00000bc0| 0a 0a 31 29 20 47 65 6e | 65 72 61 6c 20 72 65 66 |..1) Gen|eral ref|
|00000bd0| 65 72 65 6e 63 65 73 20 | 66 6f 72 20 33 2d 64 20 |erences |for 3-d |
|00000be0| 67 72 61 70 68 69 63 73 | 20 71 75 65 73 74 69 6f |graphics| questio|
|00000bf0| 6e 73 2e 0a 0a 20 20 20 | 20 20 57 65 6c 6c 2c 20 |ns... | Well, |
|00000c00| 74 68 69 73 20 46 41 51 | 20 69 73 20 6a 75 73 74 |this FAQ| is just|
|00000c10| 20 67 65 74 74 69 6e 67 | 20 6f 66 66 20 74 68 65 | getting| off the|
|00000c20| 20 67 72 6f 75 6e 64 2e | 20 20 48 6f 70 65 66 75 | ground.| Hopefu|
|00000c30| 6c 6c 79 20 69 74 20 77 | 69 6c 6c 0a 74 6f 75 63 |lly it w|ill.touc|
|00000c40| 68 20 6f 6e 20 6d 6f 73 | 74 20 6f 66 20 74 68 65 |h on mos|t of the|
|00000c50| 20 62 61 73 65 73 20 79 | 6f 75 20 6e 65 65 64 20 | bases y|ou need |
|00000c60| 74 6f 20 67 65 74 20 73 | 74 61 72 74 65 64 20 66 |to get s|tarted f|
|00000c70| 6f 72 20 6e 6f 77 2c 20 | 61 6e 64 0a 68 6f 70 65 |or now, |and.hope|
|00000c80| 66 75 6c 6c 79 20 69 74 | 20 77 69 6c 6c 20 65 78 |fully it| will ex|
|00000c90| 70 61 6e 64 20 61 74 20 | 6c 65 61 73 74 20 61 73 |pand at |least as|
|00000ca0| 20 66 61 73 74 20 61 73 | 20 79 6f 75 20 6e 65 65 | fast as| you nee|
|00000cb0| 64 20 69 74 20 74 6f 6f | 2e 20 20 42 75 74 2e 2e |d it too|. But..|
|00000cc0| 2e 0a 72 65 67 61 72 64 | 6c 65 73 73 2c 20 74 68 |..regard|less, th|
|00000cd0| 69 6e 67 73 20 79 6f 75 | 27 6c 6c 20 77 61 6e 74 |ings you|'ll want|
|00000ce0| 20 74 6f 20 6c 6f 63 61 | 74 65 20 66 6f 72 20 6d | to loca|te for m|
|00000cf0| 6f 72 65 20 68 65 6c 70 | 20 61 72 65 20 4d 61 74 |ore help| are Mat|
|00000d00| 72 69 78 0a 41 6c 67 65 | 62 72 61 20 62 6f 6f 6b |rix.Alge|bra book|
|00000d10| 73 2c 20 50 68 79 73 69 | 63 73 20 62 6f 6f 6b 73 |s, Physi|cs books|
|00000d20| 20 74 61 6c 6b 69 6e 67 | 20 61 62 6f 75 74 20 45 | talking| about E|
|00000d30| 75 6c 65 72 69 61 6e 20 | 6d 6f 74 69 6f 6e 2c 20 |ulerian |motion, |
|00000d40| 61 6e 64 20 73 6f 6d 65 | 0a 62 6f 6f 6b 73 20 6f |and some|.books o|
|00000d50| 6e 20 74 68 65 20 47 72 | 61 70 68 69 63 73 20 48 |n the Gr|aphics H|
|00000d60| 61 72 64 77 61 72 65 20 | 79 6f 75 20 77 61 6e 74 |ardware |you want|
|00000d70| 20 74 6f 20 70 72 6f 67 | 72 61 6d 20 66 6f 72 2e | to prog|ram for.|
|00000d80| 20 20 54 68 65 20 63 6f | 64 65 0a 65 78 61 6d 70 | The co|de.examp|
|00000d90| 6c 65 73 20 69 6e 63 6c | 75 64 65 64 20 69 6e 20 |les incl|uded in |
|00000da0| 74 68 69 73 20 46 41 51 | 20 77 69 6c 6c 20 6d 6f |this FAQ| will mo|
|00000db0| 73 74 20 6c 69 6b 65 6c | 79 20 62 65 20 69 6e 20 |st likel|y be in |
|00000dc0| 43 20 77 69 74 68 20 70 | 73 65 75 64 6f 2d 63 6f |C with p|seudo-co|
|00000dd0| 64 65 0a 69 6e 20 63 6f | 6d 6d 65 6e 74 73 2e 0a |de.in co|mments..|
|00000de0| 0a 20 20 20 20 20 4f 6e | 65 20 6f 66 20 74 68 65 |. On|e of the|
|00000df0| 20 6d 6f 73 74 20 70 6f | 70 75 6c 61 72 20 72 65 | most po|pular re|
|00000e00| 66 65 72 65 6e 63 65 73 | 2c 20 28 61 6e 64 20 6f |ferences|, (and o|
|00000e10| 6e 65 20 6f 66 20 6d 79 | 20 66 61 76 6f 72 69 74 |ne of my| favorit|
|00000e20| 65 73 29 2c 20 69 73 3a | 0a 20 20 20 20 20 20 20 |es), is:|. |
|00000e30| 20 20 20 43 6f 6d 70 75 | 74 65 72 20 47 72 61 70 | Compu|ter Grap|
|00000e40| 68 69 63 73 3a 20 50 72 | 69 6e 63 69 70 6c 65 73 |hics: Pr|inciples|
|00000e50| 20 61 6e 64 20 50 72 61 | 63 74 69 63 65 0a 20 20 | and Pra|ctice. |
|00000e60| 20 20 20 20 20 20 20 20 | 2d 2d 2d 2d 2d 2d 2d 2d | |--------|
|00000e70| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000e80| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000e90| 2d 2d 0a 20 20 20 20 20 | 20 20 20 20 20 46 6f 6c |--. | Fol|
|00000ea0| 65 79 2c 20 76 61 6e 20 | 44 61 6d 2c 20 46 65 69 |ey, van |Dam, Fei|
|00000eb0| 6e 65 72 2c 20 61 6e 64 | 20 48 75 67 68 65 73 0a |ner, and| Hughes.|
|00000ec0| 20 20 20 20 20 20 20 20 | 20 20 41 64 64 69 73 6f | | Addiso|
|00000ed0| 6e 20 57 65 73 6c 65 79 | 20 2d 2d 20 52 65 61 64 |n Wesley| -- Read|
|00000ee0| 69 6e 67 2c 20 4d 61 73 | 73 61 63 68 75 73 65 74 |ing, Mas|sachuset|
|00000ef0| 74 73 0a 20 20 20 20 20 | 20 20 20 20 20 28 63 29 |ts. | (c)|
|00000f00| 20 31 39 39 30 2e 20 20 | 49 53 42 4e 20 30 2d 32 | 1990. |ISBN 0-2|
|00000f10| 30 31 2d 31 32 31 31 30 | 2d 37 0a 0a 20 20 20 20 |01-12110|-7.. |
|00000f20| 20 42 75 74 2c 20 79 6f | 75 27 6c 6c 20 61 6c 73 | But, yo|u'll als|
|00000f30| 6f 20 77 61 6e 74 20 74 | 6f 20 64 65 66 69 6e 69 |o want t|o defini|
|00000f40| 74 65 6c 79 20 63 68 65 | 63 6b 20 6f 75 74 20 74 |tely che|ck out t|
|00000f50| 68 65 20 46 41 51 20 66 | 6f 72 0a 63 6f 6d 70 2e |he FAQ f|or.comp.|
|00000f60| 67 72 61 70 68 69 63 73 | 2e 20 20 54 68 61 74 20 |graphics|. That |
|00000f70| 46 41 51 20 74 6f 75 63 | 68 65 73 20 6d 61 69 6e |FAQ touc|hes main|
|00000f80| 6c 79 20 6f 6e 20 32 2d | 44 20 6e 65 65 64 73 2c |ly on 2-|D needs,|
|00000f90| 20 62 75 74 20 73 6f 6d | 65 20 33 2d 44 0a 61 73 | but som|e 3-D.as|
|00000fa0| 70 65 63 74 73 20 61 72 | 65 20 72 65 76 69 65 77 |pects ar|e review|
|00000fb0| 65 64 20 74 68 65 72 65 | 2c 20 74 6f 6f 2e 0a 0a |ed there|, too...|
|00000fc0| 32 29 20 48 6f 77 20 64 | 6f 20 49 20 64 65 66 69 |2) How d|o I defi|
|00000fd0| 6e 65 20 61 6e 20 6f 62 | 6a 65 63 74 3f 0a 0a 20 |ne an ob|ject?.. |
|00000fe0| 20 20 20 20 54 68 65 72 | 65 20 61 72 65 20 6c 6f | Ther|e are lo|
|00000ff0| 74 73 20 6f 66 20 77 61 | 79 73 20 74 6f 20 64 65 |ts of wa|ys to de|
|00001000| 66 69 6e 65 20 6f 62 6a | 65 63 74 73 2e 20 20 4f |fine obj|ects. O|
|00001010| 6e 65 20 6f 66 20 74 68 | 65 20 6d 6f 73 74 20 63 |ne of th|e most c|
|00001020| 6f 6d 6d 6f 6e 6c 79 0a | 75 73 65 64 20 69 73 20 |ommonly.|used is |
|00001030| 74 68 65 20 4f 46 46 20 | 28 4f 62 6a 65 63 74 20 |the OFF |(Object |
|00001040| 46 69 6c 65 20 46 6f 72 | 6d 61 74 29 2e 20 20 54 |File For|mat). T|
|00001050| 68 65 20 4f 46 46 20 74 | 6f 6f 6c 6b 69 74 20 61 |he OFF t|oolkit a|
|00001060| 6e 64 20 61 20 6c 69 62 | 72 61 72 79 20 6f 66 0a |nd a lib|rary of.|
|00001070| 6f 62 6a 65 63 74 73 20 | 61 72 65 20 61 76 61 69 |objects |are avai|
|00001080| 6c 61 62 6c 65 20 76 69 | 61 20 61 6e 6f 6e 79 6d |lable vi|a anonym|
|00001090| 6f 75 73 20 66 74 70 20 | 66 72 6f 6d 20 67 61 74 |ous ftp |from gat|
|000010a0| 65 6b 65 65 70 65 72 2e | 64 65 63 2e 63 6f 6d 20 |ekeeper.|dec.com |
|000010b0| 2d 2d 20 58 58 58 0a 3f | 3f 3f 20 28 49 20 63 61 |-- XXX.?|?? (I ca|
|000010c0| 6e 27 74 20 66 69 6e 64 | 20 69 74 20 61 6e 79 6d |n't find| it anym|
|000010d0| 6f 72 65 2e 20 20 49 20 | 66 6f 75 6e 64 20 69 74 |ore. I |found it|
|000010e0| 20 68 65 72 65 20 6f 6e | 63 65 20 61 62 6f 75 74 | here on|ce about|
|000010f0| 20 32 20 79 65 61 72 73 | 20 61 67 6f 2c 0a 62 75 | 2 years| ago,.bu|
|00001100| 74 20 49 20 68 61 76 65 | 6e 27 74 20 66 6f 75 6e |t I have|n't foun|
|00001110| 64 20 69 74 20 73 69 6e | 63 65 29 2e 20 20 54 68 |d it sin|ce). Th|
|00001120| 65 20 66 6f 72 6d 61 74 | 20 70 72 6f 76 69 64 65 |e format| provide|
|00001130| 73 20 65 61 73 79 20 6d | 65 74 68 6f 64 73 20 66 |s easy m|ethods f|
|00001140| 6f 72 0a 65 78 74 65 6e | 73 69 6f 6e 73 20 61 6e |or.exten|sions an|
|00001150| 64 20 61 20 62 61 73 65 | 20 73 65 74 20 6f 66 20 |d a base| set of |
|00001160| 74 68 69 6e 67 73 20 79 | 6f 75 20 63 61 6e 20 65 |things y|ou can e|
|00001170| 78 70 65 63 74 20 66 6f | 72 20 65 61 63 68 20 6f |xpect fo|r each o|
|00001180| 62 6a 65 63 74 2e 20 20 | 54 68 65 0a 74 6f 6f 6c |bject. |The.tool|
|00001190| 6b 69 74 20 69 73 20 61 | 20 62 69 74 20 62 75 6c |kit is a| bit bul|
|000011a0| 6b 79 2c 20 62 75 74 20 | 74 68 65 20 66 69 6c 65 |ky, but |the file|
|000011b0| 20 66 6f 72 6d 61 74 20 | 28 69 6e 20 61 73 63 69 | format |(in asci|
|000011c0| 69 29 20 69 73 20 65 61 | 73 79 20 65 6e 6f 75 67 |i) is ea|sy enoug|
|000011d0| 68 20 74 6f 0a 70 61 72 | 73 65 20 62 79 20 68 61 |h to.par|se by ha|
|000011e0| 6e 64 2e 0a 0a 20 20 20 | 20 20 54 68 65 20 4f 46 |nd... | The OF|
|000011f0| 46 2e 61 6f 66 66 20 66 | 69 6c 65 20 63 6f 6e 74 |F.aoff f|ile cont|
|00001200| 61 69 6e 73 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |ains inf|ormation|
|00001210| 20 61 62 6f 75 74 20 74 | 68 65 20 6f 62 6a 65 63 | about t|he objec|
|00001220| 74 2e 20 20 54 68 65 20 | 6d 6f 73 74 0a 69 6d 70 |t. The |most.imp|
|00001230| 6f 72 74 61 6e 74 20 6f | 6e 65 20 74 68 65 72 65 |ortant o|ne there|
|00001240| 20 69 73 20 74 68 65 20 | 6c 6f 63 61 74 69 6f 6e | is the |location|
|00001250| 20 6f 66 20 74 68 65 20 | 73 75 72 66 61 63 65 20 | of the |surface |
|00001260| 73 70 65 63 69 66 69 63 | 61 74 69 6f 6e 20 66 69 |specific|ation fi|
|00001270| 6c 65 0a 28 75 73 75 61 | 6c 6c 79 20 6f 62 6a 65 |le.(usua|lly obje|
|00001280| 63 74 20 6e 61 6d 65 2e | 67 65 6f 6d 29 2e 20 20 |ct name.|geom). |
|00001290| 54 68 69 73 20 66 69 6c | 65 20 61 6c 73 6f 20 63 |This fil|e also c|
|000012a0| 6f 6e 74 61 69 6e 73 20 | 6f 74 68 65 72 20 61 74 |ontains |other at|
|000012b0| 74 72 69 62 75 74 65 73 | 0a 20 20 20 20 20 20 20 |tributes|. |
|000012c0| 20 20 20 20 20 20 20 20 | 2d 0a 61 6e 64 20 66 69 | |-.and fi|
|000012d0| 6c 65 20 6e 61 6d 65 73 | 20 72 65 6c 65 76 61 6e |le names| relevan|
|000012e0| 74 20 74 6f 20 74 68 69 | 73 20 6f 62 6a 65 63 74 |t to thi|s object|
|000012f0| 2e 0a 0a 20 20 20 20 20 | 54 68 65 20 4f 46 46 20 |... |The OFF |
|00001300| 73 75 72 66 61 63 65 20 | 73 70 65 63 69 66 69 63 |surface |specific|
|00001310| 61 74 69 6f 6e 20 62 65 | 67 69 6e 73 20 77 69 74 |ation be|gins wit|
|00001320| 68 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |h the nu|mber of |
|00001330| 70 6f 69 6e 74 73 2c 20 | 74 68 65 0a 6e 75 6d 62 |points, |the.numb|
|00001340| 65 72 20 6f 66 20 70 6f | 6c 79 67 6f 6e 73 20 61 |er of po|lygons a|
|00001350| 6e 64 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |nd the n|umber of|
|00001360| 20 73 65 67 6d 65 6e 74 | 73 2e 0a 0a 20 20 20 20 | segment|s... |
|00001370| 20 20 20 20 6e 70 74 73 | 20 6e 70 6c 79 73 20 6e | npts| nplys n|
|00001380| 73 65 67 73 0a 0a 54 68 | 69 73 20 6c 69 6e 65 20 |segs..Th|is line |
|00001390| 69 73 20 66 6f 6c 6c 6f | 77 65 64 20 62 79 20 74 |is follo|wed by t|
|000013a0| 68 65 20 66 6c 6f 61 74 | 69 6e 67 20 70 6f 69 6e |he float|ing poin|
|000013b0| 74 20 63 6f 6f 72 64 69 | 6e 61 74 65 73 20 66 6f |t coordi|nates fo|
|000013c0| 72 20 74 68 65 20 70 6f | 69 6e 74 73 0a 74 68 61 |r the po|ints.tha|
|000013d0| 74 20 6d 61 6b 65 20 75 | 70 20 74 68 65 20 6f 62 |t make u|p the ob|
|000013e0| 6a 65 63 74 2e 0a 0a 20 | 20 20 20 20 20 20 20 78 |ject... | x|
|000013f0| 31 20 79 31 20 7a 31 0a | 20 20 20 20 20 20 20 20 |1 y1 z1.| |
|00001400| 78 32 20 79 32 20 7a 32 | 0a 20 20 20 20 20 20 20 |x2 y2 z2|. |
|00001410| 20 78 33 20 79 33 20 7a | 33 0a 20 20 20 20 20 20 | x3 y3 z|3. |
|00001420| 20 20 20 20 20 2e 0a 20 | 20 20 20 20 20 20 20 78 | .. | x|
|00001430| 28 6e 70 74 73 29 20 79 | 28 6e 70 74 73 29 20 7a |(npts) y|(npts) z|
|00001440| 28 6e 70 74 73 29 0a 0a | 54 68 65 6e 2c 20 69 74 |(npts)..|Then, it|
|00001450| 20 67 65 74 73 20 61 20 | 62 69 74 20 6d 6f 72 65 | gets a |bit more|
|00001460| 20 63 6f 6d 70 6c 69 63 | 61 74 65 64 2e 20 20 54 | complic|ated. T|
|00001470| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 6c 69 6e |he follo|wing lin|
|00001480| 65 73 20 62 65 67 69 6e | 20 77 69 74 68 20 61 0a |es begin| with a.|
|00001490| 6e 75 6d 62 65 72 20 74 | 6f 20 69 6e 64 69 63 61 |number t|o indica|
|000014a0| 74 65 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |te the n|umber of|
|000014b0| 20 76 65 72 74 69 63 65 | 73 20 69 6e 20 74 68 69 | vertice|s in thi|
|000014c0| 73 20 70 6f 6c 79 67 6f | 6e 2e 20 20 54 68 61 74 |s polygo|n. That|
|000014d0| 20 6e 75 6d 62 65 72 0a | 69 73 20 66 6f 6c 6c 6f | number.|is follo|
|000014e0| 77 65 64 20 62 79 20 74 | 68 61 74 20 6d 61 6e 79 |wed by t|hat many|
|000014f0| 20 6e 75 6d 62 65 72 73 | 2c 20 6f 6e 65 20 66 6f | numbers|, one fo|
|00001500| 72 20 65 61 63 68 20 76 | 65 72 74 65 78 2e 20 20 |r each v|ertex. |
|00001510| 54 68 65 73 65 20 61 72 | 65 20 67 69 76 65 6e 0a |These ar|e given.|
|00001520| 69 6e 20 61 6e 20 6f 72 | 64 65 72 20 73 70 65 63 |in an or|der spec|
|00001530| 69 66 69 65 64 20 69 6e | 20 74 68 65 20 2e 61 6f |ified in| the .ao|
|00001540| 66 66 20 28 75 73 75 61 | 6c 6c 79 20 63 6f 6e 74 |ff (usua|lly cont|
|00001550| 65 72 2d 63 6c 6f 63 6b | 77 69 73 65 29 2e 20 20 |er-clock|wise). |
|00001560| 53 6f 2c 20 66 6f 72 0a | 65 78 61 6d 70 6c 65 2c |So, for.|example,|
|00001570| 20 61 20 74 72 69 61 6e | 67 6c 65 20 61 6e 64 20 | a trian|gle and |
|00001580| 61 20 70 65 6e 74 61 67 | 6f 6e 20 77 68 69 63 68 |a pentag|on which|
|00001590| 20 73 68 61 72 65 20 61 | 20 73 69 64 65 20 61 72 | share a| side ar|
|000015a0| 65 20 73 68 6f 77 6e 20 | 62 65 6c 6f 77 2e 0a 0a |e shown |below...|
|000015b0| 20 20 20 20 20 20 20 20 | 33 20 20 20 20 20 20 20 | |3 |
|000015c0| 31 20 33 20 34 0a 20 20 | 20 20 20 20 20 20 35 20 |1 3 4. | 5 |
|000015d0| 20 20 20 20 20 20 32 20 | 34 20 33 20 36 20 37 0a | 2 |4 3 6 7.|
|000015e0| 0a 48 65 72 65 20 69 73 | 20 73 6f 6d 65 20 71 75 |.Here is| some qu|
|000015f0| 69 63 6b 20 61 6e 64 20 | 64 69 72 74 79 20 73 61 |ick and |dirty sa|
|00001600| 6d 70 6c 65 20 63 6f 64 | 65 20 74 6f 20 72 65 61 |mple cod|e to rea|
|00001610| 64 20 69 6e 20 74 68 65 | 20 2e 67 65 6f 6d 20 66 |d in the| .geom f|
|00001620| 69 6c 65 3a 0a 0a 73 74 | 72 75 63 74 20 70 6f 6c |ile:..st|ruct pol|
|00001630| 79 67 6f 6e 20 7b 0a 20 | 20 20 20 69 6e 74 20 6e |ygon {. | int n|
|00001640| 76 65 72 74 3b 20 20 20 | 20 20 20 20 20 20 20 2f |vert; | /|
|00001650| 2a 20 4e 75 6d 62 65 72 | 20 6f 66 20 76 65 72 74 |* Number| of vert|
|00001660| 69 63 65 73 20 69 6e 20 | 74 68 69 73 20 70 6f 6c |ices in |this pol|
|00001670| 79 67 6f 6e 20 2a 2f 0a | 20 20 20 20 69 6e 74 20 |ygon */.| int |
|00001680| 2a 76 65 72 74 73 3b 20 | 20 20 20 20 20 20 20 20 |*verts; | |
|00001690| 2f 2a 20 56 65 72 74 69 | 63 65 73 20 69 6e 20 74 |/* Verti|ces in t|
|000016a0| 68 69 73 20 70 6f 6c 79 | 67 6f 6e 20 2a 2f 0a 7d |his poly|gon */.}|
|000016b0| 3b 0a 0a 73 74 72 75 63 | 74 20 6f 62 6a 65 63 74 |;..struc|t object|
|000016c0| 20 7b 0a 20 20 20 20 69 | 6e 74 20 6e 70 74 73 3b | {. i|nt npts;|
|000016d0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 54 68 | | /* Th|
|000016e0| 65 20 6e 75 6d 62 65 72 | 20 6f 66 20 70 6f 69 6e |e number| of poin|
|000016f0| 74 73 20 2a 2f 0a 20 20 | 20 20 69 6e 74 20 6e 70 |ts */. | int np|
|00001700| 6f 6c 79 73 3b 20 20 20 | 20 20 20 20 20 20 2f 2a |olys; | /*|
|00001710| 20 54 68 65 20 6e 75 6d | 62 65 72 20 6f 66 20 70 | The num|ber of p|
|00001720| 6f 6c 79 67 6f 6e 73 20 | 2a 2f 0a 20 20 20 20 69 |olygons |*/. i|
|00001730| 6e 74 20 6e 73 65 67 73 | 3b 20 20 20 20 20 20 20 |nt nsegs|; |
|00001740| 20 20 20 2f 2a 20 54 68 | 65 20 6e 75 6d 62 65 72 | /* Th|e number|
|00001750| 20 6f 66 20 73 65 67 6d | 65 6e 74 73 20 2a 2f 0a | of segm|ents */.|
|00001760| 20 20 20 20 64 6f 75 62 | 6c 65 20 2a 70 6f 69 6e | doub|le *poin|
|00001770| 74 20 78 2c 2a 70 6f 69 | 6e 74 20 79 2c 2a 70 6f |t x,*poi|nt y,*po|
|00001780| 69 6e 74 20 7a 3b 0a 20 | 20 20 20 20 20 20 20 20 |int z;. | |
|00001790| 20 20 20 20 20 20 20 20 | 2d 20 20 20 20 20 20 20 | |- |
|000017a0| 20 2d 20 20 20 20 20 20 | 20 20 2d 0a 20 20 20 20 | - | -. |
|000017b0| 73 74 72 75 63 74 20 70 | 6f 6c 79 67 6f 6e 20 2a |struct p|olygon *|
|000017c0| 70 6f 6c 79 73 3b 0a 7d | 3b 0a 0a 69 6e 74 0a 72 |polys;.}|;..int.r|
|000017d0| 65 61 64 20 67 65 6f 6d | 20 66 69 6c 65 28 20 63 |ead geom| file( c|
|000017e0| 68 61 72 20 2a 67 65 6f | 6d 20 66 69 6c 65 2c 20 |har *geo|m file, |
|000017f0| 73 74 72 75 63 74 20 6f | 62 6a 65 63 74 20 2a 6f |struct o|bject *o|
|00001800| 62 6a 20 29 0a 20 20 20 | 20 2d 20 20 20 20 2d 20 |bj ). | - - |
|00001810| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2d | | -|
|00001820| 0a 7b 0a 20 20 20 20 46 | 49 4c 45 20 2a 66 70 3b |.{. F|ILE *fp;|
|00001830| 0a 20 20 20 20 69 6e 74 | 20 69 2c 6a 3b 0a 0a 20 |. int| i,j;.. |
|00001840| 20 20 20 69 66 20 28 21 | 28 66 70 20 3d 20 66 6f | if (!|(fp = fo|
|00001850| 70 65 6e 28 67 65 6f 6d | 20 66 69 6c 65 2c 22 72 |pen(geom| file,"r|
|00001860| 22 29 29 29 20 20 20 20 | 20 20 20 20 20 20 20 2f |"))) | /|
|00001870| 2a 20 4f 70 65 6e 20 74 | 68 65 20 2e 67 65 6f 6d |* Open t|he .geom|
|00001880| 20 66 69 6c 65 20 2a 2f | 0a 20 20 20 20 20 20 20 | file */|. |
|00001890| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018a0| 20 20 2d 0a 20 20 20 20 | 20 20 20 20 72 65 74 75 | -. | retu|
|000018b0| 72 6e 20 2d 31 3b 0a 0a | 20 20 20 20 20 20 20 20 |rn -1;..| |
|000018c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000018e0| 20 20 20 20 20 20 20 20 | 2f 2a 20 47 65 74 20 68 | |/* Get h|
|000018f0| 65 61 64 65 72 20 69 6e | 66 6f 72 6d 61 74 69 6f |eader in|formatio|
|00001900| 6e 20 2a 2f 0a 20 20 20 | 20 66 73 63 61 6e 66 28 |n */. | fscanf(|
|00001910| 66 70 2c 22 25 64 20 25 | 64 20 25 64 22 2c 26 6f |fp,"%d %|d %d",&o|
|00001920| 62 6a 2e 6e 70 74 73 2c | 26 6f 62 6a 2e 6e 70 6f |bj.npts,|&obj.npo|
|00001930| 6c 79 73 2c 26 6f 62 6a | 2e 6e 73 65 67 73 29 3b |lys,&obj|.nsegs);|
|00001940| 0a 0a 20 20 20 20 20 20 | 20 20 2f 2a 0a 20 20 20 |.. | /*. |
|00001950| 20 20 20 20 20 2a 2a 20 | 41 6c 6c 6f 63 61 74 65 | ** |Allocate|
|00001960| 20 72 6f 6f 6d 20 66 6f | 72 20 74 68 65 20 70 6f | room fo|r the po|
|00001970| 69 6e 74 73 2e 0a 20 20 | 20 20 20 20 20 20 2a 2f |ints.. | */|
|00001980| 0a 20 20 20 20 6f 62 6a | 2e 70 6f 69 6e 74 20 78 |. obj|.point x|
|00001990| 20 3d 20 28 64 6f 75 62 | 6c 65 20 2a 29 6d 61 6c | = (doub|le *)mal|
|000019a0| 6c 6f 63 28 6f 62 6a 2e | 6e 70 74 73 2a 73 69 7a |loc(obj.|npts*siz|
|000019b0| 65 6f 66 28 64 6f 75 62 | 6c 65 29 29 3b 0a 20 20 |eof(doub|le));. |
|000019c0| 20 20 20 20 20 20 20 20 | 20 20 20 2d 0a 20 20 20 | | -. |
|000019d0| 20 6f 62 6a 2e 70 6f 69 | 6e 74 20 79 20 3d 20 28 | obj.poi|nt y = (|
|000019e0| 64 6f 75 62 6c 65 20 2a | 29 6d 61 6c 6c 6f 63 28 |double *|)malloc(|
|000019f0| 6f 62 6a 2e 6e 70 74 73 | 2a 73 69 7a 65 6f 66 28 |obj.npts|*sizeof(|
|00001a00| 64 6f 75 62 6c 65 29 29 | 3b 0a 20 20 20 20 20 20 |double))|;. |
|00001a10| 20 20 20 20 20 20 20 2d | 0a 20 20 20 20 6f 62 6a | -|. obj|
|00001a20| 2e 70 6f 69 6e 74 20 7a | 20 3d 20 28 64 6f 75 62 |.point z| = (doub|
|00001a30| 6c 65 20 2a 29 6d 61 6c | 6c 6f 63 28 6f 62 6a 2e |le *)mal|loc(obj.|
|00001a40| 6e 70 74 73 2a 73 69 7a | 65 6f 66 28 64 6f 75 62 |npts*siz|eof(doub|
|00001a50| 6c 65 29 29 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |le));. | |
|00001a60| 20 20 20 2d 0a 0a 20 20 | 20 20 66 6f 72 20 28 69 | -.. | for (i|
|00001a70| 3d 30 3b 69 3c 6f 62 6a | 2e 6e 70 74 73 3b 2b 2b |=0;i<obj|.npts;++|
|00001a80| 69 29 0a 20 20 20 20 20 | 20 20 20 66 73 63 61 6e |i). | fscan|
|00001a90| 66 28 66 70 2c 22 25 6c | 66 20 25 6c 66 20 25 6c |f(fp,"%l|f %lf %l|
|00001aa0| 66 22 2c 26 6f 62 6a 2e | 70 6f 69 6e 74 20 78 5b |f",&obj.|point x[|
|00001ab0| 69 5d 2c 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |i],. | |
|00001ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001ad0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2d 0a | | -.|
|00001ae0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001af0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b00| 26 6f 62 6a 2e 70 6f 69 | 6e 74 20 79 5b 69 5d 2c |&obj.poi|nt y[i],|
|00001b10| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001b20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b30| 20 20 20 20 20 20 20 20 | 20 20 20 2d 0a 20 20 20 | | -. |
|00001b40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 26 6f 62 | | &ob|
|00001b60| 6a 2e 70 6f 69 6e 74 20 | 7a 5b 69 5d 29 3b 0a 20 |j.point |z[i]);. |
|00001b70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001b90| 20 20 20 20 20 20 20 20 | 20 2d 0a 0a 20 20 20 20 | | -.. |
|00001ba0| 20 20 20 20 2f 2a 20 41 | 6c 6c 6f 63 61 74 65 20 | /* A|llocate |
|00001bb0| 72 6f 6f 6d 20 66 6f 72 | 20 74 68 65 20 70 6f 6c |room for| the pol|
|00001bc0| 79 67 6f 6e 73 2e 20 20 | 2a 2f 0a 20 20 20 20 6f |ygons. |*/. o|
|00001bd0| 62 6a 2e 70 6f 6c 79 73 | 20 3d 20 28 73 74 72 75 |bj.polys| = (stru|
|00001be0| 63 74 20 70 6f 6c 79 67 | 6f 6e 20 2a 29 6d 61 6c |ct polyg|on *)mal|
|00001bf0| 6c 6f 63 28 6f 62 6a 2e | 6e 70 6f 6c 79 73 2a 73 |loc(obj.|npolys*s|
|00001c00| 69 7a 65 6f 66 28 73 74 | 72 75 63 74 20 70 6f 6c |izeof(st|ruct pol|
|00001c10| 79 67 6f 6e 29 29 3b 0a | 0a 20 20 20 20 66 6f 72 |ygon));.|. for|
|00001c20| 20 28 69 3d 30 3b 69 3c | 6f 62 6a 2e 6e 70 74 73 | (i=0;i<|obj.npts|
|00001c30| 3b 2b 2b 69 29 20 7b 0a | 20 20 20 20 20 20 20 20 |;++i) {.| |
|00001c40| 20 20 20 20 2f 2a 20 53 | 65 65 20 68 6f 77 20 6d | /* S|ee how m|
|00001c50| 61 6e 79 20 76 65 72 74 | 69 63 65 73 20 74 68 69 |any vert|ices thi|
|00001c60| 73 20 68 61 73 20 2a 2f | 0a 20 20 20 20 20 20 20 |s has */|. |
|00001c70| 20 66 73 63 61 6e 66 28 | 66 70 2c 22 25 64 22 2c | fscanf(|fp,"%d",|
|00001c80| 26 6f 62 6a 2e 70 6f 6c | 79 73 5b 69 5d 2e 6e 76 |&obj.pol|ys[i].nv|
|00001c90| 65 72 74 29 3b 0a 0a 20 | 20 20 20 20 20 20 20 20 |ert);.. | |
|00001ca0| 20 20 20 2f 2a 20 41 6c | 6c 6f 63 61 74 65 20 72 | /* Al|locate r|
|00001cb0| 6f 6f 6d 20 66 6f 72 20 | 76 65 72 74 69 63 65 73 |oom for |vertices|
|00001cc0| 20 2a 2f 0a 20 20 20 20 | 20 20 20 20 6f 62 6a 2e | */. | obj.|
|00001cd0| 70 6f 6c 79 73 5b 69 5d | 2e 76 65 72 74 73 20 3d |polys[i]|.verts =|
|00001ce0| 20 28 69 6e 74 20 2a 29 | 6d 61 6c 6c 6f 63 28 6f | (int *)|malloc(o|
|00001cf0| 62 6a 2e 6e 70 6f 6c 79 | 73 2a 73 69 7a 65 6f 66 |bj.npoly|s*sizeof|
|00001d00| 28 69 6e 74 29 29 3b 0a | 0a 20 20 20 20 20 20 20 |(int));.|. |
|00001d10| 20 20 20 20 20 2f 2a 20 | 47 65 74 20 65 61 63 68 | /* |Get each|
|00001d20| 20 76 65 72 74 65 78 20 | 2a 2f 0a 20 20 20 20 20 | vertex |*/. |
|00001d30| 20 20 20 66 6f 72 20 28 | 6a 3d 30 3b 6a 3c 6f 62 | for (|j=0;j<ob|
|00001d40| 6a 2e 70 6f 6c 79 73 5b | 69 5d 2e 6e 76 65 72 74 |j.polys[|i].nvert|
|00001d50| 3b 2b 2b 6a 29 0a 20 20 | 20 20 20 20 20 20 20 20 |;++j). | |
|00001d60| 20 20 66 73 63 61 6e 66 | 28 66 70 2c 22 25 64 22 | fscanf|(fp,"%d"|
|00001d70| 2c 26 6f 62 6a 2e 70 6f | 6c 79 73 5b 69 5d 2e 76 |,&obj.po|lys[i].v|
|00001d80| 65 72 74 73 5b 6a 5d 29 | 3b 0a 20 20 20 20 7d 0a |erts[j])|;. }.|
|00001d90| 0a 7d 0a 0a 33 29 20 48 | 6f 77 20 64 6f 20 49 20 |.}..3) H|ow do I |
|00001da0| 64 65 66 69 6e 65 20 73 | 70 61 63 65 3f 0a 0a 20 |define s|pace?.. |
|00001db0| 20 20 20 20 54 68 65 72 | 65 20 61 72 65 20 73 65 | Ther|e are se|
|00001dc0| 76 65 72 61 6c 20 74 68 | 69 6e 67 73 20 74 6f 20 |veral th|ings to |
|00001dd0| 63 6f 6e 73 69 64 65 72 | 20 77 68 65 6e 20 70 69 |consider| when pi|
|00001de0| 63 6b 69 6e 67 20 61 20 | 63 6f 6f 72 64 69 6e 61 |cking a |coordina|
|00001df0| 74 65 0a 73 79 73 74 65 | 6d 2e 20 20 4d 6f 73 74 |te.syste|m. Most|
|00001e00| 20 69 6d 70 6f 72 74 61 | 6e 74 20 6f 66 20 74 68 | importa|nt of th|
|00001e10| 65 73 65 20 69 73 20 68 | 6f 77 20 79 6f 75 20 69 |ese is h|ow you i|
|00001e20| 6e 74 65 6e 64 20 74 6f | 20 68 61 6e 64 6c 65 20 |ntend to| handle |
|00001e30| 6f 62 6a 65 63 74 73 2e | 0a 49 66 20 79 6f 75 72 |objects.|.If your|
|00001e40| 20 6f 62 6a 65 63 74 73 | 20 61 72 65 20 64 65 66 | objects| are def|
|00001e50| 69 6e 65 64 20 69 6e 20 | 74 65 72 6d 73 20 6f 66 |ined in |terms of|
|00001e60| 20 3c 78 2c 79 2c 7a 3e | 20 74 72 69 70 6c 65 74 | <x,y,z>| triplet|
|00001e70| 73 2c 20 69 74 20 77 69 | 6c 6c 0a 72 65 71 75 69 |s, it wi|ll.requi|
|00001e80| 72 65 20 61 20 66 61 69 | 72 20 62 69 74 20 6f 66 |re a fai|r bit of|
|00001e90| 20 77 6f 72 6b 20 6f 6e | 20 72 65 61 64 69 6e 67 | work on| reading|
|00001ea0| 20 74 68 65 6d 20 69 6e | 20 74 6f 20 74 75 72 6e | them in| to turn|
|00001eb0| 20 74 68 65 6d 20 69 6e | 74 6f 0a 73 70 68 65 72 | them in|to.spher|
|00001ec0| 69 63 61 6c 20 63 6f 6f | 72 64 69 6e 61 74 65 73 |ical coo|rdinates|
|00001ed0| 2e 20 20 49 66 20 79 6f | 75 27 72 65 20 6c 6f 6f |. If yo|u're loo|
|00001ee0| 6b 69 6e 67 20 74 6f 20 | 74 68 69 73 20 46 41 51 |king to |this FAQ|
|00001ef0| 20 66 6f 72 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e | for inf|ormation|
|00001f00| 20 6f 6e 0a 68 6f 77 20 | 74 6f 20 64 65 66 69 6e | on.how |to defin|
|00001f10| 65 20 74 68 65 20 73 70 | 61 63 65 20 79 6f 75 72 |e the sp|ace your|
|00001f20| 20 6f 62 6a 65 63 74 73 | 20 77 69 6c 6c 20 62 65 | objects| will be|
|00001f30| 20 69 6e 2c 20 49 27 64 | 20 73 74 72 6f 6e 67 6c | in, I'd| strongl|
|00001f40| 79 20 73 75 67 67 65 73 | 74 0a 75 73 69 6e 67 20 |y sugges|t.using |
|00001f50| 72 65 63 74 61 6e 67 75 | 6c 61 72 20 63 6f 6f 72 |rectangu|lar coor|
|00001f60| 64 69 6e 61 74 65 73 20 | 61 6e 64 20 73 6f 6d 65 |dinates |and some|
|00001f70| 20 64 65 72 69 76 61 74 | 69 76 65 20 6f 66 20 74 | derivat|ive of t|
|00001f80| 68 65 20 4f 46 46 2d 66 | 6f 72 6d 61 74 2e 0a 0a |he OFF-f|ormat...|
|00001f90| 20 20 20 20 20 46 6f 72 | 20 73 74 61 72 74 65 72 | For| starter|
|00001fa0| 73 2c 20 6c 65 74 20 6d | 65 20 6a 75 73 74 20 74 |s, let m|e just t|
|00001fb0| 68 72 6f 77 20 69 6e 20 | 74 68 61 74 20 77 68 69 |hrow in |that whi|
|00001fc0| 6c 65 20 6f 75 72 20 75 | 6e 69 76 65 72 73 65 20 |le our u|niverse |
|00001fd0| 6d 61 79 20 62 65 0a 69 | 6e 66 69 6e 69 74 65 20 |may be.i|nfinite |
|00001fe0| 69 6e 20 61 6c 6c 20 64 | 69 72 65 63 74 69 6f 6e |in all d|irection|
|00001ff0| 73 2c 20 74 68 61 74 20 | 64 6f 65 73 6e 27 74 20 |s, that |doesn't |
|00002000| 6d 61 6b 65 20 66 6f 72 | 20 67 6f 6f 64 20 70 72 |make for| good pr|
|00002010| 6f 67 72 61 6d 6d 69 6e | 67 2e 20 20 57 65 0a 68 |ogrammin|g. We.h|
|00002020| 61 76 65 20 74 6f 20 6c | 69 6d 69 74 20 6f 75 72 |ave to l|imit our|
|00002030| 73 65 6c 76 65 73 20 74 | 6f 20 73 6d 61 6c 6c 20 |selves t|o small |
|00002040| 65 6e 6f 75 67 68 20 6e | 75 6d 62 65 72 73 20 74 |enough n|umbers t|
|00002050| 68 61 74 20 77 65 20 63 | 61 6e 20 6d 75 6c 74 69 |hat we c|an multi|
|00002060| 70 6c 79 0a 74 68 65 6d | 20 74 6f 67 65 74 68 65 |ply.them| togethe|
|00002070| 72 20 77 69 74 68 6f 75 | 74 20 6f 76 65 72 66 6c |r withou|t overfl|
|00002080| 6f 77 69 6e 67 20 74 68 | 65 6d 2c 20 77 65 20 63 |owing th|em, we c|
|00002090| 61 6e 20 64 69 76 69 64 | 65 20 74 68 65 6d 20 77 |an divid|e them w|
|000020a0| 69 74 68 6f 75 74 0a 63 | 72 61 73 68 69 6e 67 20 |ithout.c|rashing |
|000020b0| 6f 75 72 20 73 79 73 74 | 65 6d 73 2c 20 61 6e 64 |our syst|ems, and|
|000020c0| 20 77 65 20 63 61 6e 20 | 61 64 64 20 74 68 65 6d | we can |add them|
|000020d0| 20 77 69 74 68 6f 75 74 | 20 61 63 63 69 64 65 6e | without| acciden|
|000020e0| 74 61 6c 6c 79 20 66 6c | 69 70 70 69 6e 67 0a 61 |tally fl|ipping.a|
|000020f0| 20 73 69 67 6e 20 62 69 | 74 2e 0a 0a 20 20 20 20 | sign bi|t... |
|00002100| 20 4e 6f 77 2c 20 74 68 | 65 20 66 75 6e 20 62 65 | Now, th|e fun be|
|00002110| 67 69 6e 73 2e 20 20 54 | 68 65 20 73 69 6d 70 6c |gins. T|he simpl|
|00002120| 65 73 74 20 66 6f 72 6d | 20 6f 66 20 64 65 66 69 |est form| of defi|
|00002130| 6e 69 6e 67 20 74 68 65 | 20 55 6e 69 76 65 72 73 |ning the| Univers|
|00002140| 65 20 69 73 0a 74 6f 20 | 66 6c 61 74 20 6f 75 74 |e is.to |flat out|
|00002150| 20 73 61 79 20 74 68 61 | 74 20 74 68 65 20 55 6e | say tha|t the Un|
|00002160| 69 76 65 72 73 65 20 73 | 74 72 65 74 63 68 65 73 |iverse s|tretches|
|00002170| 20 6f 76 65 72 20 74 68 | 65 73 65 20 63 6f 6f 72 | over th|ese coor|
|00002180| 64 69 6e 61 74 65 73 2c | 20 73 61 79 0a 69 6e 20 |dinates,| say.in |
|00002190| 74 68 65 20 62 6f 75 6e | 64 69 6e 67 20 62 6f 78 |the boun|ding box|
|000021a0| 20 6f 66 20 3c 2d 36 35 | 35 33 36 2c 20 2d 36 35 | of <-65|536, -65|
|000021b0| 35 33 36 2c 20 2d 36 35 | 35 33 36 3e 20 74 6f 20 |536, -65|536> to |
|000021c0| 3c 36 35 35 33 36 2c 20 | 36 35 35 33 36 2c 0a 36 |<65536, |65536,.6|
|000021d0| 35 35 33 36 3e 2e 20 20 | 54 68 69 73 20 69 73 20 |5536>. |This is |
|000021e0| 6f 66 74 65 6e 20 72 65 | 66 65 72 72 65 64 20 74 |often re|ferred t|
|000021f0| 6f 20 61 73 20 61 20 55 | 6e 69 76 65 72 73 61 6c |o as a U|niversal|
|00002200| 20 43 6f 6f 72 64 69 6e | 61 74 65 20 73 79 73 74 | Coordin|ate syst|
|00002210| 65 6d 20 6f 72 0a 61 6e | 20 41 62 73 6f 6c 75 74 |em or.an| Absolut|
|00002220| 65 20 43 6f 6f 72 64 69 | 6e 61 74 65 20 73 79 73 |e Coordi|nate sys|
|00002230| 74 65 6d 2e 20 20 54 68 | 65 6e 2c 20 65 61 63 68 |tem. Th|en, each|
|00002240| 20 6f 62 6a 65 63 74 20 | 69 6e 20 74 68 65 20 55 | object |in the U|
|00002250| 6e 69 76 65 72 73 65 20 | 77 69 6c 6c 0a 62 65 20 |niverse |will.be |
|00002260| 63 65 6e 74 65 72 65 64 | 20 61 62 6f 75 74 20 73 |centered| about s|
|00002270| 6f 6d 65 20 63 6f 6f 72 | 64 69 6e 61 74 65 20 69 |ome coor|dinate i|
|00002280| 6e 20 74 68 61 74 20 72 | 61 6e 67 65 2e 20 20 54 |n that r|ange. T|
|00002290| 68 69 73 20 69 6e 63 6c | 75 64 65 73 20 79 6f 75 |his incl|udes you|
|000022a0| 72 0a 76 69 65 77 70 6f | 69 6e 74 2e 20 20 53 65 |r.viewpo|int. Se|
|000022b0| 76 65 72 61 6c 20 73 74 | 72 61 74 65 67 69 65 73 |veral st|rategies|
|000022c0| 20 61 72 65 20 61 76 61 | 69 6c 61 62 6c 65 20 66 | are ava|ilable f|
|000022d0| 6f 72 20 64 65 61 6c 69 | 6e 67 20 77 69 74 68 20 |or deali|ng with |
|000022e0| 74 68 65 20 65 64 67 65 | 0a 6f 66 20 74 68 65 20 |the edge|.of the |
|000022f0| 55 6e 69 76 65 72 73 65 | 2e 20 20 4f 6e 65 20 63 |Universe|. One c|
|00002300| 61 6e 20 6d 61 6b 65 20 | 74 68 65 20 55 6e 69 76 |an make |the Univ|
|00002310| 65 72 73 65 20 77 72 61 | 70 20 61 72 6f 75 6e 64 |erse wra|p around|
|00002320| 20 73 6f 20 74 68 61 74 | 20 61 6e 0a 6f 62 6a 65 | so that| an.obje|
|00002330| 63 74 20 6c 65 61 76 69 | 6e 67 20 74 68 65 20 63 |ct leavi|ng the c|
|00002340| 75 62 65 20 61 74 20 3c | 20 58 2c 20 59 2c 20 36 |ube at <| X, Y, 6|
|00002350| 35 35 33 36 3e 20 77 69 | 6c 6c 20 72 65 2d 61 70 |5536> wi|ll re-ap|
|00002360| 70 65 61 72 20 69 6e 20 | 74 68 65 20 55 6e 69 76 |pear in |the Univ|
|00002370| 65 72 73 65 0a 61 74 20 | 3c 20 58 2c 20 59 2c 20 |erse.at |< X, Y, |
|00002380| 2d 36 35 35 33 36 3e 2e | 20 20 4f 72 2c 20 6f 6e |-65536>.| Or, on|
|00002390| 65 20 63 61 6e 20 6d 61 | 6b 65 20 6f 62 6a 65 63 |e can ma|ke objec|
|000023a0| 74 73 20 62 6f 75 6e 63 | 65 20 6f 72 20 73 74 6f |ts bounc|e or sto|
|000023b0| 70 20 61 74 20 74 68 65 | 20 65 64 67 65 0a 6f 66 |p at the| edge.of|
|000023c0| 20 74 68 65 20 55 6e 69 | 76 65 72 73 65 2e 20 20 | the Uni|verse. |
|000023d0| 41 6e 64 2c 20 67 69 76 | 65 6e 20 61 6e 79 20 61 |And, giv|en any a|
|000023e0| 70 70 72 6f 61 63 68 2c | 20 6f 6e 65 20 63 61 6e |pproach,| one can|
|000023f0| 20 68 61 76 65 20 74 68 | 65 20 65 64 67 65 20 6f | have th|e edge o|
|00002400| 66 20 74 68 65 0a 55 6e | 69 76 65 72 73 65 20 62 |f the.Un|iverse b|
|00002410| 65 20 74 72 61 6e 73 70 | 61 72 65 6e 74 20 6f 72 |e transp|arent or|
|00002420| 20 6f 70 61 71 75 65 2e | 0a 0a 20 20 20 20 20 49 | opaque.|.. I|
|00002430| 6e 20 61 6e 20 41 62 73 | 6f 6c 75 74 65 20 43 6f |n an Abs|olute Co|
|00002440| 6f 72 64 69 6e 61 74 65 | 20 73 79 73 74 65 6d 2c |ordinate| system,|
|00002450| 20 61 6c 6c 20 6f 62 6a | 65 63 74 73 20 6d 75 73 | all obj|ects mus|
|00002460| 74 20 62 65 20 73 68 6f | 77 6e 20 66 72 6f 6d 0a |t be sho|wn from.|
|00002470| 74 68 65 20 70 6f 73 69 | 74 69 6f 6e 20 6f 66 20 |the posi|tion of |
|00002480| 79 6f 75 72 20 76 69 65 | 77 70 6f 69 6e 74 2e 20 |your vie|wpoint. |
|00002490| 20 54 68 69 73 20 69 6e | 76 6f 6c 76 65 73 20 6c | This in|volves l|
|000024a0| 6f 74 73 20 6f 66 20 69 | 6e 74 65 72 65 73 74 69 |ots of i|nteresti|
|000024b0| 6e 67 20 6d 61 74 68 0a | 74 68 61 74 20 77 65 27 |ng math.|that we'|
|000024c0| 6c 6c 20 67 65 74 20 69 | 6e 74 6f 20 6c 61 74 65 |ll get i|nto late|
|000024d0| 72 2e 20 20 42 75 74 2c | 20 69 6e 20 67 65 6e 65 |r. But,| in gene|
|000024e0| 72 61 6c 2c 20 61 6e 20 | 6f 62 6a 65 63 74 73 20 |ral, an |objects |
|000024f0| 70 6f 73 69 74 69 6f 6e | 20 77 69 74 68 0a 72 65 |position| with.re|
|00002500| 73 70 65 63 74 20 74 6f | 20 79 6f 75 20 69 73 20 |spect to| you is |
|00002510| 69 74 27 73 20 61 62 73 | 6f 6c 75 74 65 20 70 6f |it's abs|olute po|
|00002520| 73 69 74 69 6f 6e 20 2d | 20 79 6f 75 72 20 61 62 |sition -| your ab|
|00002530| 73 6f 6c 75 74 65 20 70 | 6f 73 69 74 69 6f 6e 20 |solute p|osition |
|00002540| 28 77 69 74 68 0a 61 6c | 6c 20 6b 69 6e 64 73 20 |(with.al|l kinds |
|00002550| 6f 66 20 68 65 6c 6c 20 | 62 72 65 61 6b 69 6e 67 |of hell |breaking|
|00002560| 20 6c 6f 6f 73 65 20 69 | 66 20 79 6f 75 20 63 61 | loose i|f you ca|
|00002570| 6e 20 73 65 65 20 70 61 | 73 74 20 74 68 65 20 65 |n see pa|st the e|
|00002580| 64 67 65 20 6f 66 20 74 | 68 65 0a 55 6e 69 76 65 |dge of t|he.Unive|
|00002590| 72 73 65 29 2e 20 20 54 | 68 65 6e 2c 20 61 66 74 |rse). T|hen, aft|
|000025a0| 65 72 20 74 68 69 73 20 | 70 6f 73 69 74 69 6f 6e |er this |position|
|000025b0| 20 69 73 20 63 61 6c 63 | 75 6c 61 74 65 64 2c 20 | is calc|ulated, |
|000025c0| 69 74 20 6d 75 73 74 20 | 62 65 20 72 6f 74 61 74 |it must |be rotat|
|000025d0| 65 64 0a 62 61 73 65 64 | 20 6f 6e 20 79 6f 75 72 |ed.based| on your|
|000025e0| 20 6f 72 69 65 6e 74 61 | 74 69 6f 6e 20 69 6e 20 | orienta|tion in |
|000025f0| 74 68 65 20 55 6e 69 76 | 65 72 73 65 2e 0a 0a 20 |the Univ|erse... |
|00002600| 20 20 20 20 41 6e 6f 74 | 68 65 72 20 70 6f 73 73 | Anot|her poss|
|00002610| 69 62 69 6c 69 74 79 20 | 66 6f 72 20 64 65 66 69 |ibility |for defi|
|00002620| 6e 69 6e 67 20 73 70 61 | 63 65 20 69 73 20 61 20 |ning spa|ce is a |
|00002630| 52 65 6c 61 74 69 76 65 | 20 43 6f 6f 72 64 69 6e |Relative| Coordin|
|00002640| 61 74 65 0a 73 79 73 74 | 65 6d 20 6f 72 20 61 20 |ate.syst|em or a |
|00002650| 56 69 65 77 2d 43 65 6e | 74 65 72 65 64 20 43 6f |View-Cen|tered Co|
|00002660| 6f 72 64 69 6e 61 74 65 | 20 73 79 73 74 65 6d 2e |ordinate| system.|
|00002670| 20 20 49 6e 20 74 68 69 | 73 20 73 6f 72 74 20 6f | In thi|s sort o|
|00002680| 66 20 73 79 73 74 65 6d | 2c 0a 74 68 65 20 56 69 |f system|,.the Vi|
|00002690| 65 77 70 6f 69 6e 74 20 | 69 73 20 61 6c 77 61 79 |ewpoint |is alway|
|000026a0| 73 20 61 74 20 63 6f 6f | 72 64 69 6e 61 74 65 73 |s at coo|rdinates|
|000026b0| 20 3c 30 2c 30 2c 30 3e | 20 61 6e 64 20 65 76 65 | <0,0,0>| and eve|
|000026c0| 72 79 74 68 69 6e 67 20 | 65 6c 73 65 20 69 6e 0a |rything |else in.|
|000026d0| 74 68 65 20 55 6e 69 76 | 65 72 73 65 20 69 73 20 |the Univ|erse is |
|000026e0| 62 61 73 65 64 20 72 65 | 6c 61 74 69 76 65 6c 79 |based re|latively|
|000026f0| 20 74 6f 20 74 68 69 73 | 20 68 6f 6d 65 20 70 6f | to this| home po|
|00002700| 73 69 74 69 6f 6e 2e 20 | 20 54 68 69 73 20 63 61 |sition. | This ca|
|00002710| 75 73 65 73 0a 66 75 6e | 6b 79 20 6d 61 74 68 20 |uses.fun|ky math |
|00002720| 74 6f 20 63 6f 6d 65 20 | 69 6e 74 6f 20 70 6c 61 |to come |into pla|
|00002730| 79 20 77 68 65 6e 20 64 | 65 61 6c 69 6e 67 20 77 |y when d|ealing w|
|00002740| 69 74 68 20 76 65 6c 6f | 63 69 74 69 65 73 20 6f |ith velo|cities o|
|00002750| 66 20 6f 62 6a 65 63 74 | 73 2c 0a 62 75 74 2e 2e |f object|s,.but..|
|00002760| 2e 20 69 74 20 64 6f 65 | 73 20 77 6f 6e 64 65 72 |. it doe|s wonder|
|00002770| 73 20 66 6f 72 20 6e 6f | 74 20 68 61 76 69 6e 67 |s for no|t having|
|00002780| 20 74 6f 20 64 65 61 6c | 20 77 69 74 68 20 74 68 | to deal| with th|
|00002790| 65 20 27 65 64 67 65 20 | 6f 66 20 74 68 65 0a 55 |e 'edge |of the.U|
|000027a0| 6e 69 76 65 72 73 65 27 | 2e 20 20 54 68 69 73 20 |niverse'|. This |
|000027b0| 69 73 20 74 68 65 20 53 | 63 68 72 6f 65 64 69 6e |is the S|chroedin|
|000027c0| 67 65 72 27 73 20 63 61 | 74 20 6d 65 74 68 6f 64 |ger's ca|t method|
|000027d0| 20 6f 66 20 74 68 65 20 | 27 65 64 67 65 20 6f 66 | of the |'edge of|
|000027e0| 20 74 68 65 0a 55 6e 69 | 76 65 72 73 65 27 2e 2e | the.Uni|verse'..|
|000027f0| 2e 2e 20 69 6e 20 74 68 | 65 20 74 72 75 65 73 74 |.. in th|e truest|
|00002800| 20 73 65 6e 73 65 20 6f | 66 20 6f 75 74 20 6f 66 | sense o|f out of|
|00002810| 20 73 69 67 68 74 20 69 | 73 20 6f 75 74 20 6f 66 | sight i|s out of|
|00002820| 20 6d 69 6e 64 2e 20 20 | 53 6d 61 6c 6c 0a 70 72 | mind. |Small.pr|
|00002830| 6f 76 69 73 69 6f 6e 73 | 20 68 61 76 65 20 74 6f |ovisions| have to|
|00002840| 20 62 65 20 6d 61 64 65 | 20 69 66 20 6f 62 6a 65 | be made| if obje|
|00002850| 63 74 73 20 61 72 65 6e | 27 74 20 74 6f 20 77 72 |cts aren|'t to wr|
|00002860| 61 70 20 61 72 6f 75 6e | 64 2e 20 20 42 75 74 2e |ap aroun|d. But.|
|00002870| 2e 2e 20 61 0a 52 65 6c | 61 74 69 76 65 20 43 6f |.. a.Rel|ative Co|
|00002880| 6f 72 64 69 6e 61 74 65 | 20 73 79 73 74 65 6d 20 |ordinate| system |
|00002890| 63 61 6e 20 62 65 20 75 | 73 65 64 20 74 6f 20 67 |can be u|sed to g|
|000028a0| 69 76 65 20 74 68 65 20 | 69 6c 6c 75 73 69 6f 6e |ive the |illusion|
|000028b0| 20 6f 66 20 69 6e 66 69 | 6e 69 74 65 0a 73 70 61 | of infi|nite.spa|
|000028c0| 63 65 20 6f 6e 20 61 20 | 66 69 6e 69 74 65 20 6d |ce on a |finite m|
|000028d0| 61 63 68 69 6e 65 2e 20 | 20 28 59 65 73 2c 20 65 |achine. | (Yes, e|
|000028e0| 76 65 6e 20 79 6f 75 72 | 20 34 38 36 2f 36 36 44 |ven your| 486/66D|
|000028f0| 58 20 69 73 20 66 69 6e | 69 74 65 29 2e 0a 0a 20 |X is fin|ite)... |
|00002900| 20 20 20 20 49 27 6c 6c | 20 6c 65 61 76 65 20 73 | I'll| leave s|
|00002910| 70 68 65 72 69 63 61 6c | 20 63 6f 6f 72 64 69 6e |pherical| coordin|
|00002920| 61 74 65 73 20 74 6f 20 | 61 20 6c 61 74 65 72 20 |ates to |a later |
|00002930| 76 65 72 73 69 6f 6e 20 | 69 66 20 70 65 6f 70 6c |version |if peopl|
|00002940| 65 20 74 68 69 6e 6b 0a | 74 68 65 79 27 6c 6c 20 |e think.|they'll |
|00002950| 62 65 20 6f 66 20 75 73 | 65 2e 2e 2e 0a 0a 34 29 |be of us|e.....4)|
|00002960| 20 48 6f 77 20 64 6f 20 | 49 20 64 65 66 69 6e 65 | How do |I define|
|00002970| 20 70 6f 73 69 74 69 6f | 6e 3f 0a 0a 20 20 20 20 | positio|n?.. |
|00002980| 20 50 6f 73 69 74 69 6f | 6e 20 69 6e 20 61 6e 20 | Positio|n in an |
|00002990| 41 62 73 6f 6c 75 74 65 | 20 43 6f 6f 72 64 69 6e |Absolute| Coordin|
|000029a0| 61 74 65 20 73 79 73 74 | 65 6d 20 69 73 20 65 61 |ate syst|em is ea|
|000029b0| 73 79 2e 20 20 45 61 63 | 68 20 6f 62 6a 65 63 74 |sy. Eac|h object|
|000029c0| 20 68 61 73 0a 74 68 72 | 65 65 20 63 6f 6f 72 64 | has.thr|ee coord|
|000029d0| 69 6e 61 74 65 73 2e 20 | 20 54 68 65 73 65 20 61 |inates. | These a|
|000029e0| 72 65 20 6f 66 74 65 6e | 20 73 74 6f 72 65 64 20 |re often| stored |
|000029f0| 69 6e 20 61 20 64 61 74 | 61 2d 74 79 70 65 20 63 |in a dat|a-type c|
|00002a00| 61 6c 6c 65 64 20 61 0a | 76 65 63 74 6f 72 20 74 |alled a.|vector t|
|00002a10| 6f 20 61 62 73 74 72 61 | 63 74 20 66 75 72 74 68 |o abstra|ct furth|
|00002a20| 65 72 20 74 68 65 20 6e | 6f 74 69 6f 6e 20 74 68 |er the n|otion th|
|00002a30| 61 74 20 74 68 65 73 65 | 20 6e 75 6d 62 65 72 73 |at these| numbers|
|00002a40| 20 62 65 6c 6f 6e 67 0a | 74 6f 67 65 74 68 65 72 | belong.|together|
|00002a50| 2e 0a 0a 20 20 20 20 20 | 20 20 20 74 79 70 65 64 |... | typed|
|00002a60| 65 66 20 73 74 72 75 63 | 74 20 7b 0a 0a 20 20 20 |ef struc|t {.. |
|00002a70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6c 6f 6e | | lon|
|00002a80| 67 20 78 3b 0a 20 20 20 | 20 20 20 20 20 20 20 20 |g x;. | |
|00002a90| 20 20 20 20 20 6c 6f 6e | 67 20 79 3b 0a 20 20 20 | lon|g y;. |
|00002aa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6c 6f 6e | | lon|
|00002ab0| 67 20 7a 3b 0a 20 20 20 | 20 20 20 20 20 7d 20 56 |g z;. | } V|
|00002ac0| 45 43 54 3b 0a 0a 55 73 | 75 61 6c 6c 79 2c 20 65 |ECT;..Us|ually, e|
|00002ad0| 61 63 68 20 6f 62 6a 65 | 63 74 20 69 6e 20 74 68 |ach obje|ct in th|
|00002ae0| 65 20 55 6e 69 76 65 72 | 73 65 20 69 73 20 64 65 |e Univer|se is de|
|00002af0| 66 69 6e 65 64 20 61 62 | 6f 75 74 20 69 74 73 20 |fined ab|out its |
|00002b00| 63 65 6e 74 65 72 20 77 | 69 74 68 0a 65 61 63 68 |center w|ith.each|
|00002b10| 20 63 6f 6f 72 64 69 6e | 61 74 65 20 6f 6e 20 69 | coordin|ate on i|
|00002b20| 74 73 20 73 75 72 66 61 | 63 65 20 62 65 69 6e 67 |ts surfa|ce being|
|00002b30| 20 63 65 6e 74 65 72 65 | 64 20 61 74 20 69 74 73 | centere|d at its|
|00002b40| 20 6f 77 6e 20 3c 30 2c | 30 2c 30 3e 2e 20 20 54 | own <0,|0,0>. T|
|00002b50| 68 69 73 0a 68 65 6c 70 | 73 20 74 72 65 6d 65 6e |his.help|s tremen|
|00002b60| 64 6f 75 73 6c 79 20 69 | 6e 20 72 6f 74 61 74 69 |dously i|n rotati|
|00002b70| 6e 67 20 74 68 65 20 6f | 62 6a 65 63 74 2c 20 61 |ng the o|bject, a|
|00002b80| 6e 64 20 49 20 77 6f 75 | 6c 64 20 68 69 67 68 6c |nd I wou|ld highl|
|00002b90| 79 20 72 65 63 6f 6d 6d | 65 6e 64 0a 74 68 69 73 |y recomm|end.this|
|00002ba0| 2e 20 20 54 68 65 6e 2c | 20 74 68 65 20 6f 62 6a |. Then,| the obj|
|00002bb0| 65 63 74 20 61 73 20 61 | 20 77 68 6f 6c 65 20 69 |ect as a| whole i|
|00002bc0| 73 20 67 69 76 65 6e 20 | 61 20 70 6f 73 69 74 69 |s given |a positi|
|00002bd0| 6f 6e 20 69 6e 20 73 70 | 61 63 65 2e 20 20 57 68 |on in sp|ace. Wh|
|00002be0| 65 6e 0a 69 74 20 63 6f | 6d 65 73 20 74 69 6d 65 |en.it co|mes time|
|00002bf0| 20 74 6f 20 64 72 61 77 | 20 74 68 69 73 20 6f 62 | to draw| this ob|
|00002c00| 6a 65 63 74 2c 20 69 74 | 73 20 70 6f 69 6e 74 73 |ject, it|s points|
|00002c10| 27 20 63 6f 6f 72 64 69 | 6e 61 74 65 73 20 67 65 |' coordi|nates ge|
|00002c20| 74 20 61 64 64 65 64 20 | 6f 6e 0a 74 6f 20 69 74 |t added |on.to it|
|00002c30| 73 20 70 6f 73 69 74 69 | 6f 6e 2e 0a 0a 20 20 20 |s positi|on... |
|00002c40| 20 20 49 6e 20 61 20 52 | 65 6c 61 74 69 76 65 20 | In a R|elative |
|00002c50| 43 6f 6f 72 64 69 6e 61 | 74 65 20 73 79 73 74 65 |Coordina|te syste|
|00002c60| 6d 2c 20 70 6f 73 69 74 | 69 6f 6e 20 69 73 20 61 |m, posit|ion is a|
|00002c70| 6c 73 6f 20 66 61 69 72 | 6c 79 20 73 74 72 61 69 |lso fair|ly strai|
|00002c80| 67 68 74 0a 66 6f 72 77 | 61 72 64 2e 20 20 54 68 |ght.forw|ard. Th|
|00002c90| 65 20 76 69 65 77 2d 70 | 6f 69 6e 74 20 61 6c 77 |e view-p|oint alw|
|00002ca0| 61 79 73 20 68 61 73 20 | 70 6f 73 69 74 69 6f 6e |ays has |position|
|00002cb0| 20 56 45 43 54 3d 7b 20 | 30 2c 20 30 2c 20 30 20 | VECT={ |0, 0, 0 |
|00002cc0| 7d 3b 2e 20 20 4f 74 68 | 65 72 0a 6f 62 6a 65 63 |};. Oth|er.objec|
|00002cd0| 74 73 20 66 6f 6c 6c 6f | 77 20 74 68 65 20 73 61 |ts follo|w the sa|
|00002ce0| 6d 65 20 73 6f 72 74 20 | 6f 66 20 73 79 73 74 65 |me sort |of syste|
|00002cf0| 6d 20 74 68 61 74 20 74 | 68 65 79 20 77 6f 75 6c |m that t|hey woul|
|00002d00| 64 20 69 6e 20 41 62 73 | 6f 6c 75 74 65 0a 43 6f |d in Abs|olute.Co|
|00002d10| 6f 72 64 69 6e 61 74 65 | 20 73 79 73 74 65 6d 73 |ordinate| systems|
|00002d20| 2e 0a 0a 35 29 20 48 6f | 77 20 64 6f 20 49 20 64 |...5) Ho|w do I d|
|00002d30| 65 66 69 6e 65 20 6f 72 | 69 65 6e 74 61 74 69 6f |efine or|ientatio|
|00002d40| 6e 3f 0a 0a 20 20 20 20 | 20 4f 72 69 65 6e 74 61 |n?.. | Orienta|
|00002d50| 74 69 6f 6e 20 63 61 6e | 20 62 65 20 71 75 69 74 |tion can| be quit|
|00002d60| 65 20 74 72 69 63 6b 79 | 2e 20 20 49 20 69 6e 74 |e tricky|. I int|
|00002d70| 65 72 63 68 61 6e 67 65 | 20 73 6f 6d 65 20 6f 66 |erchange| some of|
|00002d80| 20 74 68 65 20 74 65 72 | 6d 73 0a 68 65 72 65 20 | the ter|ms.here |
|00002d90| 71 75 69 74 65 20 6f 66 | 74 65 6e 2e 20 20 49 6e |quite of|ten. In|
|00002da0| 20 33 2d 73 70 61 63 65 | 2c 20 6f 72 69 65 6e 74 | 3-space|, orient|
|00002db0| 61 74 69 6f 6e 20 6d 75 | 73 74 20 62 65 20 64 65 |ation mu|st be de|
|00002dc0| 66 69 6e 65 64 20 62 65 | 20 74 77 6f 2d 61 6e 64 |fined be| two-and|
|00002dd0| 2d 0a 61 2d 68 61 6c 66 | 20 61 6e 67 6c 65 73 2e |-.a-half| angles.|
|00002de0| 20 20 22 54 77 6f 20 61 | 6e 64 20 61 20 68 61 6c | "Two a|nd a hal|
|00002df0| 66 3f 22 20 79 6f 75 20 | 73 61 79 2e 20 20 57 65 |f?" you |say. We|
|00002e00| 6c 6c 2c 20 61 6c 6d 6f | 73 74 20 65 76 65 72 79 |ll, almo|st every|
|00002e10| 6f 6e 65 20 75 73 65 73 | 0a 74 68 72 65 65 20 62 |one uses|.three b|
|00002e20| 65 63 61 75 73 65 20 74 | 77 6f 20 6a 75 73 74 20 |ecause t|wo just |
|00002e30| 69 73 6e 27 74 20 65 6e | 6f 75 67 68 2c 20 62 75 |isn't en|ough, bu|
|00002e40| 74 20 69 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |t if you| want to|
|00002e50| 20 62 65 20 74 65 63 68 | 6e 69 63 61 6c 2c 0a 6f | be tech|nical,.o|
|00002e60| 6e 65 20 6f 66 20 74 68 | 6f 73 65 20 61 6e 67 6c |ne of th|ose angl|
|00002e70| 65 73 20 6f 6e 6c 79 20 | 68 61 73 20 74 6f 20 72 |es only |has to r|
|00002e80| 61 6e 67 65 20 66 72 6f | 6d 20 30 20 2d 20 31 38 |ange fro|m 0 - 18|
|00002e90| 30 20 64 65 67 72 65 65 | 73 20 28 30 20 2d 20 50 |0 degree|s (0 - P|
|00002ea0| 49 2f 32 0a 72 61 64 69 | 61 6e 73 29 2e 0a 0a 20 |I/2.radi|ans)... |
|00002eb0| 20 20 20 20 42 75 74 2c | 20 74 61 6b 69 6e 67 20 | But,| taking |
|00002ec0| 74 68 61 74 20 66 6f 72 | 20 67 72 61 6e 74 65 64 |that for| granted|
|00002ed0| 20 6e 6f 77 2e 2e 2e 2e | 20 79 6f 75 20 68 61 76 | now....| you hav|
|00002ee0| 65 20 74 6f 20 70 69 63 | 6b 20 61 6e 0a 6f 72 69 |e to pic|k an.ori|
|00002ef0| 65 6e 74 61 74 69 6f 6e | 20 66 6f 72 20 79 6f 75 |entation| for you|
|00002f00| 72 20 76 69 65 77 2e 20 | 20 49 20 70 65 72 73 6f |r view. | I perso|
|00002f10| 6e 61 6c 6c 79 20 70 72 | 65 66 65 72 20 74 6f 20 |nally pr|efer to |
|00002f20| 68 61 76 65 20 74 68 65 | 20 58 2d 61 78 69 73 20 |have the| X-axis |
|00002f30| 72 75 6e 0a 3e 66 72 6f | 6d 20 6c 65 66 74 20 74 |run.>fro|m left t|
|00002f40| 6f 20 72 69 67 68 74 20 | 61 63 72 6f 73 73 20 74 |o right |across t|
|00002f50| 68 65 20 63 65 6e 74 65 | 72 20 6f 66 20 6d 79 20 |he cente|r of my |
|00002f60| 73 63 72 65 65 6e 2e 20 | 20 49 20 61 6c 73 6f 20 |screen. | I also |
|00002f70| 6c 69 6b 65 20 74 6f 20 | 68 61 76 65 0a 74 68 65 |like to |have.the|
|00002f80| 20 59 2d 61 78 69 73 20 | 72 75 6e 20 66 72 6f 6d | Y-axis |run from|
|00002f90| 20 74 68 65 20 62 6f 74 | 74 6f 6d 20 6f 66 20 6d | the bot|tom of m|
|00002fa0| 79 20 73 63 72 65 65 6e | 3b 20 61 6e 64 20 49 20 |y screen|; and I |
|00002fb0| 61 6c 73 6f 20 6c 69 6b | 65 20 74 6f 20 68 61 76 |also lik|e to hav|
|00002fc0| 65 20 74 68 65 0a 5a 2d | 61 78 69 73 20 72 75 6e |e the.Z-|axis run|
|00002fd0| 6e 69 6e 67 20 66 72 6f | 6d 20 6d 65 20 73 74 72 |ning fro|m me str|
|00002fe0| 61 69 67 68 74 20 69 6e | 74 6f 20 6d 79 20 73 63 |aight in|to my sc|
|00002ff0| 72 65 65 6e 2e 20 20 57 | 69 74 68 20 73 6f 6d 65 |reen. W|ith some|
|00003000| 20 74 77 65 61 6b 69 6e | 67 20 6f 66 0a 70 6c 75 | tweakin|g of.plu|
|00003010| 73 20 61 6e 64 20 6d 69 | 6e 75 73 20 73 69 67 6e |s and mi|nus sign|
|00003020| 73 20 61 6e 64 20 61 20 | 62 69 74 20 6f 66 20 72 |s and a |bit of r|
|00003030| 65 2d 6f 72 64 65 72 69 | 6e 67 2c 20 61 6c 6c 20 |e-orderi|ng, all |
|00003040| 6f 66 20 74 68 65 20 6d | 61 74 68 20 68 65 72 65 |of the m|ath here|
|00003050| 2d 69 6e 0a 63 61 6e 20 | 62 65 20 6d 6f 64 69 66 |-in.can |be modif|
|00003060| 69 65 64 20 74 6f 20 72 | 65 66 6c 65 63 74 20 61 |ied to r|eflect a|
|00003070| 6e 79 20 6f 72 69 65 6e | 74 61 74 69 6f 6e 20 6f |ny orien|tation o|
|00003080| 66 20 74 68 65 20 63 6f | 6f 72 64 69 6e 61 74 65 |f the co|ordinate|
|00003090| 20 73 79 73 74 65 6d 2e | 0a 53 6f 6d 65 20 70 65 | system.|.Some pe|
|000030a0| 6f 70 6c 65 20 70 72 65 | 66 65 72 20 74 6f 20 68 |ople pre|fer to h|
|000030b0| 61 76 65 20 74 68 65 20 | 59 2d 61 78 69 73 20 68 |ave the |Y-axis h|
|000030c0| 65 61 64 69 6e 67 20 69 | 6e 74 6f 20 74 68 65 20 |eading i|nto the |
|000030d0| 73 63 72 65 65 6e 20 77 | 69 74 68 20 74 68 65 0a |screen w|ith the.|
|000030e0| 5a 2d 61 78 69 73 20 67 | 6f 69 6e 67 20 76 65 72 |Z-axis g|oing ver|
|000030f0| 74 69 63 61 6c 6c 79 2e | 20 20 49 74 27 73 20 61 |tically.| It's a|
|00003100| 6c 6c 20 61 20 6d 61 74 | 74 65 72 20 6f 66 20 68 |ll a mat|ter of h|
|00003110| 6f 77 20 79 6f 75 20 77 | 61 6e 74 20 74 6f 20 64 |ow you w|ant to d|
|00003120| 65 66 69 6e 65 0a 73 74 | 75 66 66 2e 0a 0a 20 20 |efine.st|uff... |
|00003130| 20 20 20 47 69 76 65 6e | 20 74 68 61 74 20 79 6f | Given| that yo|
|00003140| 75 27 76 65 20 61 67 72 | 65 65 64 20 77 69 74 68 |u've agr|eed with|
|00003150| 20 6d 65 20 74 68 61 74 | 20 5a 20 63 61 6e 20 67 | me that| Z can g|
|00003160| 6f 20 69 6e 74 6f 20 74 | 68 65 20 73 63 72 65 65 |o into t|he scree|
|00003170| 6e 2c 0a 77 68 61 74 20 | 33 2d 61 6e 67 6c 65 73 |n,.what |3-angles|
|00003180| 20 64 6f 20 79 6f 75 20 | 6e 65 65 64 3f 20 20 28 | do you |need? (|
|00003190| 48 65 72 65 27 73 20 77 | 68 65 72 65 20 49 20 73 |Here's w|here I s|
|000031a0| 74 61 6e 64 20 74 68 65 | 20 62 69 67 67 65 73 74 |tand the| biggest|
|000031b0| 20 63 68 61 6e 63 65 20 | 6f 66 0a 6d 75 63 6b 69 | chance |of.mucki|
|000031c0| 6e 67 20 75 70 20 74 68 | 65 20 74 65 72 6d 73 2e |ng up th|e terms.|
|000031d0| 29 20 20 59 6f 75 20 6e | 65 65 64 20 72 6f 6c 6c |) You n|eed roll|
|000031e0| 2c 20 70 69 74 63 68 2c | 20 61 6e 64 20 79 61 77 |, pitch,| and yaw|
|000031f0| 2e 20 20 28 49 20 6f 66 | 74 65 6e 20 6d 69 78 20 |. (I of|ten mix |
|00003200| 75 70 0a 72 6f 6c 6c 20 | 61 6e 64 20 79 61 77 20 |up.roll |and yaw |
|00003210| 61 6e 64 20 73 75 63 68 | 2e 2e 2e 20 73 6f 20 69 |and such|... so i|
|00003220| 66 20 79 6f 75 20 63 61 | 6e 20 66 6f 6c 6c 6f 77 |f you ca|n follow|
|00003230| 20 61 6c 6f 6e 67 20 77 | 69 74 68 6f 75 74 20 67 | along w|ithout g|
|00003240| 65 74 74 69 6e 67 0a 6c | 6f 63 6b 65 64 20 69 6e |etting.l|ocked in|
|00003250| 74 6f 20 6d 79 20 74 65 | 72 6d 69 6e 6f 6c 6f 67 |to my te|rminolog|
|00003260| 79 2c 20 66 75 74 75 72 | 65 20 46 41 51 27 73 20 |y, futur|e FAQ's |
|00003270| 77 69 6c 6c 20 63 6f 72 | 72 65 63 74 20 69 74 2e |will cor|rect it.|
|00003280| 29 0a 0a 20 20 20 20 20 | 4c 6f 6f 6b 20 61 74 20 |).. |Look at |
|00003290| 79 6f 75 72 20 6d 6f 6e | 69 74 6f 72 20 61 73 20 |your mon|itor as |
|000032a0| 79 6f 75 27 72 65 20 72 | 65 61 64 69 6e 67 20 74 |you're r|eading t|
|000032b0| 68 69 73 2e 20 20 4e 6f | 77 20 74 69 6c 74 20 79 |his. No|w tilt y|
|000032c0| 6f 75 72 20 68 65 61 64 | 20 73 6f 0a 74 68 61 74 |our head| so.that|
|000032d0| 20 79 6f 75 72 20 72 69 | 67 68 74 20 65 61 72 20 | your ri|ght ear |
|000032e0| 69 73 20 6f 6e 20 79 6f | 75 72 20 72 69 67 68 74 |is on yo|ur right|
|000032f0| 20 73 68 6f 75 6c 64 65 | 72 2e 20 20 54 68 69 73 | shoulde|r. This|
|00003300| 20 63 68 61 6e 67 65 20 | 69 6e 0a 6f 72 69 65 6e | change |in.orien|
|00003310| 74 61 74 69 6f 6e 20 69 | 73 20 72 6f 6c 6c 20 28 |tation i|s roll (|
|00003320| 6f 72 20 79 61 77 2e 2e | 2e 20 62 75 74 20 49 20 |or yaw..|. but I |
|00003330| 63 61 6c 6c 20 69 74 20 | 72 6f 6c 6c 29 2e 0a 0a |call it |roll)...|
|00003340| 20 20 20 20 20 4f 6b 2c | 20 6e 6f 77 20 73 69 74 | Ok,| now sit|
|00003350| 20 75 70 20 73 74 72 61 | 69 67 68 74 20 61 67 61 | up stra|ight aga|
|00003360| 69 6e 2e 20 4e 6f 77 20 | 62 72 69 6e 67 20 79 6f |in. Now |bring yo|
|00003370| 75 72 20 63 68 69 6e 20 | 64 6f 77 6e 20 74 6f 20 |ur chin |down to |
|00003380| 6d 65 65 74 0a 79 6f 75 | 72 20 63 68 65 73 74 2e |meet.you|r chest.|
|00003390| 20 20 28 48 6d 6d 6d 2e | 2e 2e 20 4c 4f 4f 4b 20 | (Hmmm.|.. LOOK |
|000033a0| 42 41 43 4b 20 4e 4f 57 | 21 21 21 2c 20 77 68 65 |BACK NOW|!!!, whe|
|000033b0| 77 2e 2e 2e 20 67 6c 61 | 64 20 79 6f 75 20 68 65 |w... gla|d you he|
|000033c0| 61 72 64 20 6d 65 2e 29 | 0a 54 68 61 74 20 6d 6f |ard me.)|.That mo|
|000033d0| 74 69 6f 6e 20 77 61 73 | 20 70 69 74 63 68 2e 0a |tion was| pitch..|
|000033e0| 0a 20 20 20 20 20 4f 6b | 2c 20 6e 6f 77 20 6c 6f |. Ok|, now lo|
|000033f0| 6f 6b 20 6f 76 65 72 20 | 79 6f 75 72 20 72 69 67 |ok over |your rig|
|00003400| 68 74 20 73 68 6f 75 6c | 64 65 72 20 6b 65 65 70 |ht shoul|der keep|
|00003410| 69 6e 67 20 79 6f 75 72 | 20 68 65 61 64 20 76 65 |ing your| head ve|
|00003420| 72 74 69 63 61 6c 20 74 | 6f 0a 73 65 65 20 77 68 |rtical t|o.see wh|
|00003430| 6f 27 73 20 62 65 68 69 | 6e 64 20 79 6f 75 2e 20 |o's behi|nd you. |
|00003440| 20 28 4c 4f 4f 4b 20 42 | 41 43 4b 20 41 47 41 49 | (LOOK B|ACK AGAI|
|00003450| 4e 21 21 2e 29 20 20 4f | 6b 2e 2e 2e 20 74 68 61 |N!!.) O|k... tha|
|00003460| 74 20 77 61 73 20 79 61 | 77 20 28 6f 72 0a 72 6f |t was ya|w (or.ro|
|00003470| 6c 6c 2c 20 62 75 74 20 | 49 20 63 61 6c 6c 20 69 |ll, but |I call i|
|00003480| 74 20 79 61 77 29 2e 0a | 0a 20 20 20 20 20 54 68 |t yaw)..|. Th|
|00003490| 61 74 27 73 20 74 68 65 | 20 62 61 73 69 63 73 2e |at's the| basics.|
|000034a0| 20 20 4e 6f 77 2c 20 77 | 68 61 74 20 64 6f 20 49 | Now, w|hat do I|
|000034b0| 20 64 6f 20 77 69 74 68 | 20 74 68 65 6d 3f 20 20 | do with| them? |
|000034c0| 57 65 6c 6c 2c 20 68 65 | 72 65 27 73 0a 77 68 65 |Well, he|re's.whe|
|000034d0| 72 65 20 61 20 6e 69 63 | 65 20 62 6f 6f 6b 20 6f |re a nic|e book o|
|000034e0| 6e 20 4d 61 74 72 69 78 | 20 41 72 69 74 68 6d 65 |n Matrix| Arithme|
|000034f0| 74 69 63 20 77 69 6c 6c | 20 68 65 6c 70 20 79 6f |tic will| help yo|
|00003500| 75 20 6f 75 74 2e 20 20 | 59 6f 75 20 68 61 76 65 |u out. |You have|
|00003510| 20 74 6f 0a 75 73 65 20 | 74 68 65 73 65 20 74 68 | to.use |these th|
|00003520| 72 65 65 20 61 6e 67 6c | 65 73 20 74 6f 20 6d 61 |ree angl|es to ma|
|00003530| 6b 65 20 61 20 54 72 61 | 6e 73 66 6f 72 6d 61 74 |ke a Tra|nsformat|
|00003540| 69 6f 6e 20 6d 61 74 72 | 69 78 2e 20 20 5b 53 65 |ion matr|ix. [Se|
|00003550| 65 20 74 68 65 0a 73 65 | 63 74 69 6f 6e 20 6f 6e |e the.se|ction on|
|00003560| 20 4d 61 74 72 69 78 20 | 4d 61 74 68 5d 2e 20 20 | Matrix |Math]. |
|00003570| 48 65 72 65 20 69 73 20 | 61 20 74 79 70 69 63 61 |Here is |a typica|
|00003580| 6c 20 6d 65 74 68 6f 64 | 20 6f 66 20 64 6f 69 6e |l method| of doin|
|00003590| 67 20 74 68 65 73 65 0a | 74 72 61 6e 73 66 6f 72 |g these.|transfor|
|000035a0| 6d 61 74 69 6f 6e 73 3a | 20 5b 4e 6f 74 65 2c 20 |mations:| [Note, |
|000035b0| 69 66 20 79 6f 75 20 64 | 6f 6e 27 74 20 68 61 76 |if you d|on't hav|
|000035c0| 65 20 5a 20 67 6f 69 6e | 67 20 69 6e 74 6f 20 79 |e Z goin|g into y|
|000035d0| 6f 75 72 20 73 63 72 65 | 65 6e 0a 79 6f 75 27 6c |our scre|en.you'l|
|000035e0| 6c 20 68 61 76 65 20 74 | 6f 20 6d 75 6e 67 65 20 |l have t|o munge |
|000035f0| 74 68 65 73 65 20 63 6f | 6e 73 69 64 65 72 61 62 |these co|nsiderab|
|00003600| 6c 79 5d 2e 0a 0a 20 20 | 20 20 20 20 20 20 74 79 |ly]... | ty|
|00003610| 70 65 64 65 66 20 64 6f | 75 62 6c 65 20 6d 61 74 |pedef do|uble mat|
|00003620| 72 69 78 5b 34 5d 5b 34 | 5d 3b 0a 0a 20 20 20 20 |rix[4][4|];.. |
|00003630| 20 20 20 20 64 6f 75 62 | 6c 65 20 73 72 2c 73 70 | doub|le sr,sp|
|00003640| 2c 73 79 2c 63 72 2c 63 | 70 2c 63 79 3b 0a 20 20 |,sy,cr,c|p,cy;. |
|00003650| 20 20 20 20 20 20 6d 61 | 74 72 69 78 20 6d 72 2c | ma|trix mr,|
|00003660| 20 6d 70 2c 20 6d 79 3b | 20 20 20 20 20 20 2f 2a | mp, my;| /*|
|00003670| 20 69 6e 64 69 76 69 64 | 75 61 6c 20 74 72 61 6e | individ|ual tran|
|00003680| 73 66 6f 72 6d 61 74 69 | 6f 6e 73 20 2a 2f 0a 20 |sformati|ons */. |
|00003690| 20 20 20 20 20 20 20 6d | 61 74 72 69 78 20 73 3b | m|atrix s;|
|000036a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|000036b0| 2a 20 66 69 6e 61 6c 20 | 6d 61 74 72 69 78 20 2a |* final |matrix *|
|000036c0| 2f 0a 0a 20 20 20 20 20 | 20 20 20 73 72 20 3d 20 |/.. | sr = |
|000036d0| 73 69 6e 28 20 72 6f 6c | 6c 20 29 3b 20 20 20 20 |sin( rol|l ); |
|000036e0| 20 63 72 20 3d 20 63 6f | 73 28 20 72 6f 6c 6c 20 | cr = co|s( roll |
|000036f0| 29 3b 0a 20 20 20 20 20 | 20 20 20 73 70 20 3d 20 |);. | sp = |
|00003700| 73 69 6e 28 20 70 69 74 | 63 68 20 29 3b 20 20 20 |sin( pit|ch ); |
|00003710| 20 63 70 20 3d 20 63 6f | 73 28 20 70 69 74 63 68 | cp = co|s( pitch|
|00003720| 20 29 3b 0a 20 20 20 20 | 20 20 20 20 73 79 20 3d | );. | sy =|
|00003730| 20 73 69 6e 28 20 79 61 | 77 20 29 3b 20 20 20 20 | sin( ya|w ); |
|00003740| 20 20 63 79 20 3d 20 63 | 6f 73 28 20 79 61 77 20 | cy = c|os( yaw |
|00003750| 29 3b 0a 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |);.. | |
|00003760| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003770| 20 20 20 20 2f 2a 20 63 | 6c 65 61 72 20 61 6c 6c | /* c|lear all|
|00003780| 20 6d 61 74 72 69 78 65 | 73 0a 20 20 20 20 20 20 | matrixe|s. |
|00003790| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000037a0| 20 20 20 20 20 20 20 20 | 20 20 2a 2a 20 5b 53 65 | | ** [Se|
|000037b0| 65 20 74 68 65 20 73 65 | 63 74 69 6f 6e 20 6f 6e |e the se|ction on|
|000037c0| 20 4d 61 74 72 69 78 20 | 4d 61 74 68 5d 0a 20 20 | Matrix |Math]. |
|000037d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000037e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2a 2f | | */|
|000037f0| 0a 20 20 20 20 20 20 20 | 20 69 64 65 6e 74 69 74 |. | identit|
|00003800| 79 28 20 26 6d 72 20 29 | 3b 20 69 64 65 6e 74 69 |y( &mr )|; identi|
|00003810| 74 79 28 20 26 6d 70 20 | 29 3b 20 69 64 65 6e 74 |ty( &mp |); ident|
|00003820| 69 74 79 28 20 26 6d 79 | 20 29 3b 0a 20 20 20 20 |ity( &my| );. |
|00003830| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003840| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 70 | | /* p|
|00003850| 72 65 70 61 72 65 20 72 | 6f 6c 6c 20 6d 61 74 72 |repare r|oll matr|
|00003860| 69 78 20 2a 2f 0a 20 20 | 20 20 20 20 20 20 6d 72 |ix */. | mr|
|00003870| 5b 30 5d 5b 30 5d 20 3d | 20 6d 72 5b 31 5d 5b 31 |[0][0] =| mr[1][1|
|00003880| 5d 20 3d 20 63 72 3b 0a | 20 20 20 20 20 20 20 20 |] = cr;.| |
|00003890| 6d 72 5b 31 5d 5b 30 5d | 20 3d 20 2d 20 28 6d 72 |mr[1][0]| = - (mr|
|000038a0| 5b 30 5d 5b 31 5d 20 3d | 20 73 72 29 3b 0a 0a 20 |[0][1] =| sr);.. |
|000038b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000038c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|000038d0| 2a 20 70 72 65 70 61 72 | 65 20 70 69 74 63 68 20 |* prepar|e pitch |
|000038e0| 6d 61 74 72 69 78 20 2a | 2f 0a 20 20 20 20 20 20 |matrix *|/. |
|000038f0| 20 20 6d 70 5b 31 5d 5b | 31 5d 20 3d 20 6d 70 5b | mp[1][|1] = mp[|
|00003900| 32 5d 5b 32 5d 20 3d 20 | 63 70 3b 0a 20 20 20 20 |2][2] = |cp;. |
|00003910| 20 20 20 20 6d 70 5b 31 | 5d 5b 32 5d 20 3d 20 2d | mp[1|][2] = -|
|00003920| 20 28 6d 70 5b 32 5d 5b | 31 5d 20 3d 20 73 70 29 | (mp[2][|1] = sp)|
|00003930| 3b 0a 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |;.. | |
|00003940| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003950| 20 20 20 2f 2a 20 70 72 | 65 70 61 72 65 20 79 61 | /* pr|epare ya|
|00003960| 77 20 6d 61 74 72 69 78 | 20 2a 2f 0a 20 20 20 20 |w matrix| */. |
|00003970| 20 20 20 20 6d 79 5b 30 | 5d 5b 30 5d 20 3d 20 6d | my[0|][0] = m|
|00003980| 79 5b 32 5d 5b 32 5d 20 | 3d 20 63 79 3b 0a 20 20 |y[2][2] |= cy;. |
|00003990| 20 20 20 20 20 20 6d 79 | 5b 30 5d 5b 32 5d 20 3d | my|[0][2] =|
|000039a0| 20 2d 20 28 6d 79 5b 32 | 5d 5b 30 5d 20 3d 20 73 | - (my[2|][0] = s|
|000039b0| 79 29 3b 0a 0a 20 20 20 | 20 20 20 20 20 6d 75 6c |y);.. | mul|
|000039c0| 74 69 70 6c 79 28 20 26 | 6d 72 2c 20 26 6d 79 2c |tiply( &|mr, &my,|
|000039d0| 20 26 73 20 29 3b 0a 20 | 20 20 20 20 20 20 20 6d | &s );. | m|
|000039e0| 75 6c 74 69 70 6c 79 28 | 20 26 73 2c 20 26 6d 70 |ultiply(| &s, &mp|
|000039f0| 2c 20 26 73 20 29 3b 0a | 0a 36 29 20 48 6f 77 20 |, &s );.|.6) How |
|00003a00| 64 6f 20 49 20 64 65 66 | 69 6e 65 20 61 20 76 65 |do I def|ine a ve|
|00003a10| 6c 6f 63 69 74 79 3f 0a | 0a 53 74 69 63 6b 79 20 |locity?.|.Sticky |
|00003a20| 71 75 65 73 74 69 6f 6e | 2e 20 20 49 27 6c 6c 20 |question|. I'll |
|00003a30| 67 65 74 20 74 6f 20 69 | 74 20 69 6e 20 74 68 65 |get to i|t in the|
|00003a40| 20 6e 65 78 74 20 72 65 | 76 2e 0a 0a 37 29 20 44 | next re|v...7) D|
|00003a50| 72 61 77 69 6e 67 20 74 | 68 72 65 65 2d 64 69 6d |rawing t|hree-dim|
|00003a60| 65 6e 73 69 6f 6e 61 6c | 20 6f 62 6a 65 63 74 73 |ensional| objects|
|00003a70| 20 6f 6e 20 61 20 74 77 | 6f 2d 64 69 6d 65 6e 73 | on a tw|o-dimens|
|00003a80| 69 6f 6e 61 6c 20 73 63 | 72 65 65 6e 2e 0a 0a 20 |ional sc|reen... |
|00003a90| 20 20 20 20 4d 6f 64 69 | 66 69 65 64 20 66 72 6f | Modi|fied fro|
|00003aa0| 6d 20 63 6f 6d 70 2e 67 | 72 61 70 68 69 63 73 20 |m comp.g|raphics |
|00003ab0| 46 41 51 3a 0a 0a 20 20 | 20 20 20 22 54 68 65 72 |FAQ:.. | "Ther|
|00003ac0| 65 20 61 72 65 20 6d 61 | 6e 79 20 77 61 79 73 20 |e are ma|ny ways |
|00003ad0| 74 6f 20 64 6f 20 74 68 | 69 73 2e 20 20 53 6f 6d |to do th|is. Som|
|00003ae0| 65 20 61 70 70 72 6f 61 | 63 68 65 73 20 6d 61 70 |e approa|ches map|
|00003af0| 20 74 68 65 0a 20 20 20 | 20 20 76 69 65 77 69 6e | the. | viewin|
|00003b00| 67 20 72 65 63 74 61 6e | 67 6c 65 20 6f 6e 74 6f |g rectan|gle onto|
|00003b10| 20 74 68 65 20 73 63 65 | 6e 65 2c 20 62 79 20 73 | the sce|ne, by s|
|00003b20| 68 6f 6f 74 69 6e 67 20 | 72 61 79 73 20 74 68 72 |hooting |rays thr|
|00003b30| 6f 75 67 68 0a 20 20 20 | 20 20 65 61 63 68 20 70 |ough. | each p|
|00003b40| 69 78 65 6c 20 63 65 6e | 74 65 72 20 61 6e 64 20 |ixel cen|ter and |
|00003b50| 61 73 73 69 67 6e 69 6e | 67 20 63 6f 6c 6f 72 20 |assignin|g color |
|00003b60| 61 63 63 6f 72 64 69 6e | 67 20 74 6f 20 74 68 65 |accordin|g to the|
|00003b70| 20 6f 62 6a 65 63 74 0a | 20 20 20 20 20 68 69 74 | object.| hit|
|00003b80| 20 62 79 20 74 68 65 20 | 72 61 79 2e 20 20 4f 74 | by the |ray. Ot|
|00003b90| 68 65 72 20 61 70 70 72 | 6f 61 63 68 65 73 20 6d |her appr|oaches m|
|00003ba0| 61 70 20 74 68 65 20 73 | 63 65 6e 65 20 6f 6e 74 |ap the s|cene ont|
|00003bb0| 6f 20 74 68 65 0a 20 20 | 20 20 20 76 69 65 77 69 |o the. | viewi|
|00003bc0| 6e 67 20 72 65 63 74 61 | 6e 67 6c 65 2c 20 62 79 |ng recta|ngle, by|
|00003bd0| 20 64 72 61 77 69 6e 67 | 20 65 61 63 68 20 6f 62 | drawing| each ob|
|00003be0| 6a 65 63 74 20 69 6e 74 | 6f 20 74 68 65 20 72 65 |ject int|o the re|
|00003bf0| 67 69 6f 6e 2c 0a 20 20 | 20 20 20 6b 65 65 70 69 |gion,. | keepi|
|00003c00| 6e 67 20 74 72 61 63 6b | 20 6f 66 20 77 68 69 63 |ng track| of whic|
|00003c10| 68 20 6f 62 6a 65 63 74 | 20 69 73 20 69 6e 20 66 |h object| is in f|
|00003c20| 72 6f 6e 74 20 6f 66 20 | 77 68 69 63 68 2e 0a 0a |ront of |which...|
|00003c30| 20 20 20 20 20 54 68 65 | 20 6d 61 70 70 69 6e 67 | The| mapping|
|00003c40| 20 6d 65 6e 74 69 6f 6e | 65 64 20 61 62 6f 76 65 | mention|ed above|
|00003c50| 20 69 73 20 61 6c 73 6f | 20 72 65 66 65 72 72 65 | is also| referre|
|00003c60| 64 20 74 6f 20 61 73 20 | 61 0a 20 20 20 20 20 27 |d to as |a. '|
|00003c70| 70 72 6f 6a 65 63 74 69 | 6f 6e 27 2c 20 61 6e 64 |projecti|on', and|
|00003c80| 20 74 68 65 20 74 77 6f | 20 6d 6f 73 74 20 70 6f | the two| most po|
|00003c90| 70 75 6c 61 72 20 70 72 | 6f 6a 65 63 74 69 6f 6e |pular pr|ojection|
|00003ca0| 73 20 61 72 65 0a 20 20 | 20 20 20 70 65 72 73 70 |s are. | persp|
|00003cb0| 65 63 74 69 76 65 20 70 | 72 6f 6a 65 63 74 69 6f |ective p|rojectio|
|00003cc0| 6e 20 61 6e 64 20 70 61 | 72 61 6c 6c 65 6c 20 70 |n and pa|rallel p|
|00003cd0| 72 6f 6a 65 63 74 69 6f | 6e 2e 20 20 46 6f 72 20 |rojectio|n. For |
|00003ce0| 65 78 61 6d 70 6c 65 2c | 0a 20 20 20 20 20 74 6f |example,|. to|
|00003cf0| 20 64 6f 20 61 20 70 61 | 72 61 6c 6c 65 6c 20 70 | do a pa|rallel p|
|00003d00| 72 6f 6a 65 63 74 69 6f | 6e 20 6f 66 20 61 20 73 |rojectio|n of a s|
|00003d10| 63 65 6e 65 20 6f 6e 74 | 6f 20 61 20 76 69 65 77 |cene ont|o a view|
|00003d20| 69 6e 67 0a 20 20 20 20 | 20 72 65 63 74 61 6e 67 |ing. | rectang|
|00003d30| 6c 65 2c 20 79 6f 75 20 | 63 61 6e 20 6a 75 73 74 |le, you |can just|
|00003d40| 20 64 69 73 63 61 72 64 | 20 74 68 65 20 5a 20 63 | discard| the Z c|
|00003d50| 6f 6f 72 64 69 6e 61 74 | 65 2c 20 61 6e 64 20 27 |oordinat|e, and '|
|00003d60| 63 6c 69 70 27 0a 20 20 | 20 20 20 74 68 65 20 6f |clip'. | the o|
|00003d70| 62 6a 65 63 74 73 20 74 | 6f 20 74 68 65 20 76 69 |bjects t|o the vi|
|00003d80| 65 77 69 6e 67 20 72 65 | 63 74 61 6e 67 6c 65 20 |ewing re|ctangle |
|00003d90| 28 64 69 73 63 61 72 64 | 20 70 6f 72 74 69 6f 6e |(discard| portion|
|00003da0| 73 20 74 68 61 74 0a 20 | 20 20 20 20 6c 69 65 20 |s that. | lie |
|00003db0| 6f 75 74 73 69 64 65 20 | 74 68 65 20 72 65 67 69 |outside |the regi|
|00003dc0| 6f 6e 29 2e 20 20 54 6f | 20 64 6f 20 61 20 70 65 |on). To| do a pe|
|00003dd0| 72 73 70 65 63 74 69 76 | 65 20 70 72 6f 6a 65 63 |rspectiv|e projec|
|00003de0| 74 69 6f 6e 2c 0a 20 20 | 20 20 20 64 69 76 69 64 |tion,. | divid|
|00003df0| 69 6e 67 20 65 61 63 68 | 20 74 68 65 20 78 20 61 |ing each| the x a|
|00003e00| 6e 64 20 74 68 65 20 79 | 20 62 79 20 73 6f 6d 65 |nd the y| by some|
|00003e10| 20 6d 75 6c 74 69 70 6c | 65 20 6f 72 20 74 68 65 | multipl|e or the|
|00003e20| 20 5a 2d 64 65 70 74 68 | 0a 20 20 20 20 20 69 73 | Z-depth|. is|
|00003e30| 20 74 68 65 20 75 73 75 | 61 6c 20 61 70 70 72 6f | the usu|al appro|
|00003e40| 61 63 68 2e 0a 0a 20 20 | 20 20 20 46 6f 72 20 64 |ach... | For d|
|00003e50| 65 74 61 69 6c 73 20 6f | 6e 20 33 44 20 72 65 6e |etails o|n 3D ren|
|00003e60| 64 65 72 69 6e 67 2c 20 | 74 68 65 20 46 6f 6c 65 |dering, |the Fole|
|00003e70| 79 2c 20 76 61 6e 20 44 | 61 6d 2c 20 46 65 69 6e |y, van D|am, Fein|
|00003e80| 65 72 20 61 6e 64 0a 20 | 20 20 20 20 48 75 67 68 |er and. | Hugh|
|00003e90| 65 73 20 62 6f 6f 6b 2c | 20 72 65 61 64 69 6e 67 |es book,| reading|
|00003ea0| 2e 20 20 43 68 61 70 74 | 65 72 20 36 20 69 73 20 |. Chapt|er 6 is |
|00003eb0| 27 56 69 65 77 69 6e 67 | 20 69 6e 20 33 44 27 2c |'Viewing| in 3D',|
|00003ec0| 20 61 6e 64 0a 20 20 20 | 20 20 63 68 61 70 74 65 | and. | chapte|
|00003ed0| 72 20 31 35 20 69 73 20 | 27 56 69 73 69 62 6c 65 |r 15 is |'Visible|
|00003ee0| 2d 53 75 72 66 61 63 65 | 20 44 65 74 65 72 6d 69 |-Surface| Determi|
|00003ef0| 6e 61 74 69 6f 6e 27 2e | 20 20 46 6f 72 20 6d 6f |nation'.| For mo|
|00003f00| 72 65 0a 20 20 20 20 20 | 69 6e 66 6f 72 6d 61 74 |re. |informat|
|00003f10| 69 6f 6e 20 67 6f 20 74 | 6f 20 63 68 61 70 74 65 |ion go t|o chapte|
|00003f20| 72 20 31 36 20 66 6f 72 | 20 73 68 61 64 69 6e 67 |r 16 for| shading|
|00003f30| 2c 20 63 68 61 70 74 65 | 72 20 31 39 20 66 6f 72 |, chapte|r 19 for|
|00003f40| 0a 20 20 20 20 20 63 6c | 69 70 70 69 6e 67 2c 20 |. cl|ipping, |
|00003f50| 61 6e 64 20 62 72 61 6e | 63 68 20 6f 75 74 20 66 |and bran|ch out f|
|00003f60| 72 6f 6d 20 74 68 65 72 | 65 2e 22 0a 0a 38 29 20 |rom ther|e."..8) |
|00003f70| 56 65 63 74 6f 72 20 4d | 61 74 68 20 2d 20 44 6f |Vector M|ath - Do|
|00003f80| 74 20 50 72 6f 64 75 63 | 74 20 61 6e 64 20 43 72 |t Produc|t and Cr|
|00003f90| 6f 73 73 2d 50 72 6f 64 | 75 63 74 2e 0a 0a 20 20 |oss-Prod|uct... |
|00003fa0| 20 20 20 41 64 64 69 6e | 67 20 61 6e 64 20 73 75 | Addin|g and su|
|00003fb0| 62 74 72 61 63 74 69 6e | 67 20 76 65 63 74 6f 72 |btractin|g vector|
|00003fc0| 73 20 69 73 20 61 73 20 | 65 61 73 79 20 61 73 20 |s is as |easy as |
|00003fd0| 73 75 62 74 72 61 63 74 | 69 6e 67 20 74 68 65 69 |subtract|ing thei|
|00003fe0| 72 0a 72 65 73 70 65 63 | 74 69 76 65 20 70 61 72 |r.respec|tive par|
|00003ff0| 74 73 3a 0a 0a 20 20 20 | 20 20 20 20 20 3c 41 2c |ts:.. | <A,|
|00004000| 42 2c 43 3e 20 2b 20 3c | 44 2c 45 2c 46 3e 20 3d |B,C> + <|D,E,F> =|
|00004010| 20 3c 41 2b 44 2c 20 42 | 2b 45 2c 20 43 2b 46 3e | <A+D, B|+E, C+F>|
|00004020| 0a 20 20 20 20 20 20 20 | 20 3c 41 2c 42 2c 43 3e |. | <A,B,C>|
|00004030| 20 2d 20 3c 44 2c 45 2c | 46 3e 20 3d 20 3c 41 2d | - <D,E,|F> = <A-|
|00004040| 44 2c 20 42 2d 45 2c 20 | 43 2d 46 3e 0a 0a 20 20 |D, B-E, |C-F>.. |
|00004050| 20 20 20 53 63 61 6c 69 | 6e 67 20 76 65 63 74 6f | Scali|ng vecto|
|00004060| 72 73 20 69 73 20 61 73 | 20 73 69 6d 70 6c 65 20 |rs is as| simple |
|00004070| 61 73 20 6d 75 6c 74 69 | 70 6c 79 69 6e 67 20 65 |as multi|plying e|
|00004080| 61 63 68 20 70 61 72 74 | 20 62 79 20 61 0a 63 6f |ach part| by a.co|
|00004090| 6e 73 74 61 6e 74 3a 0a | 0a 20 20 20 20 20 20 20 |nstant:.|. |
|000040a0| 20 53 20 2a 20 3c 41 2c | 42 2c 43 3e 20 3d 20 3c | S * <A,|B,C> = <|
|000040b0| 53 2a 41 2c 20 53 2a 42 | 2c 20 53 2a 43 3e 0a 0a |S*A, S*B|, S*C>..|
|000040c0| 20 20 20 20 20 54 68 65 | 20 44 6f 74 2d 50 72 6f | The| Dot-Pro|
|000040d0| 64 75 63 74 20 6f 66 20 | 74 77 6f 20 76 65 63 74 |duct of |two vect|
|000040e0| 6f 72 73 20 69 73 20 73 | 69 6d 70 6c 79 20 74 68 |ors is s|imply th|
|000040f0| 65 20 73 75 6d 20 6f 66 | 20 74 68 65 20 70 72 6f |e sum of| the pro|
|00004100| 64 75 63 74 73 20 6f 66 | 0a 74 68 65 69 72 20 72 |ducts of|.their r|
|00004110| 65 73 70 65 63 74 69 76 | 65 20 70 61 72 74 73 3a |espectiv|e parts:|
|00004120| 0a 0a 20 20 20 20 20 20 | 20 20 3c 41 2c 42 2c 43 |.. | <A,B,C|
|00004130| 3e 20 2e 20 3c 44 2c 45 | 2c 46 3e 20 3d 20 41 2a |> . <D,E|,F> = A*|
|00004140| 44 20 2b 20 42 2a 45 20 | 2b 20 43 2a 46 0a 0a 4e |D + B*E |+ C*F..N|
|00004150| 6f 74 65 20 74 68 61 74 | 20 74 68 69 73 20 76 61 |ote that| this va|
|00004160| 6c 75 65 20 69 73 20 6e | 6f 74 20 61 20 76 65 63 |lue is n|ot a vec|
|00004170| 74 6f 72 2e 0a 0a 20 20 | 20 20 20 54 68 65 20 43 |tor... | The C|
|00004180| 72 6f 73 73 2d 50 72 6f | 64 75 63 74 20 6f 66 20 |ross-Pro|duct of |
|00004190| 74 77 6f 20 76 65 63 74 | 6f 72 73 20 69 73 20 61 |two vect|ors is a|
|000041a0| 20 62 69 74 20 6d 6f 72 | 65 20 63 6f 6d 70 6c 65 | bit mor|e comple|
|000041b0| 78 20 28 69 74 20 69 73 | 20 74 68 65 0a 64 65 74 |x (it is| the.det|
|000041c0| 65 72 6d 69 6e 61 6e 74 | 20 6f 66 20 74 68 65 20 |erminant| of the |
|000041d0| 6d 61 74 72 69 78 20 77 | 69 74 68 20 74 68 65 20 |matrix w|ith the |
|000041e0| 64 69 72 65 63 74 69 6f | 6e 20 76 65 63 74 6f 72 |directio|n vector|
|000041f0| 20 61 73 20 74 68 65 20 | 66 69 72 73 74 20 72 6f | as the |first ro|
|00004200| 77 2c 0a 74 68 65 20 66 | 69 72 73 74 20 76 65 63 |w,.the f|irst vec|
|00004210| 74 6f 72 20 61 73 20 74 | 68 65 20 73 65 63 6f 6e |tor as t|he secon|
|00004220| 64 20 72 6f 77 2c 20 61 | 6e 64 20 74 68 65 20 73 |d row, a|nd the s|
|00004230| 65 63 6f 6e 64 20 76 65 | 63 74 6f 72 20 61 73 20 |econd ve|ctor as |
|00004240| 74 68 65 20 74 68 69 72 | 64 0a 72 6f 77 29 3a 0a |the thir|d.row):.|
|00004250| 0a 20 20 20 20 20 20 20 | 20 3c 41 2c 42 2c 43 3e |. | <A,B,C>|
|00004260| 20 58 20 3c 44 2c 45 2c | 46 3e 20 3d 20 3c 42 2a | X <D,E,|F> = <B*|
|00004270| 46 20 2d 20 43 2a 45 2c | 20 43 2a 44 20 2d 20 41 |F - C*E,| C*D - A|
|00004280| 2a 46 2c 20 41 2a 45 20 | 2d 20 42 2a 44 3e 0a 0a |*F, A*E |- B*D>..|
|00004290| 4e 6f 74 65 20 74 68 61 | 74 3a 0a 0a 3c 41 2c 42 |Note tha|t:..<A,B|
|000042a0| 2c 43 3e 20 58 20 3c 44 | 2c 45 2c 46 3e 20 3d 20 |,C> X <D|,E,F> = |
|000042b0| 2d 31 20 2a 20 28 20 3c | 44 2c 45 2c 46 3e 20 58 |-1 * ( <|D,E,F> X|
|000042c0| 20 3c 41 2c 42 2c 43 3e | 20 29 0a 20 20 20 20 20 | <A,B,C>| ). |
|000042d0| 20 20 20 2d 61 6e 64 2d | 0a 28 3c 41 2c 42 2c 43 | -and-|.(<A,B,C|
|000042e0| 3e 20 58 20 3c 44 2c 45 | 2c 46 3e 29 20 2e 20 3c |> X <D,E|,F>) . <|
|000042f0| 41 2c 42 2c 43 3e 20 3d | 20 28 3c 41 2c 42 2c 43 |A,B,C> =| (<A,B,C|
|00004300| 3e 20 58 20 3c 44 2c 45 | 2c 46 3e 29 20 2e 20 3c |> X <D,E|,F>) . <|
|00004310| 44 2c 45 2c 46 3e 20 3d | 20 30 0a 0a 20 20 20 20 |D,E,F> =| 0.. |
|00004320| 20 4d 6f 72 65 20 6c 61 | 74 65 72 2e 0a 0a 39 29 | More la|ter...9)|
|00004330| 20 4d 61 74 72 69 78 20 | 4d 61 74 68 0a 0a 20 20 | Matrix |Math.. |
|00004340| 20 20 20 54 68 65 20 69 | 64 65 6e 74 69 74 79 20 | The i|dentity |
|00004350| 6d 61 74 72 69 78 20 69 | 73 20 61 20 73 71 75 61 |matrix i|s a squa|
|00004360| 72 65 20 6d 61 74 72 69 | 78 20 28 73 61 6d 65 20 |re matri|x (same |
|00004370| 6e 75 6d 62 65 72 20 6f | 66 20 72 6f 77 73 20 61 |number o|f rows a|
|00004380| 73 0a 63 6f 6c 75 6d 6e | 73 29 20 77 69 74 68 20 |s.column|s) with |
|00004390| 61 6c 6c 20 65 6c 65 6d | 65 6e 74 73 20 7b 69 2c |all elem|ents {i,|
|000043a0| 6a 7d 20 67 69 76 65 6e | 20 62 79 3a 0a 0a 20 20 |j} given| by:.. |
|000043b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000043c0| 7b 20 31 2e 30 20 20 20 | 69 66 20 69 20 3d 3d 20 |{ 1.0 |if i == |
|000043d0| 6a 0a 20 20 20 20 20 20 | 20 20 6d 5b 69 5d 5b 6a |j. | m[i][j|
|000043e0| 5d 20 3d 20 7b 0a 20 20 | 20 20 20 20 20 20 20 20 |] = {. | |
|000043f0| 20 20 20 20 20 20 20 20 | 7b 20 30 2e 30 20 20 20 | |{ 0.0 |
|00004400| 6f 74 68 65 72 77 69 73 | 65 0a 0a 20 20 20 20 20 |otherwis|e.. |
|00004410| 4d 75 6c 74 69 70 6c 69 | 63 61 74 69 6f 6e 20 6f |Multipli|cation o|
|00004420| 66 20 6d 61 74 72 69 63 | 65 73 3a 0a 0a 20 20 20 |f matric|es:.. |
|00004430| 20 69 66 20 58 20 69 73 | 20 61 20 6d 61 74 72 69 | if X is| a matri|
|00004440| 78 20 74 68 61 74 20 69 | 73 20 6d 20 72 6f 77 73 |x that i|s m rows|
|00004450| 20 61 6e 64 20 6e 20 63 | 6f 6c 75 6d 6e 73 20 28 | and n c|olumns (|
|00004460| 61 6e 20 6d 2d 62 79 2d | 6e 20 28 6f 72 20 6d 78 |an m-by-|n (or mx|
|00004470| 6e 29 20 6d 61 74 72 69 | 78 29 0a 20 20 20 20 61 |n) matri|x). a|
|00004480| 6e 64 20 59 20 69 73 20 | 61 20 6d 61 74 72 69 78 |nd Y is |a matrix|
|00004490| 20 74 68 61 74 20 69 73 | 20 6e 20 72 6f 77 73 20 | that is| n rows |
|000044a0| 61 6e 64 20 72 20 63 6f | 6c 75 6d 6e 73 20 28 6e |and r co|lumns (n|
|000044b0| 78 72 29 2c 20 74 68 65 | 6e 20 74 68 65 20 70 72 |xr), the|n the pr|
|000044c0| 6f 64 75 63 74 0a 20 20 | 20 20 58 20 2a 20 59 20 |oduct. | X * Y |
|000044d0| 3d 3d 3e 20 6d 5b 69 5d | 5b 6a 5d 20 3d 20 73 75 |==> m[i]|[j] = su|
|000044e0| 6d 7b 20 61 3d 30 2c 20 | 61 3c 6e 2c 20 58 5b 69 |m{ a=0, |a<n, X[i|
|000044f0| 5d 5b 61 5d 20 2a 20 59 | 5b 61 5d 5b 6a 5d 20 7d |][a] * Y|[a][j] }|
|00004500| 3b 0a 0a 41 73 20 79 6f | 75 20 63 61 6e 20 73 65 |;..As yo|u can se|
|00004510| 65 20 69 6e 20 74 68 69 | 73 20 65 78 61 6d 70 6c |e in thi|s exampl|
|00004520| 65 2c 20 74 68 65 20 72 | 65 73 75 6c 74 20 69 73 |e, the r|esult is|
|00004530| 20 61 20 6d 61 74 72 69 | 78 20 77 69 74 68 20 6d | a matri|x with m|
|00004540| 20 72 6f 77 73 20 61 6e | 64 20 72 0a 63 6f 6c 75 | rows an|d r.colu|
|00004550| 6d 6e 73 20 28 61 6e 20 | 6d 78 72 29 20 6d 61 74 |mns (an |mxr) mat|
|00004560| 72 69 78 2e 20 20 54 68 | 65 20 6d 6f 73 74 20 75 |rix. Th|e most u|
|00004570| 73 75 61 6c 20 63 61 73 | 65 20 69 6e 20 62 61 73 |sual cas|e in bas|
|00004580| 69 63 20 33 2d 64 20 67 | 72 61 70 68 69 63 73 20 |ic 3-d g|raphics |
|00004590| 69 73 0a 6d 75 6c 74 69 | 70 6c 69 63 61 74 69 6f |is.multi|plicatio|
|000045a0| 6e 20 6f 66 20 33 78 33 | 20 6f 72 20 34 78 34 20 |n of 3x3| or 4x4 |
|000045b0| 6d 61 74 72 69 63 65 73 | 20 74 6f 20 65 61 63 68 |matrices| to each|
|000045c0| 20 6f 74 68 65 72 2e 0a | 0a 20 20 20 20 20 53 6f | other..|. So|
|000045d0| 6d 65 20 69 6d 70 6f 72 | 74 61 6e 74 20 74 68 69 |me impor|tant thi|
|000045e0| 6e 67 73 20 74 6f 20 72 | 65 6d 65 6d 62 65 72 20 |ngs to r|emember |
|000045f0| 61 62 6f 75 74 20 6d 61 | 74 72 69 78 20 6d 75 6c |about ma|trix mul|
|00004600| 74 69 70 6c 69 63 61 74 | 69 6f 6e 3a 20 28 54 68 |tiplicat|ion: (Th|
|00004610| 65 0a 66 6f 6c 6c 6f 77 | 69 6e 67 20 61 73 73 75 |e.follow|ing assu|
|00004620| 6d 65 20 58 20 61 6e 64 | 20 59 20 61 6e 64 20 5a |me X and| Y and Z|
|00004630| 20 61 72 65 20 6d 61 74 | 72 69 63 65 73 20 61 6e | are mat|rices an|
|00004640| 64 20 49 20 69 73 20 61 | 6e 20 69 64 65 6e 74 69 |d I is a|n identi|
|00004650| 74 79 20 6d 61 74 72 69 | 78 29 0a 0a 20 20 20 20 |ty matri|x).. |
|00004660| 58 20 2a 20 59 20 72 61 | 72 65 6c 79 20 65 71 75 |X * Y ra|rely equ|
|00004670| 61 6c 73 20 59 20 2a 20 | 58 2e 20 20 62 75 74 2c |als Y * |X. but,|
|00004680| 0a 20 20 20 20 58 20 2a | 20 28 20 59 20 2a 20 5a |. X *| ( Y * Z|
|00004690| 20 29 20 20 65 71 75 61 | 6c 73 20 28 20 58 20 2a | ) equa|ls ( X *|
|000046a0| 20 59 20 29 20 2a 20 5a | 0a 0a 20 20 20 20 58 20 | Y ) * Z|.. X |
|000046b0| 2a 20 49 20 3d 20 49 20 | 2a 20 58 20 3d 20 58 0a |* I = I |* X = X.|
|000046c0| 0a 20 20 20 20 69 66 20 | 28 58 20 2a 20 59 20 3d |. if |(X * Y =|
|000046d0| 20 49 29 20 74 68 65 6e | 20 28 59 20 2a 20 58 20 | I) then| (Y * X |
|000046e0| 3d 20 49 29 0a 0a 20 20 | 20 20 20 4d 75 6c 74 69 |= I).. | Multi|
|000046f0| 70 6c 69 63 61 74 69 6f | 6e 20 6f 66 20 61 20 4d |plicatio|n of a M|
|00004700| 61 74 72 69 78 20 61 6e | 64 20 61 20 56 65 63 74 |atrix an|d a Vect|
|00004710| 6f 72 20 69 73 20 73 69 | 6d 70 6c 79 20 61 20 73 |or is si|mply a s|
|00004720| 70 65 63 69 61 6c 20 63 | 61 73 65 20 6f 66 0a 6d |pecial c|ase of.m|
|00004730| 75 6c 74 69 70 6c 79 69 | 6e 67 20 74 77 6f 20 6d |ultiplyi|ng two m|
|00004740| 61 74 72 69 78 65 73 2e | 20 20 49 74 20 6a 75 73 |atrixes.| It jus|
|00004750| 74 20 73 6f 20 68 61 70 | 70 65 6e 73 20 74 68 61 |t so hap|pens tha|
|00004760| 74 20 61 20 76 65 63 74 | 6f 72 20 69 73 20 61 20 |t a vect|or is a |
|00004770| 6d 61 74 72 69 78 0a 77 | 69 74 68 20 6f 6e 6c 79 |matrix.w|ith only|
|00004780| 20 6f 6e 65 20 63 6f 6c | 75 6d 6e 2e 20 20 53 6f | one col|umn. So|
|00004790| 2c 20 69 6e 20 6f 72 64 | 65 72 20 74 6f 20 6d 75 |, in ord|er to mu|
|000047a0| 6c 74 69 70 6c 79 20 61 | 6e 20 6d 78 6e 20 6d 61 |ltiply a|n mxn ma|
|000047b0| 74 72 69 78 20 62 79 20 | 61 0a 76 65 63 74 6f 72 |trix by |a.vector|
|000047c0| 2c 20 79 6f 75 20 68 61 | 76 65 20 74 6f 20 68 61 |, you ha|ve to ha|
|000047d0| 76 65 20 61 6e 20 6e 78 | 31 20 6d 61 74 72 69 78 |ve an nx|1 matrix|
|000047e0| 20 28 22 61 6e 20 6e 2d | 76 65 63 74 6f 72 22 20 | ("an n-|vector" |
|000047f0| 6f 72 20 22 61 20 76 65 | 63 74 6f 72 20 69 6e 0a |or "a ve|ctor in.|
|00004800| 6e 22 29 2e 20 20 54 68 | 65 20 72 65 73 75 6c 74 |n"). Th|e result|
|00004810| 20 69 73 20 61 20 76 65 | 63 74 6f 72 20 69 6e 20 | is a ve|ctor in |
|00004820| 6d 2e 20 20 41 73 20 61 | 20 71 75 69 63 6b 20 65 |m. As a| quick e|
|00004830| 78 61 6d 70 6c 65 3a 0a | 0a 20 20 20 20 5b 20 61 |xample:.|. [ a|
|00004840| 20 62 20 5d 20 20 20 5b | 20 67 20 5d 20 20 20 5b | b ] [| g ] [|
|00004850| 20 61 2a 67 20 2b 20 62 | 2a 68 20 5d 0a 20 20 20 | a*g + b|*h ]. |
|00004860| 20 5b 20 63 20 64 20 5d | 20 78 20 5b 20 68 20 5d | [ c d ]| x [ h ]|
|00004870| 20 3d 20 5b 20 63 2a 67 | 20 2b 20 64 2a 68 20 5d | = [ c*g| + d*h ]|
|00004880| 0a 20 20 20 20 5b 20 65 | 20 66 20 5d 20 20 20 20 |. [ e| f ] |
|00004890| 20 20 20 20 20 20 20 5b | 20 65 2a 67 20 2b 20 66 | [| e*g + f|
|000048a0| 2a 68 20 5d 0a 0a 31 30 | 29 20 43 6f 6c 6c 69 73 |*h ]..10|) Collis|
|000048b0| 69 6f 6e 73 2e 0a 0a 20 | 20 20 20 20 53 6f 72 72 |ions... | Sorr|
|000048c0| 79 2e 2e 2e 20 54 68 69 | 73 20 69 73 20 61 20 46 |y... Thi|s is a F|
|000048d0| 41 51 20 69 6e 2d 70 72 | 6f 67 72 65 73 73 2e 20 |AQ in-pr|ogress. |
|000048e0| 20 57 69 6c 6c 20 64 6f | 20 6d 6f 72 65 20 6c 61 | Will do| more la|
|000048f0| 74 65 72 2e 20 20 50 6c | 65 61 73 65 0a 66 65 65 |ter. Pl|ease.fee|
|00004900| 6c 20 66 72 65 65 20 74 | 6f 20 73 65 6e 64 20 6d |l free t|o send m|
|00004910| 65 20 61 20 70 61 72 61 | 67 72 61 70 68 20 66 6f |e a para|graph fo|
|00004920| 72 20 74 68 69 73 20 73 | 65 63 74 69 6f 6e 2e 0a |r this s|ection..|
|00004930| 0a 31 31 29 20 50 65 72 | 73 70 65 63 74 69 76 65 |.11) Per|spective|
|00004940| 2e 0a 0a 28 4d 65 73 73 | 61 67 65 20 6e 6f 76 61 |...(Mess|age nova|
|00004950| 3a 32 37 34 36 29 0a 46 | 72 6f 6d 3a 20 52 61 75 |:2746).F|rom: Rau|
|00004960| 6c 20 44 65 6c 75 74 68 | 20 4d 69 6c 6c 65 72 20 |l Deluth| Miller |
|00004970| 3c 72 6f 63 6b 77 65 6c | 6c 40 6e 6f 76 61 2e 75 |<rockwel|l@nova.u|
|00004980| 6d 64 2e 65 64 75 3e 0a | 0a 20 20 20 20 20 50 65 |md.edu>.|. Pe|
|00004990| 72 73 70 65 63 74 69 76 | 65 20 69 73 20 65 61 73 |rspectiv|e is eas|
|000049a0| 79 3a 20 72 65 61 6c 69 | 7a 65 20 74 68 61 74 20 |y: reali|ze that |
|000049b0| 74 68 65 20 76 69 65 77 | 70 6f 69 6e 74 20 69 73 |the view|point is|
|000049c0| 6e 27 74 20 6f 6e 20 74 | 68 65 0a 73 75 72 66 61 |n't on t|he.surfa|
|000049d0| 63 65 20 6f 66 20 74 68 | 65 20 73 63 72 65 65 6e |ce of th|e screen|
|000049e0| 20 62 75 74 20 69 73 20 | 73 6f 6d 65 20 64 69 73 | but is |some dis|
|000049f0| 74 61 6e 63 65 20 62 61 | 63 6b 2e 20 20 54 68 65 |tance ba|ck. The|
|00004a00| 6e 2c 0a 0a 20 20 20 20 | 20 5b 61 5d 20 63 6f 6e |n,.. | [a] con|
|00004a10| 76 65 72 74 20 74 6f 20 | 61 20 72 65 6c 61 74 69 |vert to |a relati|
|00004a20| 76 65 20 63 6f 6f 72 64 | 69 6e 61 74 65 20 73 79 |ve coord|inate sy|
|00004a30| 73 74 65 6d 20 63 65 6e | 74 65 72 65 64 20 61 72 |stem cen|tered ar|
|00004a40| 6f 75 6e 64 20 74 68 65 | 0a 76 69 65 77 70 6f 69 |ound the|.viewpoi|
|00004a50| 6e 74 2c 20 6f 72 69 65 | 6e 74 65 64 20 73 6f 20 |nt, orie|nted so |
|00004a60| 74 68 61 74 20 78 20 61 | 6e 64 20 79 20 61 72 65 |that x a|nd y are|
|00004a70| 20 6c 69 6b 65 20 74 68 | 69 73 3a 0a 20 20 20 20 | like th|is:. |
|00004a80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 79 0a 20 | | y. |
|00004a90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004aa0| 7c 0a 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 ||.. | |
|00004ab0| 2d 2d 2d 2d 2b 2d 2d 2d | 2d 78 0a 20 20 20 20 20 |----+---|-x. |
|00004ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 7c 0a 0a 61 | | |..a|
|00004ad0| 6e 64 20 7a 20 69 73 20 | 74 68 65 20 64 69 73 74 |nd z is |the dist|
|00004ae0| 61 6e 63 65 20 69 6e 74 | 6f 20 74 68 65 20 73 63 |ance int|o the sc|
|00004af0| 72 65 65 6e 2e 20 20 4e | 6f 77 2c 20 64 69 76 69 |reen. N|ow, divi|
|00004b00| 64 65 20 79 6f 75 72 20 | 63 6f 6f 72 64 69 6e 61 |de your |coordina|
|00004b10| 74 65 73 20 62 79 0a 7a | 2e 0a 0a 20 20 20 20 20 |tes by.z|... |
|00004b20| 54 68 61 74 27 73 20 61 | 6c 6c 2e 0a 0a 20 20 20 |That's a|ll... |
|00004b30| 20 20 4f 6b 2c 20 73 75 | 72 65 2c 20 79 6f 75 20 | Ok, su|re, you |
|00004b40| 64 6f 6e 27 74 20 72 65 | 61 6c 6c 79 20 68 61 76 |don't re|ally hav|
|00004b50| 65 20 74 6f 20 63 61 6c | 6c 20 79 6f 75 72 20 64 |e to cal|l your d|
|00004b60| 69 72 65 63 74 69 6f 6e | 73 20 78 20 79 20 61 6e |irection|s x y an|
|00004b70| 64 20 7a 2c 0a 62 75 74 | 20 74 68 61 74 27 73 20 |d z,.but| that's |
|00004b80| 6a 75 73 74 20 63 68 61 | 6e 67 69 6e 67 20 74 68 |just cha|nging th|
|00004b90| 65 20 64 65 73 63 72 69 | 70 74 69 6f 6e 20 77 68 |e descri|ption wh|
|00004ba0| 69 63 68 20 66 69 74 73 | 20 74 68 65 20 6d 61 74 |ich fits| the mat|
|00004bb0| 68 2e 20 20 41 6e 64 2c | 0a 73 75 72 65 2c 20 79 |h. And,|.sure, y|
|00004bc0| 6f 75 20 68 61 76 65 20 | 74 6f 20 64 65 63 69 64 |ou have |to decid|
|00004bd0| 65 20 77 68 61 74 20 74 | 6f 20 64 6f 20 61 62 6f |e what t|o do abo|
|00004be0| 75 74 20 74 68 69 6e 67 | 73 20 74 68 61 74 20 61 |ut thing|s that a|
|00004bf0| 72 65 20 22 74 68 65 20 | 6f 74 68 65 72 0a 64 69 |re "the |other.di|
|00004c00| 72 65 63 74 69 6f 6e 20 | 66 72 6f 6d 20 74 68 65 |rection |from the|
|00004c10| 20 73 63 72 65 65 6e 22 | 20 2d 2d 20 62 75 74 20 | screen"| -- but |
|00004c20| 74 68 61 74 27 73 20 72 | 65 61 6c 6c 79 20 73 6f |that's r|eally so|
|00004c30| 6d 65 74 68 69 6e 67 20 | 64 69 66 66 65 72 65 6e |mething |differen|
|00004c40| 74 2e 0a 0a 20 20 20 20 | 20 41 6e 64 2c 20 6f 6b |t... | And, ok|
|00004c50| 2c 20 79 6f 75 20 68 61 | 76 65 20 74 6f 20 64 65 |, you ha|ve to de|
|00004c60| 63 69 64 65 20 68 6f 77 | 20 6d 61 6e 79 20 67 61 |cide how| many ga|
|00004c70| 6d 65 20 75 6e 69 74 73 | 20 74 68 65 20 76 69 65 |me units| the vie|
|00004c80| 77 70 6f 69 6e 74 20 69 | 73 2c 0a 62 65 68 69 6e |wpoint i|s,.behin|
|00004c90| 64 20 74 68 65 20 73 63 | 72 65 65 6e 20 5b 74 68 |d the sc|reen [th|
|00004ca0| 69 73 20 69 73 20 73 6f | 6d 65 74 68 69 6e 67 20 |is is so|mething |
|00004cb0| 79 6f 75 20 61 64 64 20 | 74 6f 20 74 68 65 20 7a |you add |to the z|
|00004cc0| 20 63 6f 6f 72 64 69 6e | 61 74 65 20 62 65 66 6f | coordin|ate befo|
|00004cd0| 72 65 0a 64 69 76 69 64 | 69 6e 67 5d 2e 20 20 41 |re.divid|ing]. A|
|00004ce0| 6e 64 2c 20 6f 6b 2c 20 | 6d 61 79 62 65 20 79 6f |nd, ok, |maybe yo|
|00004cf0| 75 20 77 61 6e 74 20 74 | 6f 20 73 63 61 6c 65 20 |u want t|o scale |
|00004d00| 74 68 69 6e 67 73 20 61 | 20 62 69 74 20 74 6f 20 |things a| bit to |
|00004d10| 6d 61 6b 65 20 69 74 0a | 6c 6f 6f 6b 20 6e 69 63 |make it.|look nic|
|00004d20| 65 72 2e 20 20 42 75 74 | 20 6e 6f 6e 65 20 6f 66 |er. But| none of|
|00004d30| 20 74 68 61 74 20 69 73 | 20 72 65 61 6c 6c 79 20 | that is| really |
|00004d40| 61 6c 6c 20 74 68 61 74 | 20 68 61 72 64 20 74 6f |all that| hard to|
|00004d50| 20 64 65 61 6c 20 77 69 | 74 68 2e 0a 0a 20 20 20 | deal wi|th... |
|00004d60| 20 20 57 68 61 74 27 73 | 20 61 6e 6e 6f 79 69 6e | What's| annoyin|
|00004d70| 67 20 69 73 20 74 68 61 | 74 20 79 6f 75 20 64 6f |g is tha|t you do|
|00004d80| 6e 27 74 20 77 61 6e 74 | 20 74 6f 20 64 6f 20 64 |n't want| to do d|
|00004d90| 69 76 69 73 69 6f 6e 20 | 66 6f 72 20 65 76 65 72 |ivision |for ever|
|00004da0| 79 0a 70 69 78 65 6c 20 | 74 68 61 74 20 79 6f 75 |y.pixel |that you|
|00004db0| 20 64 72 61 77 20 6f 6e | 20 74 68 65 20 73 63 72 | draw on| the scr|
|00004dc0| 65 65 6e 2e 20 20 54 68 | 61 74 20 6d 65 61 6e 73 |een. Th|at means|
|00004dd0| 2c 20 66 6f 72 20 69 6e | 73 74 61 6e 63 65 2c 20 |, for in|stance, |
|00004de0| 74 68 61 74 20 79 6f 75 | 0a 6d 69 67 68 74 20 68 |that you|.might h|
|00004df0| 61 76 65 20 61 20 6c 69 | 6e 65 20 77 68 65 72 65 |ave a li|ne where|
|00004e00| 20 62 6f 74 68 20 65 6e | 64 73 20 61 72 65 20 6f | both en|ds are o|
|00004e10| 66 66 20 74 68 65 20 73 | 63 72 65 65 6e 20 62 75 |ff the s|creen bu|
|00004e20| 74 20 70 61 72 74 20 6f | 66 20 74 68 65 0a 6c 69 |t part o|f the.li|
|00004e30| 6e 65 20 5b 69 6e 20 74 | 68 65 20 6d 69 64 64 6c |ne [in t|he middl|
|00004e40| 65 5d 20 61 72 65 20 76 | 69 73 69 62 6c 65 2e 20 |e] are v|isible. |
|00004e50| 20 48 6f 77 65 76 65 72 | 2c 20 74 68 61 74 27 73 | However|, that's|
|00004e60| 20 72 65 6c 61 74 65 64 | 20 74 6f 20 74 68 65 0a | related| to the.|
|00004e70| 70 72 6f 62 6c 65 6d 20 | 6f 66 20 64 65 74 65 63 |problem |of detec|
|00004e80| 74 69 6e 67 20 63 6f 6c | 6c 69 73 69 6f 6e 73 2e |ting col|lisions.|
|00004e90| 20 20 4f 72 2c 20 62 65 | 74 74 65 72 20 79 65 74 | Or, be|tter yet|
|00004ea0| 2c 20 63 6c 69 70 70 69 | 6e 67 2e 20 20 59 65 61 |, clippi|ng. Yea|
|00004eb0| 68 2c 0a 74 68 61 74 27 | 73 20 69 74 20 74 61 6b |h,.that'|s it tak|
|00004ec0| 65 20 61 20 6c 6f 6f 6b | 20 61 74 20 74 68 65 20 |e a look| at the |
|00004ed0| 73 65 63 74 69 6f 6e 20 | 6f 6e 20 63 6c 69 70 70 |section |on clipp|
|00004ee0| 69 6e 67 2e 2e 2e 0a 52 | 61 75 6c 20 44 2e 20 4d |ing....R|aul D. M|
|00004ef0| 69 6c 6c 65 72 20 20 20 | 20 20 20 20 20 20 20 20 |iller | |
|00004f00| 20 20 6e 20 3d 3a 20 70 | 2a 71 20 20 20 20 20 20 | n =: p|*q |
|00004f10| 20 20 20 20 20 20 20 20 | 20 4e 42 2e 20 70 72 69 | | NB. pri|
|00004f20| 6d 65 20 70 2c 20 71 2c | 20 65 0a 3c 72 6f 63 6b |me p, q,| e.<rock|
|00004f30| 77 65 6c 6c 40 6e 6f 76 | 61 2e 75 6d 64 2e 65 64 |well@nov|a.umd.ed|
|00004f40| 75 3e 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |u> | |
|00004f50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 4e 42 2e | | NB.|
|00004f60| 20 70 75 62 6c 69 63 20 | 65 2c 20 6e 2c 20 79 0a | public |e, n, y.|
|00004f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004f80| 20 20 20 20 20 20 20 20 | 20 20 20 79 20 3d 3a 20 | | y =: |
|00004f90| 6e 26 7c 26 28 2a 26 78 | 29 5e 3a 65 20 31 0a 20 |n&|&(*&x|)^:e 1. |
|00004fa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004fb0| 20 20 20 20 20 20 20 20 | 20 20 78 20 2d 3a 20 6e | | x -: n|
|00004fc0| 26 7c 26 28 2a 26 79 29 | 5e 3a 64 20 31 20 20 20 |&|&(*&y)|^:d 1 |
|00004fd0| 20 4e 42 2e 20 31 20 3c | 20 28 64 2a 65 29 20 2b | NB. 1 <| (d*e) +|
|00004fe0| 2e 26 3c 3a 20 28 70 2c | 71 29 0a 0a 31 32 29 20 |.&<: (p,|q)..12) |
|00004ff0| 5a 2d 42 75 66 66 65 72 | 69 6e 67 20 26 20 74 68 |Z-Buffer|ing & th|
|00005000| 65 20 50 61 69 6e 74 65 | 72 73 20 41 6c 67 6f 72 |e Painte|rs Algor|
|00005010| 69 74 68 6d 20 26 20 42 | 53 50 2d 54 72 65 65 73 |ithm & B|SP-Trees|
|00005020| 2e 0a 0a 54 68 65 72 65 | 20 61 72 65 20 73 65 76 |...There| are sev|
|00005030| 65 72 61 6c 20 6d 65 74 | 68 6f 64 73 20 61 76 61 |eral met|hods ava|
|00005040| 69 6c 61 62 6c 65 20 66 | 6f 72 20 64 69 73 70 6c |ilable f|or displ|
|00005050| 61 79 69 6e 67 20 70 6f | 6c 79 67 6f 6e 73 20 69 |aying po|lygons i|
|00005060| 6e 20 61 20 33 2d 64 0a | 0a 6f 62 6a 65 63 74 20 |n a 3-d.|.object |
|00005070| 73 6f 20 61 73 20 74 6f | 20 61 73 73 75 72 65 20 |so as to| assure |
|00005080| 74 68 61 74 20 77 68 61 | 74 27 73 20 62 65 68 69 |that wha|t's behi|
|00005090| 6e 64 20 69 73 20 62 65 | 68 69 6e 64 20 61 6e 64 |nd is be|hind and|
|000050a0| 20 77 68 61 74 27 73 20 | 69 6e 20 66 72 6f 6e 74 | what's |in front|
|000050b0| 0a 69 73 20 69 6e 20 66 | 72 6f 6e 74 2e 20 20 45 |.is in f|ront. E|
|000050c0| 61 63 68 2c 20 68 6f 77 | 65 76 65 72 2c 20 68 61 |ach, how|ever, ha|
|000050d0| 73 20 69 74 73 20 70 72 | 6f 73 20 61 6e 64 20 63 |s its pr|os and c|
|000050e0| 6f 6e 73 2e 20 20 57 69 | 74 68 20 65 61 63 68 20 |ons. Wi|th each |
|000050f0| 6f 66 20 74 68 65 73 65 | 0a 6d 65 74 68 6f 64 73 |of these|.methods|
|00005100| 2c 20 69 74 20 69 73 20 | 6f 66 74 65 6e 20 75 73 |, it is |often us|
|00005110| 65 66 75 6c 20 74 6f 20 | 69 6d 70 6c 65 6d 65 6e |eful to |implemen|
|00005120| 74 20 62 61 63 6b 66 61 | 63 65 20 63 75 6c 6c 69 |t backfa|ce culli|
|00005130| 6e 67 2e 20 20 42 61 63 | 6b 66 61 63 65 0a 63 75 |ng. Bac|kface.cu|
|00005140| 6c 6c 69 6e 67 20 69 73 | 20 73 69 6d 70 6c 79 20 |lling is| simply |
|00005150| 6e 6f 74 20 72 65 6e 64 | 65 72 69 6e 67 20 73 75 |not rend|ering su|
|00005160| 72 66 61 63 65 73 20 77 | 68 69 63 68 20 61 72 65 |rfaces w|hich are|
|00005170| 6e 27 74 20 66 61 63 69 | 6e 67 20 79 6f 75 2e 0a |n't faci|ng you..|
|00005180| 0a 20 20 20 20 20 54 68 | 65 20 50 61 69 6e 74 65 |. Th|e Painte|
|00005190| 72 27 73 20 41 6c 67 6f | 72 69 74 68 6d 20 69 73 |r's Algo|rithm is|
|000051a0| 20 70 72 6f 62 61 62 6c | 79 20 74 68 65 20 6d 6f | probabl|y the mo|
|000051b0| 73 74 20 69 6e 74 75 69 | 74 69 76 65 20 66 6f 72 |st intui|tive for|
|000051c0| 20 74 68 65 0a 62 65 67 | 69 6e 6e 65 72 2c 20 6f | the.beg|inner, o|
|000051d0| 6e 65 20 6f 66 20 74 68 | 65 20 65 61 73 69 65 73 |ne of th|e easies|
|000051e0| 74 20 74 6f 20 69 6d 70 | 6c 65 6d 65 6e 74 2c 20 |t to imp|lement, |
|000051f0| 61 6e 64 20 74 68 65 20 | 68 61 72 64 65 73 74 20 |and the |hardest |
|00005200| 74 6f 20 67 65 74 20 72 | 69 67 68 74 2e 0a 54 68 |to get r|ight..Th|
|00005210| 65 20 50 61 69 6e 74 65 | 72 27 73 20 41 6c 67 6f |e Painte|r's Algo|
|00005220| 72 69 74 68 6d 2c 20 71 | 75 69 74 65 20 73 69 6d |rithm, q|uite sim|
|00005230| 70 6c 79 2c 20 69 73 20 | 50 61 69 6e 74 20 74 68 |ply, is |Paint th|
|00005240| 65 20 66 72 6f 6d 20 62 | 61 63 6b 20 74 6f 20 66 |e from b|ack to f|
|00005250| 72 6f 6e 74 2e 0a 4f 6e | 63 65 20 69 74 20 68 61 |ront..On|ce it ha|
|00005260| 73 20 62 65 65 6e 20 64 | 65 74 65 72 6d 69 6e 65 |s been d|etermine|
|00005270| 64 20 77 68 69 63 68 20 | 70 6f 6c 79 67 6f 6e 73 |d which |polygons|
|00005280| 20 77 69 6c 6c 20 62 65 | 20 64 72 61 77 6e 2c 20 | will be| drawn, |
|00005290| 69 74 20 69 73 0a 6e 65 | 63 65 73 73 61 72 79 20 |it is.ne|cessary |
|000052a0| 74 6f 20 73 6f 72 74 20 | 74 68 65 6d 20 66 72 6f |to sort |them fro|
|000052b0| 6d 20 66 75 72 74 68 65 | 73 74 20 61 77 61 79 20 |m furthe|st away |
|000052c0| 74 6f 20 63 6c 6f 73 65 | 73 74 2e 20 20 54 68 65 |to close|st. The|
|000052d0| 6e 2c 20 73 74 61 72 74 | 69 6e 67 0a 77 69 74 68 |n, start|ing.with|
|000052e0| 20 74 68 65 20 66 75 72 | 74 68 65 73 74 20 70 6f | the fur|thest po|
|000052f0| 6c 79 67 6f 6e 20 61 6e | 64 20 6d 6f 76 69 6e 67 |lygon an|d moving|
|00005300| 20 74 6f 20 74 68 65 20 | 63 6c 6f 73 65 73 74 2c | to the |closest,|
|00005310| 20 64 72 61 77 20 74 68 | 65 6d 2e 0a 0a 20 20 20 | draw th|em... |
|00005320| 20 20 54 68 65 20 74 72 | 69 63 6b 79 20 70 61 72 | The tr|icky par|
|00005330| 74 20 6f 66 20 74 68 65 | 20 50 61 69 6e 74 65 72 |t of the| Painter|
|00005340| 27 73 20 41 6c 67 6f 72 | 69 74 68 6d 20 69 73 20 |'s Algor|ithm is |
|00005350| 64 65 74 65 72 6d 69 6e | 69 6e 67 20 77 68 65 6e |determin|ing when|
|00005360| 20 6f 6e 65 0a 70 6f 6c | 79 67 6f 6e 20 69 73 20 | one.pol|ygon is |
|00005370| 63 6c 6f 73 65 72 20 6f | 72 20 66 61 72 74 68 65 |closer o|r farthe|
|00005380| 72 20 74 68 61 6e 20 61 | 6e 6f 74 68 65 72 2e 20 |r than a|nother. |
|00005390| 20 54 68 65 20 63 6c 6f | 73 65 73 74 20 74 6f 20 | The clo|sest to |
|000053a0| 73 61 74 69 73 66 61 63 | 74 6f 72 79 0a 6d 65 74 |satisfac|tory.met|
|000053b0| 68 6f 64 20 49 27 76 65 | 20 66 6f 75 6e 64 20 75 |hod I've| found u|
|000053c0| 73 65 73 20 74 68 69 73 | 20 63 72 69 74 65 72 69 |ses this| criteri|
|000053d0| 61 20 2d 2d 20 53 75 72 | 66 61 63 65 20 41 20 69 |a -- Sur|face A i|
|000053e0| 73 20 66 75 72 74 68 65 | 72 20 61 77 61 79 20 74 |s furthe|r away t|
|000053f0| 68 65 6e 0a 73 75 72 66 | 61 63 65 20 42 20 69 66 |hen.surf|ace B if|
|00005400| 3a 0a 20 20 20 20 20 20 | 20 20 31 29 20 54 68 65 |:. | 1) The|
|00005410| 20 66 75 72 74 68 65 73 | 74 20 70 6f 69 6e 74 20 | furthes|t point |
|00005420| 6f 66 20 41 20 69 73 20 | 66 75 72 74 68 65 72 20 |of A is |further |
|00005430| 61 77 61 79 20 74 68 61 | 6e 20 74 68 65 20 66 75 |away tha|n the fu|
|00005440| 72 74 68 65 73 74 0a 20 | 20 20 20 20 20 20 20 20 |rthest. | |
|00005450| 20 20 20 70 6f 69 6e 74 | 20 6f 66 20 42 2e 0a 20 | point| of B.. |
|00005460| 20 20 20 20 20 20 20 32 | 29 20 42 20 66 61 63 65 | 2|) B face|
|00005470| 73 20 79 6f 75 20 6d 6f | 72 65 20 64 69 72 65 63 |s you mo|re direc|
|00005480| 74 6c 79 20 74 68 61 6e | 20 41 2e 0a 20 20 20 20 |tly than| A.. |
|00005490| 20 20 20 20 33 29 20 54 | 68 65 20 63 6c 6f 73 65 | 3) T|he close|
|000054a0| 73 74 20 70 6f 69 6e 74 | 20 6f 66 20 41 20 69 73 |st point| of A is|
|000054b0| 20 66 75 72 74 68 65 72 | 20 74 68 61 6e 20 74 68 | further| than th|
|000054c0| 65 20 63 6c 6f 73 65 73 | 74 20 70 6f 69 6e 74 20 |e closes|t point |
|000054d0| 6f 66 20 42 2e 0a 20 20 | 20 20 20 20 20 20 34 29 |of B.. | 4)|
|000054e0| 20 53 75 72 66 61 63 65 | 20 42 20 69 73 20 6d 6f | Surface| B is mo|
|000054f0| 72 65 20 22 69 6d 70 6f | 72 74 61 6e 74 22 20 74 |re "impo|rtant" t|
|00005500| 68 61 6e 20 73 75 72 66 | 61 63 65 20 41 2e 0a 54 |han surf|ace A..T|
|00005510| 68 65 73 65 20 61 72 65 | 20 74 6f 20 62 65 20 74 |hese are| to be t|
|00005520| 61 6b 65 6e 20 69 6e 20 | 6f 72 64 65 72 20 75 6e |aken in |order un|
|00005530| 74 69 6c 20 61 20 64 65 | 63 69 73 69 6f 6e 20 69 |til a de|cision i|
|00005540| 73 20 72 65 61 63 68 65 | 64 2e 20 20 42 75 74 2c |s reache|d. But,|
|00005550| 20 49 27 76 65 0a 79 65 | 74 20 74 6f 20 66 69 6e | I've.ye|t to fin|
|00005560| 64 20 67 6f 6f 64 20 65 | 6e 6f 75 67 68 20 63 72 |d good e|nough cr|
|00005570| 69 74 65 72 69 61 20 74 | 6f 20 77 6f 72 6b 20 77 |iteria t|o work w|
|00005580| 65 6c 6c 20 6f 6e 20 6d | 6f 73 74 20 6f 62 6a 65 |ell on m|ost obje|
|00005590| 63 74 73 20 74 68 61 74 | 0a 70 65 6f 70 6c 65 20 |cts that|.people |
|000055a0| 64 65 73 69 67 6e 2e 20 | 20 49 66 20 79 6f 75 20 |design. | If you |
|000055b0| 6b 65 65 70 20 74 68 65 | 73 65 20 63 72 69 74 65 |keep the|se crite|
|000055c0| 72 69 61 20 69 6e 20 6d | 69 6e 64 20 77 68 65 6e |ria in m|ind when|
|000055d0| 20 6d 61 6b 69 6e 67 20 | 74 68 65 0a 6f 62 6a 65 | making |the.obje|
|000055e0| 63 74 73 2c 20 69 74 20 | 63 61 6e 20 68 65 6c 70 |cts, it |can help|
|000055f0| 2e 20 20 42 75 74 2c 20 | 69 66 20 79 6f 75 27 72 |. But, |if you'r|
|00005600| 65 20 75 73 69 6e 67 20 | 33 72 64 20 70 61 72 74 |e using |3rd part|
|00005610| 79 20 6f 62 6a 65 63 74 | 73 2c 20 49 27 64 0a 73 |y object|s, I'd.s|
|00005620| 75 67 67 65 73 74 20 61 | 20 64 69 66 66 65 72 65 |uggest a| differe|
|00005630| 6e 74 20 6d 65 74 68 6f | 64 2e 0a 0a 20 20 20 20 |nt metho|d... |
|00005640| 20 5a 2d 42 75 66 66 65 | 72 69 6e 67 20 69 73 20 | Z-Buffe|ring is |
|00005650| 61 20 62 75 7a 7a 77 6f | 72 64 20 74 68 61 74 27 |a buzzwo|rd that'|
|00005660| 73 20 66 69 6e 61 6c 6c | 79 20 63 6f 6d 65 20 64 |s finall|y come d|
|00005670| 6f 77 6e 20 74 6f 20 72 | 65 61 6c 69 74 79 2e 0a |own to r|eality..|
|00005680| 49 74 27 73 20 62 65 65 | 6e 20 72 65 70 6c 61 63 |It's bee|n replac|
|00005690| 65 64 20 62 79 20 27 74 | 65 78 74 75 72 65 2d 6d |ed by 't|exture-m|
|000056a0| 61 70 70 69 6e 67 27 20 | 61 6e 64 20 27 62 75 6d |apping' |and 'bum|
|000056b0| 70 2d 6d 61 70 70 69 6e | 67 27 20 61 6e 64 20 27 |p-mappin|g' and '|
|000056c0| 72 65 61 6c 74 69 6d 65 | 0a 72 61 79 74 72 61 63 |realtime|.raytrac|
|000056d0| 69 6e 67 27 20 61 73 20 | 74 68 65 20 27 77 68 61 |ing' as |the 'wha|
|000056e0| 74 27 73 20 66 61 6e 63 | 79 27 20 62 75 7a 7a 77 |t's fanc|y' buzzw|
|000056f0| 6f 72 64 2e 20 20 5a 2d | 62 75 66 66 65 72 69 6e |ord. Z-|bufferin|
|00005700| 67 20 69 73 20 63 6f 73 | 74 6c 79 20 69 6e 0a 74 |g is cos|tly in.t|
|00005710| 65 72 6d 73 20 6f 66 20 | 6d 65 6d 6f 72 79 20 61 |erms of |memory a|
|00005720| 6e 64 20 70 72 6f 63 65 | 73 73 69 6e 67 20 74 69 |nd proce|ssing ti|
|00005730| 6d 65 2c 20 62 75 74 20 | 67 69 76 65 73 20 62 65 |me, but |gives be|
|00005740| 61 75 74 69 66 75 6c 20 | 72 65 73 75 6c 74 73 2e |autiful |results.|
|00005750| 20 20 49 66 0a 79 6f 75 | 27 76 65 20 67 6f 74 20 | If.you|'ve got |
|00005760| 73 6f 6d 65 20 66 72 65 | 65 64 6f 6d 20 77 69 74 |some fre|edom wit|
|00005770| 68 20 79 6f 75 72 20 6d | 65 6d 6f 72 79 20 75 73 |h your m|emory us|
|00005780| 61 67 65 20 61 6e 64 20 | 61 20 62 69 74 20 6f 66 |age and |a bit of|
|00005790| 20 70 72 6f 63 65 73 73 | 6f 72 0a 74 69 6d 65 20 | process|or.time |
|000057a0| 74 6f 20 73 70 61 72 65 | 2c 20 61 6e 64 20 79 6f |to spare|, and yo|
|000057b0| 75 27 72 65 20 6f 6b 20 | 77 69 74 68 20 66 69 6c |u're ok |with fil|
|000057c0| 6c 69 6e 67 20 79 6f 75 | 72 20 6f 77 6e 20 70 6f |ling you|r own po|
|000057d0| 6c 79 67 6f 6e 73 2c 20 | 74 68 65 6e 20 5a 2d 0a |lygons, |then Z-.|
|000057e0| 62 75 66 66 65 72 69 6e | 67 20 6d 61 79 20 62 65 |bufferin|g may be|
|000057f0| 20 66 6f 72 20 79 6f 75 | 2e 0a 0a 20 20 20 20 20 | for you|... |
|00005800| 54 6f 20 5a 2d 62 75 66 | 66 65 72 2c 20 6f 6e 65 |To Z-buf|fer, one|
|00005810| 20 6b 65 65 70 73 20 61 | 20 32 64 2d 61 72 72 61 | keeps a| 2d-arra|
|00005820| 79 20 6f 66 20 6e 75 6d | 62 65 72 73 20 28 73 68 |y of num|bers (sh|
|00005830| 6f 72 74 73 20 6f 72 20 | 69 6e 74 73 0a 75 73 75 |orts or |ints.usu|
|00005840| 61 6c 6c 79 29 20 74 68 | 65 20 73 61 6d 65 20 64 |ally) th|e same d|
|00005850| 69 6d 65 6e 73 69 6f 6e | 73 20 61 73 20 74 68 65 |imension|s as the|
|00005860| 20 76 69 65 77 70 6f 72 | 74 2e 20 20 41 73 20 65 | viewpor|t. As e|
|00005870| 61 63 68 20 3c 58 2c 59 | 2c 5a 3e 20 70 6f 69 6e |ach <X,Y|,Z> poin|
|00005880| 74 20 69 73 0a 70 72 65 | 70 61 72 65 64 20 66 6f |t is.pre|pared fo|
|00005890| 72 20 64 69 73 70 6c 61 | 79 2c 20 74 68 65 20 66 |r displa|y, the f|
|000058a0| 69 6e 61 6c 20 76 61 6c | 75 65 20 69 73 20 63 6f |inal val|ue is co|
|000058b0| 6d 70 61 72 65 64 20 74 | 6f 20 74 68 65 20 5a 20 |mpared t|o the Z |
|000058c0| 76 61 6c 75 65 20 61 6c | 72 65 61 64 79 0a 69 6e |value al|ready.in|
|000058d0| 20 74 68 65 20 3c 58 2c | 59 3e 20 70 6f 73 69 74 | the <X,|Y> posit|
|000058e0| 69 6f 6e 20 69 6e 20 74 | 68 65 20 5a 2d 62 75 66 |ion in t|he Z-buf|
|000058f0| 66 65 72 20 61 72 72 61 | 79 2e 20 20 49 66 20 74 |fer arra|y. If t|
|00005900| 68 65 20 6e 65 77 20 5a | 20 69 73 20 6c 65 73 73 |he new Z| is less|
|00005910| 20 74 68 61 6e 0a 74 68 | 65 20 6f 6e 65 20 61 6c | than.th|e one al|
|00005920| 72 65 61 64 79 20 69 6e | 20 74 68 65 20 62 75 66 |ready in| the buf|
|00005930| 66 65 72 2c 20 74 68 65 | 20 70 69 78 65 6c 2d 63 |fer, the| pixel-c|
|00005940| 6f 6c 6f 72 20 69 73 20 | 70 6c 61 63 65 64 20 69 |olor is |placed i|
|00005950| 6e 20 74 68 65 20 53 63 | 72 65 65 6e 2d 0a 42 75 |n the Sc|reen-.Bu|
|00005960| 66 66 65 72 20 61 74 20 | 70 6f 73 69 74 69 6f 6e |ffer at |position|
|00005970| 20 3c 58 2c 59 3e 20 61 | 6e 64 20 74 68 65 20 6e | <X,Y> a|nd the n|
|00005980| 65 77 20 5a 20 69 73 20 | 63 6f 70 69 65 64 20 69 |ew Z is |copied i|
|00005990| 6e 74 6f 20 70 6f 73 69 | 74 69 6f 6e 20 3c 58 2c |nto posi|tion <X,|
|000059a0| 59 3e 20 6f 66 0a 74 68 | 65 20 5a 2d 42 75 66 66 |Y> of.th|e Z-Buff|
|000059b0| 65 72 2e 0a 0a 20 20 20 | 20 20 54 68 65 20 65 78 |er... | The ex|
|000059c0| 70 65 6e 73 65 20 6f 66 | 20 5a 2d 42 75 66 66 65 |pense of| Z-Buffe|
|000059d0| 72 69 6e 67 20 69 73 20 | 68 61 76 69 6e 67 20 74 |ring is |having t|
|000059e0| 6f 20 73 65 74 20 65 61 | 63 68 20 65 6c 65 6d 65 |o set ea|ch eleme|
|000059f0| 6e 74 20 74 6f 20 74 68 | 65 0a 4d 41 58 20 5a 20 |nt to th|e.MAX Z |
|00005a00| 56 41 4c 55 45 20 61 66 | 74 65 72 20 65 61 63 68 |VALUE af|ter each|
|00005a10| 20 66 72 61 6d 65 20 61 | 6e 64 20 6b 65 65 70 69 | frame a|nd keepi|
|00005a20| 6e 67 20 74 72 61 63 6b | 20 6f 66 20 74 68 65 20 |ng track| of the |
|00005a30| 5a 2d 76 61 6c 75 65 20 | 66 6f 72 20 65 76 65 72 |Z-value |for ever|
|00005a40| 79 0a 20 20 20 2d 20 2d | 0a 70 69 78 65 6c 20 69 |y. - -|.pixel i|
|00005a50| 6e 20 74 68 65 20 53 63 | 72 65 65 6e 20 42 75 66 |n the Sc|reen Buf|
|00005a60| 66 65 72 20 61 6e 64 20 | 65 76 65 72 79 20 70 69 |fer and |every pi|
|00005a70| 78 65 6c 20 69 6e 20 74 | 68 65 20 70 6f 6c 79 67 |xel in t|he polyg|
|00005a80| 6f 6e 20 79 6f 75 27 72 | 65 0a 64 72 61 77 69 6e |on you'r|e.drawin|
|00005a90| 67 2e 20 20 49 6e 20 6d | 6f 73 74 20 61 70 70 6c |g. In m|ost appl|
|00005aa0| 69 63 61 74 69 6f 6e 73 | 2c 20 69 74 20 69 73 20 |ications|, it is |
|00005ab0| 75 6e 6e 65 63 65 73 73 | 61 72 79 20 74 6f 20 6b |unnecess|ary to k|
|00005ac0| 65 65 70 20 74 72 61 63 | 6b 20 6f 66 20 74 68 65 |eep trac|k of the|
|00005ad0| 0a 5a 2d 76 61 6c 75 65 | 73 20 6f 66 20 61 6e 79 |.Z-value|s of any|
|00005ae0| 20 6d 6f 72 65 20 74 68 | 61 6e 20 74 68 65 20 76 | more th|an the v|
|00005af0| 65 72 74 69 63 65 73 20 | 6f 66 20 61 20 70 6f 6c |ertices |of a pol|
|00005b00| 79 67 6f 6e 2e 0a 0a 20 | 20 20 20 20 41 6e 64 2c |ygon... | And,|
|00005b10| 20 6d 79 20 66 61 76 6f | 72 69 74 65 20 6f 66 20 | my favo|rite of |
|00005b20| 74 68 65 20 62 75 6e 63 | 68 20 28 62 75 74 20 74 |the bunc|h (but t|
|00005b30| 68 65 20 6e 61 73 74 69 | 65 73 74 20 74 6f 20 73 |he nasti|est to s|
|00005b40| 74 6f 72 65 20 69 6e 20 | 61 6e 0a 6f 62 6a 65 63 |tore in |an.objec|
|00005b50| 74 20 66 69 6c 65 2c 20 | 69 73 20 42 53 50 2d 74 |t file, |is BSP-t|
|00005b60| 72 65 65 73 2e 20 20 42 | 53 50 2d 74 72 65 65 20 |rees. B|SP-tree |
|00005b70| 73 74 61 6e 64 73 20 66 | 6f 72 20 42 69 6e 61 72 |stands f|or Binar|
|00005b80| 79 20 53 70 61 63 65 20 | 50 61 72 74 69 74 69 6f |y Space |Partitio|
|00005b90| 6e 0a 74 72 65 65 2e 20 | 20 54 68 65 79 20 61 72 |n.tree. | They ar|
|00005ba0| 65 20 62 61 73 65 64 20 | 74 68 65 20 69 64 65 61 |e based |the idea|
|00005bb0| 20 74 68 61 74 20 73 75 | 72 66 61 63 65 73 20 6f | that su|rfaces o|
|00005bc0| 66 20 6d 6f 73 74 20 6f | 62 6a 65 63 74 73 20 64 |f most o|bjects d|
|00005bd0| 6f 6e 27 74 0a 63 68 61 | 6e 67 65 20 70 6f 73 69 |on't.cha|nge posi|
|00005be0| 74 69 6f 6e 73 20 72 65 | 6c 61 74 69 76 65 20 74 |tions re|lative t|
|00005bf0| 6f 20 65 61 63 68 20 6f | 74 68 65 72 2e 20 20 4f |o each o|ther. O|
|00005c00| 62 6a 65 63 74 73 20 77 | 68 6f 73 65 20 73 75 72 |bjects w|hose sur|
|00005c10| 66 61 63 65 73 20 63 68 | 61 6e 67 65 0a 72 65 6c |faces ch|ange.rel|
|00005c20| 61 74 69 76 65 20 70 6f | 73 69 74 69 6f 6e 73 20 |ative po|sitions |
|00005c30| 63 61 6e 6e 6f 74 20 62 | 65 20 28 74 6f 20 6d 79 |cannot b|e (to my|
|00005c40| 20 6b 6e 6f 77 6c 65 64 | 67 65 29 20 65 61 73 69 | knowled|ge) easi|
|00005c50| 6c 79 20 75 73 65 64 20 | 77 69 74 68 20 42 53 50 |ly used |with BSP|
|00005c60| 2d 0a 74 72 65 65 73 2e | 0a 0a 20 20 20 20 20 54 |-.trees.|.. T|
|00005c70| 68 65 20 66 69 72 73 74 | 20 73 74 65 70 20 69 6e |he first| step in|
|00005c80| 20 75 73 69 6e 67 20 42 | 53 50 2d 74 72 65 65 73 | using B|SP-trees|
|00005c90| 20 69 73 20 74 6f 20 62 | 72 65 61 6b 20 75 70 20 | is to b|reak up |
|00005ca0| 79 6f 75 72 20 6f 62 6a | 65 63 74 20 69 6e 74 6f |your obj|ect into|
|00005cb0| 20 61 0a 27 67 6f 6f 64 | 27 20 6f 62 6a 65 63 74 | a.'good|' object|
|00005cc0| 2e 20 20 42 75 74 2c 20 | 49 20 63 61 6e 27 74 20 |. But, |I can't |
|00005cd0| 74 68 69 6e 6b 20 6f 66 | 20 61 20 77 61 79 20 74 |think of| a way t|
|00005ce0| 6f 20 64 65 73 63 72 69 | 62 65 20 61 20 27 67 6f |o descri|be a 'go|
|00005cf0| 6f 64 27 20 6f 62 6a 65 | 63 74 0a 77 69 74 68 6f |od' obje|ct.witho|
|00005d00| 75 74 20 6a 75 73 74 20 | 74 65 6c 6c 69 6e 67 20 |ut just |telling |
|00005d10| 79 6f 75 20 68 6f 77 20 | 74 6f 20 6d 61 6b 65 20 |you how |to make |
|00005d20| 6f 6e 65 2e 20 20 53 6f | 2c 20 68 65 72 65 27 73 |one. So|, here's|
|00005d30| 20 61 20 67 65 6e 65 72 | 61 6c 0a 61 6c 67 6f 72 | a gener|al.algor|
|00005d40| 69 74 68 6d 20 66 6f 72 | 20 6d 61 6b 69 6e 67 20 |ithm for| making |
|00005d50| 61 20 42 53 50 2d 74 72 | 65 65 20 6f 62 6a 65 63 |a BSP-tr|ee objec|
|00005d60| 74 20 66 72 6f 6d 20 79 | 65 20 61 76 65 72 61 67 |t from y|e averag|
|00005d70| 65 20 6f 62 6a 65 63 74 | 3a 0a 20 20 20 20 31 29 |e object|:. 1)|
|00005d80| 20 50 69 63 6b 20 61 20 | 73 75 72 66 61 63 65 20 | Pick a |surface |
|00005d90| 74 6f 20 63 61 6c 6c 20 | 74 68 65 20 72 6f 6f 74 |to call |the root|
|00005da0| 20 6e 6f 64 65 2e 0a 20 | 20 20 20 32 29 20 43 6f | node.. | 2) Co|
|00005db0| 6d 70 61 72 65 20 65 76 | 65 72 79 20 6f 74 68 65 |mpare ev|ery othe|
|00005dc0| 72 20 73 75 72 66 61 63 | 65 20 69 6e 20 74 68 65 |r surfac|e in the|
|00005dd0| 20 73 65 74 20 6f 66 20 | 73 75 72 66 61 63 65 73 | set of |surfaces|
|00005de0| 20 74 6f 20 74 68 65 0a | 0a 20 20 20 20 20 20 20 | to the.|. |
|00005df0| 20 72 6f 6f 74 20 6e 6f | 64 65 2e 0a 0a 20 20 20 | root no|de... |
|00005e00| 20 33 29 20 49 66 20 61 | 20 73 75 72 66 61 63 65 | 3) If a| surface|
|00005e10| 20 69 73 20 49 6e 2d 46 | 72 6f 6e 74 2d 4f 66 20 | is In-F|ront-Of |
|00005e20| 74 68 65 20 72 6f 6f 74 | 20 6e 6f 64 65 2c 20 74 |the root| node, t|
|00005e30| 68 65 6e 20 70 75 74 20 | 69 74 20 69 6e 0a 20 20 |hen put |it in. |
|00005e40| 20 20 20 20 20 20 74 68 | 65 20 27 46 72 6f 6e 74 | th|e 'Front|
|00005e50| 20 48 65 61 70 27 2e 0a | 20 20 20 20 20 20 20 49 | Heap'..| I|
|00005e60| 66 20 61 20 73 75 72 66 | 61 63 65 20 69 73 20 42 |f a surf|ace is B|
|00005e70| 65 68 69 6e 64 20 74 68 | 65 20 72 6f 6f 74 20 6e |ehind th|e root n|
|00005e80| 6f 64 65 2c 20 74 68 65 | 6e 20 70 75 74 20 69 74 |ode, the|n put it|
|00005e90| 20 69 6e 20 74 68 65 0a | 20 20 20 20 20 20 20 20 | in the.| |
|00005ea0| 27 42 61 63 6b 20 48 65 | 61 70 27 2e 0a 20 20 20 |'Back He|ap'.. |
|00005eb0| 20 20 20 20 49 66 20 6e | 65 69 74 68 65 72 20 6f | If n|either o|
|00005ec0| 66 20 74 68 65 20 61 62 | 6f 76 65 20 69 73 20 74 |f the ab|ove is t|
|00005ed0| 72 75 65 2c 20 63 68 6f | 70 20 75 70 20 74 68 65 |rue, cho|p up the|
|00005ee0| 20 73 75 72 66 61 63 65 | 20 69 6e 74 6f 0a 20 20 | surface| into. |
|00005ef0| 20 20 20 20 20 20 73 6d | 61 6c 6c 65 72 20 73 75 | sm|aller su|
|00005f00| 72 66 61 63 65 73 20 74 | 68 61 74 20 61 72 65 20 |rfaces t|hat are |
|00005f10| 61 6c 6c 20 65 69 74 68 | 65 72 20 49 6e 2d 46 72 |all eith|er In-Fr|
|00005f20| 6f 6e 74 2d 4f 66 20 6f | 72 20 42 65 68 69 6e 64 |ont-Of o|r Behind|
|00005f30| 0a 20 20 20 20 20 20 20 | 20 74 68 65 20 72 6f 6f |. | the roo|
|00005f40| 74 20 6e 6f 64 65 2e 20 | 20 28 54 68 69 73 20 69 |t node. | (This i|
|00005f50| 73 20 74 68 65 20 74 72 | 69 63 6b 79 20 62 69 74 |s the tr|icky bit|
|00005f60| 29 2e 0a 20 20 20 20 34 | 29 20 52 65 70 65 61 74 |).. 4|) Repeat|
|00005f70| 20 74 68 65 73 65 20 73 | 74 65 70 73 20 77 69 74 | these s|teps wit|
|00005f80| 68 20 74 68 65 20 27 46 | 72 6f 6e 74 20 48 65 61 |h the 'F|ront Hea|
|00005f90| 70 27 20 61 6e 64 20 74 | 68 65 20 27 42 61 63 6b |p' and t|he 'Back|
|00005fa0| 20 48 65 61 70 27 2e 0a | 41 73 20 61 6e 20 69 6e | Heap'..|As an in|
|00005fb0| 74 65 72 65 73 74 69 6e | 67 20 6e 6f 74 65 2c 20 |terestin|g note, |
|00005fc0| 49 20 63 61 6e 20 73 65 | 65 20 6e 6f 20 61 64 76 |I can se|e no adv|
|00005fd0| 61 6e 74 61 67 65 20 61 | 74 20 61 6c 6c 20 74 6f |antage a|t all to|
|00005fe0| 20 74 72 79 69 6e 67 20 | 74 6f 20 6b 65 65 70 0a | trying |to keep.|
|00005ff0| 61 20 72 65 6c 61 74 69 | 76 65 6c 79 20 62 61 6c |a relati|vely bal|
|00006000| 61 6e 63 65 64 20 74 72 | 65 65 2e 0a 0a 20 20 20 |anced tr|ee... |
|00006010| 20 20 4e 6f 77 20 63 6f | 6d 65 73 20 74 68 65 20 | Now co|mes the |
|00006020| 69 6e 74 65 72 65 73 74 | 69 6e 67 20 62 69 74 2e |interest|ing bit.|
|00006030| 20 20 4e 6f 77 20 74 68 | 61 74 20 74 68 65 20 6f | Now th|at the o|
|00006040| 62 6a 65 63 74 20 69 73 | 20 61 20 27 67 6f 6f 64 |bject is| a 'good|
|00006050| 27 0a 42 53 50 2d 74 72 | 65 65 20 6f 62 6a 65 63 |'.BSP-tr|ee objec|
|00006060| 74 2c 20 69 74 20 69 73 | 20 74 69 6d 65 20 66 6f |t, it is| time fo|
|00006070| 72 20 74 68 65 20 64 72 | 61 77 69 6e 67 20 61 6c |r the dr|awing al|
|00006080| 67 6f 72 69 74 68 6d 2e | 20 20 54 68 69 73 20 69 |gorithm.| This i|
|00006090| 73 20 66 61 69 72 6c 79 | 0a 73 74 72 61 69 67 68 |s fairly|.straigh|
|000060a0| 74 2d 20 66 6f 72 77 61 | 72 64 2e 0a 20 20 20 20 |t- forwa|rd.. |
|000060b0| 31 29 20 43 6f 6d 70 61 | 72 65 20 74 68 65 20 72 |1) Compa|re the r|
|000060c0| 6f 6f 74 20 6e 6f 64 65 | 20 77 69 74 68 20 79 6f |oot node| with yo|
|000060d0| 75 2e 0a 20 20 20 20 32 | 29 20 49 66 20 79 6f 75 |u.. 2|) If you|
|000060e0| 20 61 72 65 20 49 6e 2d | 46 72 6f 6e 74 2d 4f 66 | are In-|Front-Of|
|000060f0| 20 74 68 65 20 72 6f 6f | 74 20 6e 6f 64 65 2c 0a | the roo|t node,.|
|00006100| 20 20 20 20 20 20 20 20 | 64 72 61 77 20 27 52 6f | |draw 'Ro|
|00006110| 6f 74 2d 3e 42 61 63 6b | 27 2c 20 74 68 65 6e 20 |ot->Back|', then |
|00006120| 74 68 65 20 52 6f 6f 74 | 20 73 75 72 66 61 63 65 |the Root| surface|
|00006130| 2c 20 74 68 65 6e 20 27 | 52 6f 6f 74 2d 3e 46 72 |, then '|Root->Fr|
|00006140| 6f 6e 74 27 2e 0a 20 20 | 20 20 20 20 20 49 66 20 |ont'.. | If |
|00006150| 79 6f 75 20 61 72 65 20 | 42 65 68 69 6e 64 20 74 |you are |Behind t|
|00006160| 68 65 20 72 6f 6f 74 20 | 6e 6f 64 65 2c 0a 20 20 |he root |node,. |
|00006170| 20 20 20 20 20 20 64 72 | 61 77 20 27 52 6f 6f 74 | dr|aw 'Root|
|00006180| 2d 3e 46 72 6f 6e 74 27 | 2c 20 74 68 65 6e 20 74 |->Front'|, then t|
|00006190| 68 65 20 52 6f 6f 74 20 | 73 75 72 66 61 63 65 20 |he Root |surface |
|000061a0| 28 75 6e 6c 65 73 73 20 | 79 6f 75 27 72 65 0a 20 |(unless |you're. |
|000061b0| 20 20 20 20 20 20 20 62 | 61 63 6b 66 61 63 65 20 | b|ackface |
|000061c0| 63 75 6c 6c 69 6e 67 29 | 2c 20 74 68 65 6e 20 27 |culling)|, then '|
|000061d0| 52 6f 6f 74 2d 3e 42 61 | 63 6b 27 2e 0a 0a 20 20 |Root->Ba|ck'... |
|000061e0| 20 20 20 49 20 66 75 6c | 6c 79 20 61 64 6d 69 74 | I ful|ly admit|
|000061f0| 20 74 68 61 74 20 49 20 | 64 69 64 6e 27 74 20 62 | that I |didn't b|
|00006200| 65 6c 69 65 76 65 20 42 | 53 50 2d 74 72 65 65 73 |elieve B|SP-trees|
|00006210| 20 77 6f 75 6c 64 20 77 | 6f 72 6b 20 77 68 65 6e | would w|ork when|
|00006220| 20 49 0a 66 69 72 73 74 | 20 72 65 61 64 20 61 62 | I.first| read ab|
|00006230| 6f 75 74 20 74 68 65 6d | 20 69 6e 20 46 6f 6c 65 |out them| in Fole|
|00006240| 79 2d 76 61 6e 20 44 61 | 6d 2c 20 6e 6f 72 20 64 |y-van Da|m, nor d|
|00006250| 69 64 20 49 20 62 65 6c | 69 65 76 65 20 74 68 65 |id I bel|ieve the|
|00006260| 79 20 77 6f 75 6c 64 0a | 77 6f 72 6b 20 61 66 74 |y would.|work aft|
|00006270| 65 72 20 73 65 65 69 6e | 67 20 74 68 65 6d 20 77 |er seein|g them w|
|00006280| 6f 72 6b 20 66 6f 72 20 | 6d 65 2e 20 20 4e 6f 77 |ork for |me. Now|
|00006290| 2c 20 74 68 72 65 65 20 | 6d 6f 6e 74 68 73 20 6c |, three |months l|
|000062a0| 61 74 65 72 2c 20 49 20 | 66 75 6c 6c 79 0a 62 65 |ater, I |fully.be|
|000062b0| 6c 69 65 76 65 20 74 68 | 65 79 20 77 6f 72 6b 2c |lieve th|ey work,|
|000062c0| 20 61 6e 64 20 49 20 63 | 61 6e 20 65 76 65 6e 20 | and I c|an even |
|000062d0| 73 61 79 20 49 20 75 6e | 64 65 72 73 74 61 6e 64 |say I un|derstand|
|000062e0| 20 77 68 79 2e 20 20 49 | 20 6d 61 79 20 73 6f 6f | why. I| may soo|
|000062f0| 6e 0a 61 74 74 65 6d 70 | 74 20 61 6e 20 65 78 70 |n.attemp|t an exp|
|00006300| 6c 61 6e 61 74 69 6f 6e | 20 68 65 72 65 2c 20 62 |lanation| here, b|
|00006310| 75 74 20 73 75 66 66 69 | 63 65 20 69 74 20 66 6f |ut suffi|ce it fo|
|00006320| 72 20 6e 6f 77 20 74 6f | 20 73 61 79 2c 20 27 74 |r now to| say, 't|
|00006330| 68 65 79 20 63 61 6e 20 | 62 65 0a 67 72 6f 6b 6b |hey can |be.grokk|
|00006340| 65 64 27 2e 0a 0a 31 33 | 29 20 53 68 61 64 69 6e |ed'...13|) Shadin|
|00006350| 67 2e 0a 0a 20 20 20 20 | 20 53 6f 72 72 79 2e 2e |g... | Sorry..|
|00006360| 2e 20 54 68 69 73 20 69 | 73 20 61 20 46 41 51 20 |. This i|s a FAQ |
|00006370| 69 6e 2d 70 72 6f 67 72 | 65 73 73 2e 20 20 57 69 |in-progr|ess. Wi|
|00006380| 6c 6c 20 64 6f 20 6d 6f | 72 65 20 6c 61 74 65 72 |ll do mo|re later|
|00006390| 2e 20 20 50 6c 65 61 73 | 65 0a 66 65 65 6c 20 66 |. Pleas|e.feel f|
|000063a0| 72 65 65 20 74 6f 20 73 | 65 6e 64 20 6d 65 20 61 |ree to s|end me a|
|000063b0| 20 70 61 72 61 67 72 61 | 70 68 20 66 6f 72 20 74 | paragra|ph for t|
|000063c0| 68 69 73 20 73 65 63 74 | 69 6f 6e 2e 0a 0a 31 34 |his sect|ion...14|
|000063d0| 29 20 33 2d 73 70 61 63 | 65 20 63 6c 69 70 70 69 |) 3-spac|e clippi|
|000063e0| 6e 67 2e 0a 0a 20 20 20 | 20 20 53 6f 72 72 79 2e |ng... | Sorry.|
|000063f0| 2e 2e 20 54 68 69 73 20 | 69 73 20 61 20 46 41 51 |.. This |is a FAQ|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.