Experimentelle 2D- und 3D-Animation. Der PC in der Grafik, Werbung und Design

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 07:15, 21 June 2016 by Morn (Talk | contribs)

Jump to: navigation, search
Cover
Back cover

Experimentelle 2D- und 3D-Animation. Der PC in der Grafik, Werbung und Design ("Experimental 2-D and 3-D animation—the PC in graphics, advertising, and design") is a book by Fred Wagenknecht about creating simple 2-D and 3-D vector graphics in Locomotive BASIC.

Somewhat confusingly, the book title refers to the PC rather than the CPC, but apparently this was supposed to mean home computers in general, not IBM-compatible PCs. Wagenknecht points out that while the programs were written for the CPC 464, porting to other BASIC implementations is relatively straightforward.

The focus of the book is on short vector-based animations, although of course BASIC is much too slow to render them in real-time. Then again, the target audience of the book are, at least according to the subtitle, graphic designers and artists, who would presumably have the necessary equipment to e.g. print completed frames or store them on video tape or Super 8 film (chapter 6 deals with this).

Information

Title: Experimentelle 2D- und 3D-Animation. Der PC in der Grafik, Werbung und Design
Authors: Fred Wagenknecht
Publisher: Vogel Verlag und Druck
Year: 1986
Pages: 178
ISBN: 3-80230-877-8

Sample programs

Three sample programs from the book are shown below. The actual source code in the book also has comments of course.

SHAPES.BAS (p.38)

Wagenknecht shapes.png
2 ' *** SHAPES ***
3 '
10 DEG:INK 0,0:INK 1,24:BORDER 1
15 CLS
20 d=30
40 FOR alpha=0 TO 360 STEP 6
60 RESTORE
70 READ x,y
80 GOSUB 190:PLOT bx,by
90 FOR i=2 TO 5
100 READ x,y
110 GOSUB 190
120 DRAW bx,by
130 NEXT i
140 d=d-1
150 IF d<0 THEN 170
160 NEXT alpha
170 END
190 xe=x*COS(alpha)-y*SIN(alpha)
200 ye=SIN(alpha)+y*COS(alpha)
210 bx=d*xe+320: by=d*ye+200
220 RETURN
230 DATA -5,5,5,5,5,-5,-5,-5,-5,5

GEWINDE.BAS (pp. 122/123)

Wagenknecht gewinde.gif
5 '   *** Gewindemutter ***
6 '
10 MODE 2:INK 0,0:INK 1,24:CLS
20 DEG
40 alpha=0
50 beta=0
60 abstand=20
70 entf=500
80 vx=320
90 vy=210
130 FOR beta=0 TO 360 STEP 18
180 READ x,y,z:GOSUB 380:PLOT bx,by
190 FOR i=1 TO 31:READ x,y,z:GOSUB 380
200 DRAW bx,by
210 NEXT i
220 RESTORE
340 FOR u=0 TO 360
350 x=3*COS(u):y=3*SIN(u):z=0:GOSUB 380:PLOT bx,by:NEXT u
351 FOR u=0 TO 360:x=3*COS(u):y=3*SIN(u):z=4
352 GOSUB 380:PLOT bx,by:NEXT u:z=0
353 FOR u=0 TO 1600 STEP 2:x=3*COS(u):y=3*SIN(u):z=z+0.005
354 GOSUB 380:PLOT bx,by:NEXT u
360 CLS:NEXT beta
370 END
380 '
410 w1=SIN(alpha):w2=COS(alpha):w3=SIN(beta):w4=COS(beta)
420 xp=-x*w1+y*w2
430 yp=-x*w2*w4-y*w1*w4+z*w3
440 zp=-x*w3*w1-y*w2*w1-z*w4+abstand
450 bx=entf*xp/zp+vx
460 by=vy-entf*yp/zp
470 RETURN
510 DATA 2,5,0,5,2,0,5,-2,0,2,-5,0,-2,-5,0,-5,-2,0,-5,2,0
520 DATA -2,5,0,2,5,0
530 DATA 2,5,4,5,2,4,5,2,0,5,2,4,5,-2,4,5,-2,0,5,-2,4
540 DATA 2,-5,4,2,-5,0,2,-5,4,-2,-5,4,-2,-5,0,-2,-5,4
550 DATA -5,-2,4,-5,-2,0,-5,-2,4,-5,2,4,-5,2,0,-5,2,4
560 DATA -2,5,4,-2,5,0,-2,5,4,2,5,4

KUGEL.BAS (pp. 90-92)

Wagenknecht kugel.gif
30 ' Kugel mit umlaufender Schrift ("NEWS")
40 '
50 MODE 1:INK 0,0:BORDER 3
60 INK 1,26:INK 2,2:INK 3,11
70 DEG
110 mx=320
120 my=200
130 w1=-30
140 w2=0
150 w3=0
160 r=220
170 kr=180
180 kx=320
190 ky=200
230 FOR w3=300 TO -90 STEP -30
300 '
301 a(1)=COS(w2)*COS(w3)
302 a(2)=-COS(w2)*SIN(w3)
303 a(3)=SIN(w2)
304 a(4)=COS(w1)*SIN(w3)+SIN(w1)*SIN(w2)*COS(w3)
305 a(5)=COS(w1)*COS(w3)-SIN(w1)*SIN(w2)*SIN(w3)
306 a(6)=-SIN(w1)*COS(w2)
307 a(7)=SIN(w1)*SIN(w3)-COS(w1)*SIN(w2)*COS(w3)
308 a(8)=SIN(w1)*COS(w3)+COS(w1)*SIN(w2)*SIN(w3)
309 a(9)=COS(w1)*COS(w2)
320 FOR a=0 TO 180 STEP 15
330 GOSUB 770:p1=cx:p2=cy
340 FOR h=0 TO 360 STEP 15
350 GOSUB 770
360 p3=cx:p4=cy:
370 PLOT p1,p2,2:DRAW p3,p4,2
380 p1=p3:p2=p4
390 NEXT h,a
400 '
410 FOR h=-90 TO 90 STEP 15
420 a=0
430 GOSUB 770:p1=cx:p2=cy
440 FOR a=0 TO 360 STEP 15
450 GOSUB 770
460 p3=cx:p4=cy
470 PLOT p1,p2,3:DRAW p3,p4,3
480 p1=p3:p2=p4
490 NEXT a,h
500 RESTORE
510 ' N
520 READ a,h:GOSUB 770
530 PLOT bx,by,2
540 FOR d=2 TO 10
550 READ a,h:GOSUB 770
560 DRAW bx,by,1: NEXT d
570 ' E
580 READ a,h:GOSUB 770
590 PLOT bx,by
600 FOR d=12 TO 19: READ a,h
610 GOSUB 770
620 DRAW bx,by,1: NEXT d
630 ' W
640 READ a,h: GOSUB 770
650 PLOT bx,by
660 FOR d=20 TO 31:READ a,h
670 GOSUB 770:DRAW bx,by,1:NEXT d
680 ' S
690 READ a,h:GOSUB 770
700 PLOT bx,by
710 FOR d=33 TO 43:READ a,h
720 GOSUB 770:DRAW bx,by,1:NEXT d
721 text$="Bitte Taste druecken!":text1=39-LEN(text$):text2=text1/2:LOCATE text2,25:PRINT text$;:CLEAR INPUT
722 IF INKEY$="" THEN 722
730 CLS
740 NEXT w3
750 END
770 '
780 x=COS(h)*COS(a)
790 y=COS(h)*SIN(a)
800 z=SIN(h)
900 xa=a(1)*x+a(2)*y+a(3)*z
910 ya=a(4)*x+a(5)*y+a(6)*z
920 za=a(7)*x+a(8)*y+a(9)*z
930 bx=mx+r*xa: by=my+r*za :
940 cx=kx+kr*xa:cy=ky+kr*za :
950 RETURN
970 DATA 0,-15,0,-5,0,5,0,15,4,5
980 DATA 7.5,-5,15,-15,15,-5,15,5
990 DATA 15,15
1000 DATA 30,15,20,15,20,5,20,0,30,0
1010 DATA 20,0,20,-5,20,-15,30,-15
1020 DATA 35,15,36,5,38,-5,40,-15
1030 DATA 42,-5,44,5,45,15,46,5,48,-5
1040 DATA 50,-15,52,-5,54,5,55,15
1050 DATA 75,5,75,10,70,15,65,15,60,10
1060 DATA 60,0,75,0,75,-10,70,-15
1070 DATA 65,-15,60,-10,60,-5

Download