Post by JTS(with snips here and there)
Thanks much for the list of references, a few of them interest me in
particular, I will get them.
Post by Joseph GwinnPost by JTSI am thinking at the moment to write a much simpler program, that deals
with one surface only - with the aim of finding the surface-ray
intersection. I would like as a first target to improve on this
0175740/>
(it is the result of Goptical) which - I think - should be doable. The
idea approximate/solve analytically/refine iteratively seems simple and
some parts of it are even easy to program *once that one has found the
correct approximations* (see in fact your comment later on sphere and
conics as best approximations for imaging optics). For the piecewise
linear approximation the first approach that comes to mind is
tessellating the plane perpendicular to the optical axis with triangles
and then using this tessellation as a starting point for the linear
approximation; then taking the closest intersection with any of the
resulting triangles as the starting point for refinement. I do not have
experience with this but intuitively it should work with many different
surfaces.
The above curve is a parabolic surface, so one can solve directly for the
intersection point, with full precision. No ineration is needed. Likewise
sections of a sphere. Tesselation is not required at all, and is far more
trouble than direct solution.
I agree that for a paraboloid you can solve analytically, but there is a
block which I do not know how to circumvent. I have to insert the CPC as
a custom surface, then the program chooses the numerical intersections.
But let us say that we solve the problem in this particular case
(although the CPC is not a quadric, without looking at the equations I
guess it from the fact that it is called CPC ... half joking here, but
it feels right; I am guessing that parabolae along different meridians
do not belong to the same quadric so that it has to be second order for
meridional rays only); it still remains open for more general surfaces -
and since I want to trace rays for more of these (see answer to your last
question) I need a ray-tracer that finds these intersections.
.
Well, I have not dug into the Goptical source code at all, but I think it
does real 3D vectors and 2D surfaces in 3D space. If so, there is no reason
to worry about meridians et all - it handles skew rays just the same.
Post by JTSBy the way I have written up this afternoon the Newton method for
ray-curve intersection (one dimensional and without any refinement) in
Matlab and I hope to get an insight soon of where is that the ray
tracing of the CPC fails (above linked image).
.
The iterations are basically done by Newton’s method, so this ought to
work.
Post by JTSPost by Joseph GwinnPost by JTSA refinement of this approach could be to approximate twice, once on one
side of the surface, once on the other side (I took this idea from the
Optica website too).
Where?
I have dreamed about it. The reference would have been
<http://www.opticasoftware.com/documentation/Rayica/PrinciplesOfRayica/4Customi
zation/#.3.5>
starting from the words "The problem is solved when a second, bigger
surface function is supplied to SurfaceApproximation.". I had
misinterpreted it as meaning we were supplying two approximations, one
external and one internal; instead it is only changing approximation. It
looked like a nice approach in my mind.
It seems from
Post by Joseph GwinnOne makes a bounding box consisting of a cylinder and two sperical or conic
end-cap faces, with the aspheric optical surface between the two spheres or
conics (whichever is the tighter fit).
that in certain cases it makes sense?
.
The discussion in section 3.5 arose from a discussion I had with Don Barnhart
back in the days of Optica, before it became the present LensLab. This is
easily ten years ago. (There was a predecessor LensLab, if memory serves.)
The issue was how to handle the elements of compound lenses like say a
telephoto lens with 20 elements, some very deeply curved and nested one
within another. A bounding box with planar end caps did not isolate the
elements well enough - a given bounding box could contain two or even three
lens separate elements.
Also, there was the issue of how to initialize the iterative search of
intersection - a plane didn’t work all that well for a steeply curved lens,
and we were worrying about aspheric lenses as well. So, there are two main
cases. Steeply curved, and nearly spherical surfaces. One example is a
schmidt corrector plate for a telescope. Or a maksukov telescope.
In all cases, if the initial approximation was a sphere or conic for which a
closed-form solution existed, the iteration could start very close to the
true intersection, and this would be both faster and -more importantly- far
more likely to converge successfully.
Post by JTSFurther
Post by Joseph GwinnSpeaking of Optica (now LensLab), this may be
helpful:<http://www.opticasoftware.com/documentation/LensLab/LensLabWeb/Over
view/overview.html>
Thanks for this. I have read it about one year ago, but I had forgotten
the name of the author :-)
By the way, reading it again I saw that in LensLab too the
approximate/solve analytically/iterate algorithm is applied, and I had
not realized it. In the small simulation of a CPC that I wrote one year
ago using LensLab several intersections are also missed (leading to a
jagged plot for the transmission-angle curve); I checked if the
SurfaceApproximation settings of Optica applied there too, but (as far
as I can remember) they do not. So I had concluded that no approximation
with a piecewise linear function was being made. By the way the missed
intersections appear in LensLab in another example as well, the "Black
hole", if one changes the intersection method using something else
instead of SurfaceRayIntersections->Solve.
.
I’m not clear as to what was happening, but LensLab does generate piecewise
linear rays or ray trees. The path is linear in a given piece of dielectric
material (like glass), and bends abruptly at the surfaces between kinds of
media (kinds of glass, or at metal surfaces).
Post by JTSThese missed intersections are what motivated me to look for another
program (it is not completely out of the question to get Optica too,
given that LensLab is so nice).
.
All optical design systems do this. You need to debug the problem in LensLab
or Optica. Using a different bit of optical design software will not help.
Although you may have different problems, you will not have fewer problems.
Post by JTSPost by Joseph GwinnWhat do you wish to do or learn with your ray tracer?
The basics of nonimaging optics. I went through a couple of the
fundamentals (edge ray principle, flow lines, SMS 2D) and at least I
understood once the mechanisms (for the flow lines I have already
forgotten them!) - which means I am very very far away from
understanding the scope of the methods, that is for example is what kind
of problems does the SMS method solve that the edge-ray can't (talking
much in general).
.
Ahh. This explains the acceptance of tesselated surfaces. However, tesselated
surfaces are slow to solve, so it’s usually more efficient if you can
describe most surfaceswith simple equations.
Post by JTSPost by Joseph GwinnGoptical is a full-sized optical design tool for imaging systems, or at
least it will someday be.
1) it is sufficient - from one side - for at least simple nonimaging
optics too, as it does nonsequential raytracing; which means in the
simple cases I am looking at, multiple bounces off the same element are
allowed. In the case of a sequential raytrace, we would make one bounce
(or a fixed number of bounces, if we list the same element several
times) and stop.
"Multiple bounces allowed" is how I understood "nonsequential
raytracing" applies to the CPC case:please correct me if I am wrong here.
.
Depends on how Goptical defines things. To be pedantic, sequential raytracing
allows any number of bounces, but they must be specified in advance, and one
can enter the same surface multiple times. But they probably mean non
sequential raytracing, where one always specifies the maximum allowed number
of bends in the ray (one bend to a traversed surface), to prevent infinite
loops. In practice, the ray weakes a bit on each bend, and eventually becomes
too weak to matter - this is also used to prune rays. Another way to prune is
to note that the ray has altogether departed the system under analysis.
Post by JTS2) the intersections can be improved. In the spirit of free software, we
would not need to wait for the original author to do that himself; but I
have a rather long way to go before I can attempt it myself.
Well, yes, but there is no harm in trying - there is nothing to lose. Just
set up an isolated testbed, and start to play with the critical part of the
intersection code, and see what happens. It will fail many times, especially
at first, but will do no damage. So just try again, and learn at every step,
untill it all becomes clear.
Joe Gwinn