BBS: Inland Empire Archive Date: 03-21-93 (03:42) Number: 354 From: RICH GELDREICH Refer#: NONE To: ALL Recvd: NO Subj: Solid5 4/8 Conf: (2) Quik_Bas

'Page 4 of SOLID5.BAS begins here.D1 = 0: D2 = 0: D3 = 0CASE"0" R1 = 0: R2 = 0: R3 = 0 D1 = 0: D2 = 0: D3 = 0CASE"+" D3 = D3 + 2CASE"-" D3 = D3 - 2CASECHR$(27)ENDCASECHR$(0) + CHR$(72) dz = dz - 20CASECHR$(0) + CHR$(80) dz = dz + 20CASECHR$(0) + CHR$(77) dx = dx - 20CASECHR$(0) + CHR$(75) dx = dx + 20ENDSELECTLOOP'"Culls" the polygons which aren't visible to the viewer. Also shades'each polygon using Lambert's law.SUBCullPolygons'This algorithm for removing hidden faces was developed by Dave _Cooper.'There is another method, by finding the dot product of the'plane's normal and the viewing vector, but this algorithm is'much faster because of its simplicity(and lack of floating point'calculations).FORa = 0TOMaxPolys P1 = Polys(a).P1 P2 = Polys(a).P2 P3 = Polys(a).P3IFPoints(P1).YView <= Points(P2).YViewTHENIFPoints(P3).YView < Points(P1).YViewTHENPTop = P3 PNext = P1 PLast = P2ELSEPTop = P1 PNext = P2 PLast = P3ENDIFELSEIFPoints(P3).YView < Points(P2).YViewTHENPTop = P3 PNext = P1 PLast = P2ELSEPTop = P2 PNext = P3 PLast = P1ENDIFENDIFXLow = Points(PTop).XView YLow = Points(PTop).YView XNext = Points(PNext).XView XLast = Points(PLast).XViewIFXNext <= XLowANDXLast >= XLowTHENPolys(a).Culled = TrueELSEIFXNext >= XLowANDXLast <= XLowTHENPolys(a).Culled = FalseELSEYNext = Points(PNext).YView YLast = Points(PLast).YViewIF((YNext - YLow) * 256&) \ (XNext - XLow) < ((YLast - _ YLow) * 256&) \ (XLast - XLow)THENPolys(a).Culled = FalseELSEPolys(a).Culled = TrueENDIFENDIFNEXTENDSUB'Enters a line into the edge list. For each scan line, the line's'X coordinate is found. Notice the lack of floating point math in this'subroutine.SUBDrawLine (xs, ys, xe, ye, EdgeList()ASEdgeType)IFys > yeTHENSWAPxs, xe: SWAP ys, yeIFye < 0ORys > 199THENEXITSUBIFys < 0THENxs = xs + ((xe - xs) * -ys) \ (ye - ys) ys = 0'Continued on page 5--- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)

Echo Basic Postings

**Books at Amazon:**

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET