'=========================================================================== ' Subject: 3D ROTATION OF 2D PICTURE Date: 03-15-97 (21:20) ' Author: Xtance Coders Alliance Code: QB, QBasic, PDS ' Origin: harryst@castel.nl Packet: GRAPHICS.ABC '=========================================================================== ' a Xtance Coders Alliance Release ' ' A realy f***tup 3d some thing shower, ummz, yeah my old name TCP ' ' 'mail - mrsnow@freemail.nl (For all your questions..) ' '29-04-96 RANDOMIZE TIMER ON ERROR GOTO Master X = 0 ' \ Y = 0 ' | Clear all Variables Z = 0 ' | and Make the ANG EX = 0 ' | From 10 / 57.29578 EY = 0 ' | Already Counted for you. MP = 1 ' | VP = 1 ' | 10 / 57.29578 = CS = 1 ' | -------------------- C = 10 ' | ******.1745329****** D = 5000 ' | -------------------- ChangeColors = -1 ' | Colors Random (-1) or one Color SType = 8 ' | Screen Type ANG = .1745329 ' / DIM M(500, 3) ' Dimension an array to hold the values. PRINT : PRINT PRINT "Xtance Coders alliance Presents Sample for 2d Coding in QuickBASIC / PDS" PRINT "Coded by Mr. SN()W^Xtance Coders Allaince (Prezident)" PRINT : PRINT "To abort press [ESCAPE] Allot....." SLEEP (1) GOSUB ReadData ' \ GOSUB BuildScreen ' | - To load and display rotation.. GOSUB Redraw ' / New: DO ' DEF SEG = 0 ' DONNO POKE 1050, PEEK(1052) ' POKE SOME THING INTO MEMORY DEF SEG ' DONNO rOTTA = INT(RND * 255) ' INKEY$ Shout be Inkey$ but for demo randomize timer IF rOTTA = 88 THEN GOSUB XRot 'X ROTATE (x) IF rOTTA = 89 THEN GOSUB YRot 'Y ROTATE (y) IF rOTTA = 90 THEN GOSUB ZRot 'Z ROTATE (z) ' WAIT &H3D3, 8 LOOP UNTIL INKEY$ = CHR$(27) SCREEN 0: WIDTH 80 PRINT "Xtance Coders Alliance sample for 3d rotation.. dunno... Cya..." END Redraw: IF X > 319 THEN X = X - 640 IF X < -320 THEN X = X + 640 IF Y > 199 THEN Y = Y - 400 IF Y < -200 THEN Y = Y + 400 NRedraw: XP = ((X * D) / (D + Z)) + 320 YP = (((Y * D) / (D + Z)) / 2) + 100 RETURN BuildScreen: CLS FOR I = 1 TO MP - 1 IF ChangeColor = -1 THEN LinColor = RND * 20 ELSE LinColor = ChangeColor END IF X = M(I, 1): Y = M(I, 2): Z = M(I, 3) GOSUB NRedraw IF M(I, 0) = 0 THEN LINE (XP, YP)-(XP, YP), RND * 20 ELSE LINE -(XP, YP), RND * 10 END IF NEXT I COLOR RND * 7 LOCATE 24, 1: PRINT "A Xtance Coders Alliance Relase"; GOTO New ZRot: FOR I = 1 TO MP X = M(I, 1) Y = M(I, 2) XN = (.9848078 * X) + (.1736482 * Y) YN = (.9848078 * Y) - (.1736482 * X) M(I, 1) = XN M(I, 2) = YN NEXT I GOTO BuildScreen XRot: FOR I = 1 TO MP Y = M(I, 2) Z = M(I, 3) YN = (.9848078 * Y) + (.1736482 * Z) ZN = (.9848078 * Z) - (.1736482 * Y) M(I, 2) = YN M(I, 3) = ZN NEXT I GOTO BuildScreen YRot: FOR I = 1 TO MP X = M(I, 1) Z = M(I, 3) XN = (.9848078 * X) + (.1736482 * Z) ZN = (.9848078 * Z) - (.1736482 * X) M(I, 1) = XN M(I, 3) = ZN NEXT I GOTO BuildScreen ReadData: RESTORE pICDATA READ MP FOR I = 1 TO MP READ M, X, Y, Z M(I, 0) = M M(I, 1) = X * 2 M(I, 2) = Y * 2 M(I, 3) = Z * 2 NEXT I SCREEN 8 RETURN pICDATA: DATA 84 DATA 0,-100, 0, 0 DATA 1,-100,-45, 0 DATA 1,-145,-45, 0 DATA 1,-145,-70, 0 DATA 0,-100, 0, 0 DATA 1,-70, 0, 0 DATA 1,-70,-45, 0 DATA 1,-25,-45, 0 DATA 1,-25,-70, 0 DATA 1,-145,-70, 0 DATA 0,-60,-30, 0 DATA 1,-60, 25, 0 DATA 1,-60, 40, 0 DATA 1, 5, 40, 0 DATA 1, 5, 15, 0 DATA 1,-35, 15, 0 DATA 1,-35,-5, 0 DATA 1, 5,-5, 0 DATA 1, 5,-30, 0 DATA 1,-60,-30, 0 DATA 0, 15,-70, 0 DATA 1, 15, 0, 0 DATA 1, 40, 0, 0 DATA 1, 40,-30, 0 DATA 1, 75,-30, 0 DATA 1, 75,-70, 0 DATA 1, 15,-70, 0 DATA 0,-140,-65, 0 DATA 1,-140,-50, 0 DATA 1,-95,-50, 0 DATA 1,-95,-5, 0 DATA 1,-75,-5, 0 DATA 1,-75,-50, 0 DATA 1,-30,-50, 0 DATA 1,-30,-65, 0 DATA 1,-140,-65, 0 DATA 0,-55,-25, 0 DATA 1, 0,-25, 0 DATA 0, 0,-10, 0 DATA 1, 0,-10, 0 DATA 1, 0,-10, 0 DATA 0, 0,-25, 0 DATA 1, 0,-10, 0 DATA 1,-40,-10, 0 DATA 1,-40, 20, 0 DATA 1, 0, 20, 0 DATA 1, 0, 35, 0 DATA 1,-55, 35, 0 DATA 1,-55,-20, 0 DATA 1,-55,-25, 0 DATA 0, 20,-65, 0 DATA 1, 20,-5, 0 DATA 1, 35,-5, 0 DATA 1, 35,-35, 0 DATA 1, 70,-35, 0 DATA 1, 70,-65, 0 DATA 1, 20,-65, 0 DATA 0,-135,-60, 0 DATA 1,-135,-55, 0 DATA 1,-90,-55, 0 DATA 1,-90,-10, 0 DATA 1,-80,-10, 0 DATA 1,-80,-55, 0 DATA 1,-35,-55, 0 DATA 1,-35,-60, 0 DATA 1,-135,-60, 0 DATA 0,-50,-20, 0 DATA 1,-50,-20, 0 DATA 1,-50, 30, 0 DATA 1,-5, 30, 0 DATA 1,-5, 25, 0 DATA 1,-45, 25, 0 DATA 1,-45,-15, 0 DATA 1,-5,-15, 0 DATA 1,-5,-20, 0 DATA 1,-50,-20, 0 DATA 0, 25,-60, 0 DATA 1, 25,-10, 0 DATA 1, 30,-10, 0 DATA 1, 30,-40, 0 DATA 1, 65,-40, 0 DATA 1, 65,-60, 0 DATA 1, 25,-60, 0 DATA 0, 0, 0, 0 Master: RESUME NEXT