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

'Page 5 of SOLID5.BAS begins here.ENDIFxd = xe - xs yd = ye - ysIFyd <> 0THENxi = xd \ yd: xrs = ABS(xdMODyd) xr = -yd \ 2IFye > 199THENye = 199 xdirect = SGN(xd) + xiFORY = ysTOyeIFxs < EdgeList(Y).LowTHENEdgeList(Y).Low = xsIFxs > EdgeList(Y).HighTHENEdgeList(Y).High = xs xr = xr + xrsIFxr > 0THENxr = xr - yd xs = xs + xdirectELSExs = xs + xiENDIFNEXTENDSUBSUBDrawObject'Find the center of each visible polygon, and prepare the order _list. NumPolys = 0FORa = 0TOMaxPolysIFPolys(a).Culled = FalseTHEN'is this polygon visible?Polys(NumPolys).ZOrder = a NumPolys = NumPolys + 1 Polys(a).ZCenter = Points(Polys(a).P1).ZWorld + Points(Poly_ s(a).P2).ZWorld + Points(Polys(a).P3).ZWorldENDIFNEXT'Sort the visible polygons by their Z center using a shell sort.NumPolys = NumPolys - 1 Mid = (NumPolys + 1) \ 2DOFORa = 0TONumPolys - Mid CompareLow = a CompareHigh = a + MidDOWHILEPolys(Polys(CompareLow).ZOrder).ZCenter < _ Polys(Polys(CompareHigh).ZOrder).ZCenterSWAPPolys(CompareLow).ZOrder, Polys(CompareHigh).ZOrder CompareHigh = CompareLow CompareLow = CompareLow - MidIFCompareLow < 0THENEXITDOLOOPNEXTMid = Mid \ 2LOOPWHILEMid > 0'Plot the visible polygons.FORZ = 0TONumPolys a = Polys(Z).ZOrder'which polygon do we plot?P1 = Polys(a).P1: P2 = Polys(a).P2: P3 = Polys(a).P3 PolyFill (Points(P1).XView), (Points(P1).YView), (Points(P2).XV_ iew), (Points(P2).YView), (Points(P3).XView), (Points(P3).YView), _ (Polys(a).Intensity)NEXTENDSUBSUBDrawShadows YLow = 32767: YHigh = -32768 XLow = 32767: XHigh = -32768FORa = 0TOMaxPoints'Project the 3-D point onto the ground plane...temp& = (Points(a).YWorld - 200) X = Points(a).XWorld - (temp& * lx) \ ly Y = 200'ground plane has a constant Y coordinateZ = Points(a).ZWorld - (temp& * lz) \ ly'Put the point into perspectivexTemp = 160 + (X * 400&) \ Z yTemp = 100 + (Y * 300&) \ Z Points(a).XShadow = xTemp Points(a).YShadow = yTemp'Find the lowest & highest X Y coordinatesIFyTemp < YLowTHENYLow = yTempIFyTemp > YHighTHENYHigh = yTempIFxTemp < XLowTHENXLow = xTempIFxTemp > XHighTHENXHigh = xTempNEXT'Store lowest & highest coordinates for later erasing...ShadowXLow(s) = XLow: ShadowYLow(s) = YLow'Continued on page 6--- 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