Author |
Topic: The mechanical eye Open Source project(improved) (Read 358 times) |
|
michael
Senior Member
member is offline


Posts: 335
|
 |
The mechanical eye Open Source project(improved)
« Thread started on: Sep 26th, 2016, 06:06am » |
|
If anyone wants to contribute to the mechanics of this eye, they will contribute to the productivity of everyone. Different types of eyes with mechanical properties can be made. If you want to help improve this eye or add your creation to the project please add a reply to the post.
I put the ellipse controls for the iris and it does need slight perspective adjustment as the pupil nears the edges. It is late at night.. I will work on this more on Monday.
I would like to create a team to make smart body parts for the world that any person or company can sample and use to create animations quickly. What we need is quality body parts. Resizable and able to manage realistic movements. Code: REM width;height;charwidth,charheight,number of colors,character set
VDU 23,22,1024;600;8,15,16,1 :REM max width is 1920 and 1440 height
OFF
VDU 5
c=0
REM A mechanical eye.
REM doing it right is not simple. So this is why it is open source.
REM If you modify this or add to it, the end game is to provide it for humanity
REM to freely use for commercial or personal use.. Thankyou for considering this project.
REPEAT
c=c+1
CLG
PROClefteye(500,500,"center",1)
UNTIL c=100
d=0
REPEAT
d=d+1
CLG
PROClefteye(500,500,"right",1)
UNTIL d=100
d=0
REPEAT
d=d+1
CLG
PROClefteye(500,500,"up",1)
UNTIL d=100
d=0
REPEAT
d=d+1
CLG
PROClefteye(500,500,"left",1)
UNTIL d=100
d=0
REPEAT
d=d+1
CLG
PROClefteye(500,500,"down",1)
UNTIL d=100
d=0
REPEAT
d=d+1
CLG
PROClefteye(500,500,"right",1)
UNTIL d=100
END
DEFPROClefteye(x,y,location$,speed)
PRIVATE dx,dy,counx,couny,eyeh,eyev,seyeh,seyev
IF counx<x-80 THEN counx=x-80:REM this ensures the pupil stays within eye
IF counx>x+80 THEN counx=x+80
IF couny<y-80 THEN couny=y-80
IF couny>y+80 THEN couny=y+80
CASE location$ OF
WHEN "center":dx=x:dy=y:eyeh=40:eyev=40
WHEN "right":dx=x+80:dy=y:eyeh=20:eyev=40
WHEN "down":dx=x:dy=y-80:eyev=20:eyeh=40
WHEN "up":dx=x:dy=y+80:eyev=20:eyeh=40
WHEN "left":dx=x-80:dy=y:eyeh=20:eyev=40
ENDCASE
IF counx<dx THEN counx=counx+1
IF counx>dx THEN counx=counx-1
IF couny<dy THEN couny=couny+1
IF couny>dy THEN couny=couny-1
IF seyeh<eyeh THEN seyeh+=.4
IF seyeh>eyeh THEN seyeh-=.4
IF seyev<eyev THEN seyev+=.4
IF seyev>eyev THEN seyev-=.4
REM dx, dy is meant to hold the destination of the pupil
REM counx,couny is meant to hold the current pupil location
REM eyeh,eyev is meant to hold the shape of the pupil as it moves
REM speed is the rate that the pupil moves. I am not sure how fast it should move but it will be in decimal value
GCOL 15
CIRCLE FILL x,y,100
GCOL 4
ELLIPSE FILL counx,couny,seyeh,seyev
GCOL 0
ELLIPSE FILL counx,couny,seyeh/2,seyev/2
WAIT speed
ENDPROC
|
« Last Edit: Sep 26th, 2016, 11:39am by michael » |
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: The mechanical eye Open Source project(improve
« Reply #1 on: Sep 27th, 2016, 1:13pm » |
|
Hi Michael,
Can I make some suggestions?
1) I'd make it flexible and scaleable right from the word go - it's likely that you'll need to be able to draw the eye at different sizes (for example to indicate distance), so I'd build that in, rather than hard-coding sizes.
2) by putting the WAIT speed statement within the routine you will lock up the whole program, whereas you would likely want it to be redrawing (say) the movement of the legs at the same time. Consider holding a private variable saying where the pupil is at the moment relative to the centre of the eye, and allowing the routine to return as soon as it's drawn one frame? That would mean the main program could be updating all the different body parts in turn.
3) You could consider drawing the white of the eye with two calls to PLOT 181 (draw a filled sector) to make it lenticular rather than elliptical. That poses significant problems in terms of hiding/clipping the iris/pupil, which may be too difficult to implement (I think you'd need to use the alpha channel to mask any bits that weren't in the white region).
4) Will you want to make it possible to angle the whole eye? Cartoons often angle the eyes down towards the centre to indicate anger, for example. You could use the Ellipse library to make this possible, but the calculations for positioning the iris/pupil would become a lot harder! One (Windows only) option might be to draw the eye in its own bitmap (which would facilitate the kind of clipping suggested above), and then use PLGBlt to draw it angled onto the main picture.
Best wishes,
D
|
|
Logged
|
|
|
|
|