Lens system simulator

A fine start for this small inventory of software, a Processing sketch done in too little time for a communications session at college.

Was fun to do, but only landed me 5th place. Better luck next time I suppose. Since the solving and calculating is done graphically and the numerical values were a last minute add-in they aren’t exactly precise.

Features: What this little applet does is calculate and display the virtual(red) and real(green) images of an object, as seen trough up to 99 lenses.

It’s all self explanatory really, except for the keys. To help the curious and the eager to learn/ play, I’ve provided a short list of keyboard and mouse shortcuts.

[mouse right click+drag] pans the image
i,o – zoom in and out
r – reset zoom and panning

[mouse left click] select lens
[mouse left click+drag] moves the object or lenses
s – select next lens
a & d – move selected lens left/right
[arrow keys] – move the object left and right or change its size
q,e – change selected lens’ focal length
l – add lens
[backspace] delete lens
[space] change lens type between convergent and divergent

c – enable/disable colors

What are the textboxes?
In order they are:

  • relative distance to previous lens (or to system center if it’s the first lens)
  • focal distance of the selected lens
  • distance to object for the selected lens and distance to image for the selected lens

You can set the relative distance with the set button, but the other values work a bit differently. You type in 2 of them and click Calc under the third, and presto! it gets calculated. This isn’t very precise so I wouldn’t advise anyone to use it in homework or somesuch, but it works wonders for checking it.

A small bug is that you can’t click on the text boxes, you have to navigate to them using the [Tab] button.

Think that covers everything, or most of it, either way I’d love to hear feedback or suggestions.

Also I’d like to thank Brendan Berg for making the interfascia GUI library for Processing.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)