9/95 Anim3D - 3D ml animator ~~~~~~~~~~~~~~~~~~~~~~~ do you want to make your own 3D animation easily? HP48 : S, Sx, G, Gx version: Anim3D V1.0 Author: Tamir Demri -> s2543671@techst02.technion.ac.il Keys : right arrow : move point of view to right left arrow : move point of view to left up arrow : ... up down arrow : ... down CST : increase the speed of left-right rotating EVAL : decrease the speed of left-right rotating PRG : increase the speed of up-down rotating STO : decrease the speed of up-down rotating multiple keys can be pressed at once ON key quits there are 2 ways of using this prog: 1. download the demos (Demo1 , Anim3D) to the HP and try them 2. do 1 and then create your own animation MAKING YOUR OWN ANIMATION in order to create your own animation you need TOOLS or GNU TOOLS. there is a posibility to use JAZZ but it doesn't support macros so you'll have to work hard (just use your fingers and do what the macro does). the source code is broken into 2 parts: Anim3D.s : this you don't change. you compile this file. Shape.dat : this file describes the shape that you'll see in the demo and by modifying it you create new shapes. so do next: 1. edit Shape.dat according to the wanted lines. 2. compile Anim3D.s (which includes Shape.dat) using the tools. 3. download it to the hp 4. run and view the resault SHAPE DESCRIPTION: a shape consists of up to 24 line in the 3D space. you define it by specifying the start and end points of all the lines. defining a line: LINE x1,y1,z1,x2,y2,z2 (equals to 2 POINTs) defining a point: POINT x,y,z repeat an old point: OLD_PNT distance_back ( no of points ) defining no of points (=number of lines*2) Points EQU ? remarks: 1. ** DON'T FORGET TO UPDATE THE NUMBER OF POINTS -> \Points EQU ?\ ** 2. x,y,z,.. are all integers between -18 to 18 (in order to be sure that the point will not go out of the display) 3. if the program gets a point out of range (after the tarnsform) then it aborts immediately.(completely safe) 4. there should be no white space between the argument and the commas 5. the purpose of OLD_PNT is that the prog won't have to transform twice the same point (takes time). but any way you don't have to use it although you'll get better resaults if you do. (but be careful not to do mistakes. the prog doesn't look for them => dangerous) examples: 1. LINE x,y,z,x,y,z is qeual to POINT x,y,z POINT x,y,z which equal to POINT x,y,z OLD_PNT 1 ( one point back ) 2. to make a line from (-10,13,10) to (0,0,0) and line from (0,0,0) to (2,-8,18) do (easy way) LINE -10,13,10,0,0,0 LINE 0,0,0,2,-8,18 or (good way) LINE -10,13,10,0,0,0 OLD_PNT 1 POINT 2,-8,18 or (good way too) LINE 0,0,0,-10,13,10 POINT 2,-8,18 OLD_PNT 3 ((0,0,0) is 3 points back) SOME THEORY: the transform I used is: parallel projection ( no perpective ) X'=-sin(phi)*X+cos(phi)*Y Y'=-sin(theta)*(cos(phi)*X+sin(phi)*y)+Z*cos(theta) - phi is the angle to the right. - theta is the angle up. that means that your head is always vertical to ground (gravity is working). this is the best choise to my opinion. ADVANCED USER: 1. when the clock is on then the prog is slower. the timer interrupt causes that the key pressed will be detected despite of the INTOFF and that starts an interrupt chain until you leave the key(s). to solve this program you can uncomment the DisableIntr (but change the ON key trapping scheme) or just turn off the clock (best way) 2. the constraint on the number of lines (24) is because that I used IRAMBUFF as a temp memory for holding the buffer and the points but: 3. althought I used the IRAMBUFF I didn't use even page method (even that it is easier) so that with few little changes other memory allocation methods can be used. 4. in order that the viewer won't notice the display clearing before every plot then I used 2 grobs (the original display grob and a NEWOB version of it) that are swaped after the plot is done. if you don't like the extra memory for the grob : disable it. 5. I used a sin table of size 103 (prime num). every entry is a 2 nibble positive number that corresponds to SIN. you can change number of elements easily (don't forget to change Tsize) in order to save memory or increase precision. you can also change the number of nibbles for each entry but this takes much more changes. DISCLAIMERS : absolutely no responsibility notice that I checked this software only on GX-P, but it should work on others too. having questions? : email me and I will gladly help you. (but please first look at the src and examples) final thing : make new shapes, improve the prog, change it etc. it's yours. I like to know your feedback (although this prog isn't usefull I think it's fun). -\/\/\/\/\- Tamir Demri s2543671@techst02.technion.ac.il ( until 3/96 )