Home | | Java | | OpticalRayTracer | | Share This Page |
A completely rewritten virtual lens/mirror design workshop
Copyright © 2017, P. Lutus. All Rights Reserved.
Current Version: 9.6 (05.12.2017)
OpticalRayTracer is a powerful, Java-based virtual optical bench. It once functioned perfectly from within a Web page (and on this page) as a Java applet, but it seems applets can no longer be trusted. Here's an image of OpticalRayTracer in operation. Please download OpticalRayTracer and run it as an application (details below).
Click image for more views
Note: Be sure also to see the new Snell's Law Calculator, an online analysis tool.
OpticalRayTracer is a free (GPL) cross-platform application that analyzes systems of lenses and mirrors. It uses optical principles and a virtual optical bench to predict the behavior of many kinds of ordinary and exotic lens types as well as flat and curved mirrors. OpticalRayTracer includes an advanced, easy-to-use interface that allows the user to rearrange the optical configuration by dragging objects around using the mouse.
OpticalRayTracer fully analyzes lens optical properties, incuding refraction and dispersion. The dispersion display uses color-coded light beams to simplify interpretation of the results.
Recent OpticalRayTracer versions allow the creation of mirrors, flat and curved. In modern optical designs, mirrors often produce better results than lenses, for example in astronomical instruments. Such instruments can be roughed out in OpticalRayTracer's virtual workbench.
Educators take note: OpticalRayTracer has significant educational potential in the teaching of basic optical principles, and has some entertaining and game-like behaviors to hold the student's attention.
OpticalRayTracer includes a detailed tutorial/help file to assist the user in getting started in this interesting activity, and this online documentation is also available.
OpticalRayTracer is © Copyright 2017, P. Lutus. All rights reserved.
OpticalRayTracer is released under the General Public License.
OpticalRayTracer is also Careware (http://arachnoid.com/careware),
unless this kind of idea makes you crazy, in which case OpticalRayTracer is free (e.g. GPL).
OpticalRayTracer is a Java application, so it requires a Java runtime engine in order to run. Click this link to pick up your free Java runtime. And for several excellent reasons, be sure to install the most recent Java version available for your platform.
There are three download packages:
For the Windows download, install it as an ordinary application, but remember you need a free Java runtime engine, available here.
For the cross-platform Java JAR file, place the executable in any convenient location and run it with this invocation, usually placed in a shell script:
java -jar (path)/OpticalRayTracer.jar
For the source archive, licensed under the GPL, unpack it in the usual way and make sure you have an up-to-date copy of Eclipse.
Snap-To-Grid Feature
I've gotten a few bug reports submitted by users who couldn't set reliable non-integer X and Y position values. Typically, after they switched their attention to a different optical component, the lens they just positioned jumped to a new location they didn't intend. This is a function called "Snap-To-Grid" and it's a feature, not a bug. To control it, choose the "Configure" tab and change the value in the "Snap-To-Grid Value" entry.
An entry of zero disables the feature and allows the user to set any arbitrary X and Y position values, to any number of decimal places — this is most useful when entering numerical component positions rather than positioning a component using a pointing device. A smaller entry than the default of 0.5 snaps to a smaller increment.
Bug Reports
I've gotten any number of bug reports from users who entered a pathological lens description, saw something strange, then reported that a bug in OpticalRayTracer prevented a successful model — for example light rays were flying all over the place, with no connection to physical reality. My reply is that OpticalRayTracer has some limits to the degree to which it can model reality. There are many possible optical configurations where Snell's Law calculations overflow the dynamic range of an ‎IEEE 754 double-precision floating-point variable, which unfortunately is a relatively common occurrence. Consequently, and because of the complexity of the calculations performed by OpticalRayTracer, there is a limited number of lens types and curvatures the program can model.
Based on the above, please do not submit program bug reports simply based on a complex optical design. Thank you.
History
OpticalRayTracer was originally written in C++ for speed, but several things happened to force a reëvaluation and rewrite in Java. One is that Windows users couldn't use the program. Another is that I spent a fantastic amount of time dealing with inquiries that looked more or less like this:
I saw mention of this package in the context of debian, and tried building it on my Debian Etch system. After installing some required dependencies, it suggested that all was ok to run make. The result was as below. My understanding is that aclocal/automake/autoconf should not be required for a 'tarball install' ? I did a clean configure, then ran aclocal, then a make/make-install seemed to work fine. I think this means that aclocal needs to be run before the tarball is released? =============================== $ make cd . && /bin/bash /home/neil/raytracer/admin/missing --run aclocal-1.6 /home/neil/raytracer/admin/missing: line 46: aclocal-1.6: command not found WARNING: `aclocal-1.6' is missing on your system. You should only need it if you modified `acinclude.m4' or `configure.in'. You might want to install the `Automake' and `Perl' packages. Grab them from any GNU archive site.
This sort of exchange became more frequent as the years went by. Then Trolltech, the maintainers of the GUI package I had foolishly decided to use (Qt), unceremoniously abandoned and replaced it, without any effort to assure compatibility or interoperability between the old and new versions. Essentially Trolltech required that everyone stop whatever they were doing, sit down and write all their applications over again, in order to keep them operational.
Java has a number of drawbacks of its own, but it works on any platform, and its graphical interface (Swing) is relatively stable. Over time I find myself rewriting more applications in Java just because I don't have to deal with people's installation difficulties, which frees me to write new computer programs instead of struggling with the old ones.
Because of what OpticalRayTracer does, I was concerned that under Java it wouldn't be fast enough to deal with the computation workload. But this turns out not to be an issue, and the mature Java interface allowed me to add a number of things that were not practical in the earlier versions.
As is true of most of my recent programs, OpticalRayTracer remembers absolutely everything between uses, and the user can even copy to the clipboard a plain-text snapshot of the program's complete state for transmission to a friend or to archive for future reference.
This version of OpticalRayTracer is in every way superior to the old. It runs in more places, it is designed better, it completes some details that were left unfinished in the old version, and it has a much better way to import and export lens descriptions and program state.
Home | | Java | | OpticalRayTracer | | Share This Page |