Thank you for the responses!
Originally Posted by
ofnuts
Define your classes first. Do you have lenses that bend light rays, or light rays that are bent by lenses? Can you define a generic Lens that can be either a SimpleLens or a CompositeLens, and where you can define a CompositeLens as the association of two Lens (Simple or Composite) and a distance... Once you have the right classes, the methods sort of come out naturally...
In a sequential ray trace, you usually define a system in the following way:
Code:
Space 0: thickness, material (index of refraction)
Surface 0: curvature (inverse of radius)
Space 1: thickness, material
Surface 1: curvature
etc.
So the simplest example, a single lens in air, would be made up of five elements: three spaces and two surfaces. This is a standard approach in optical engineering. It works for simple systems, and scales easily for arbitrarily complex systems.
A ray is normally represented as a 2x1 matrix (N rays would be a 2xN matrix), so it doesn't need its own class as I'm using the matrix implementation from numpy.
@11jmb - what about alternative ways of doing the same thing? Is it alright to use a method to describe the standard way of doing something and then functions for the alternative ways?
Bookmarks