technical notes for the raytracing of toroidal surfaces ... · web viewin order to derive the...

16
Technical Notes for the Raytracing of Toroidal Surfaces Table of Contents Technical Notes for the Raytracing of Toroidal Surfaces.......................1 Introduction................................................................2 Toroidal Surface Description................................................3 Range of x & y for Solutions at Real Numbers................................5 Normal Vector of Toroidal Surface...........................................6 Intersection of a Ray and a Torus...........................................8 Special Case: Cylinder Lens................................................10 Cylinder-Line Intersection.................................................10 Parametrical Toroidal Surface Description..................................12 Practical Example with MATLAB..............................................12 Attachement................................................................13 Johannes Störkle, 2020-03-18 1

Upload: others

Post on 14-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Technical Notes for the Raytracing of Toroidal Surfaces

Table of ContentsTechnical Notes for the Raytracing of Toroidal Surfaces................................................................................1

Introduction..................................................................................................................................................2

Toroidal Surface Description........................................................................................................................3

Range of x & y for Solutions at Real Numbers.............................................................................................5

Normal Vector of Toroidal Surface...............................................................................................................6

Intersection of a Ray and a Torus................................................................................................................8

Special Case: Cylinder Lens......................................................................................................................10

Cylinder-Line Intersection..........................................................................................................................10

Parametrical Toroidal Surface Description.................................................................................................12

Practical Example with MATLAB................................................................................................................12

Attachement...............................................................................................................................................13

Johannes Störkle, 2020-03-181

Page 2: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

IntroductionIn geometry, a torus is a surface of revolution generated by revolving a circle in three-dimensional space about an axis that is coplanar with the circle.In optics, a toroidal surface is described with the circle radius r x and the distance R y to the y-axis, known as the radius of rotation.According to ZEMAX, the curve in the Y-Z plane is defined by

zx=0=

1rx

y2

1+√1−(1+κ ) 1r x2 y2

+α1 y2+α2 y

4+…,(1)

where κ is the conic constant with respect to the y-direction. However, the complete three-dimensional formulation is not given in [Zemax11]1. The toroidal surface is shown in Figure 1, whereby the blue curve indicates the curve given by equation (1).

Figure 1: Toroidal Surface with the circle radius r x and the radius of rotation R y

1 [Zemax11] Zemax: Zemax Optical Design Program - User's Manual. Radiant ZEMAXLLC, 2011.

Johannes Störkle, 2020-03-182

r x

R y

Page 3: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Toroidal Surface DescriptionIf the radii in the range of 0≤ rx ≤R y, the toroidal surface in three-dimensional space without a conic constant can be described with

z=R y−√(R y−rx+√r x2− y2 )2−x2

as given in [Gross05]2. In order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within the y-z plane (x=0) it yields

z=R y−(R y−r x+√r x2− y2 )=r x−√rx

2− y2

The last formulation is similar to the description of a spherical surface zSphere=Ri−√Ri2−ρ2. Furthermore,

the introduction of the conic constant leads to

zconicSphere=11+κ (Ri−√Ri

2−(1+κ ) ρ2 )= ρ2

Ri+√Ri2− (1+κ ) ρ2

=

1Ri

ρ2

1+√1− (1+κ ) 1R i2 ρ

2

as derived in [Stoerkle18]3. Hereby, ρ is the radial coordinate and a binominal expansion is used for the arrangement. The last result has the same structure as the first term in equation (1). Thus, the formulation of the conic toroidal surface results in analogy

z=R y−√(R y+11+κ (−rx+√r x

2−(1+κ ) y2 ))2

−x2 .

This can be generalized to values of r x∈Rand R y∈R with

z=R y−sign (r x)√(R y+11+κ (√rx

2− (1+κ ) y2−r x ))2

−x2 ,

if |R y|≥| rx

1+κ|∧r x≥0 ,∨|R y|≤| rx

1+κ|∧r x≤0(2)

and

z=R y−sign (r x)√(R y+11+κ (−√r x

2−(1+κ ) y2−r x ))2

−x2

if |R y|<| r x

1+κ|∧rx>0 ,∨|Ry|>| rx

1+κ|∧r x<0 .

(3)

In order to keep the vertex at the origin, i.e. z (0,0 )=0, a constant z-shift must be applied. This can be formulated for the following cases,

If R y ≥rx

1+κIf R y r x≥0

zcorr=z (4)

If R y r x<0zcorr=z−2R (5)

2 [Gross05] Gross, H. (Ed.): Handbook of Optical Systems Vol. 1 - Fundamentals ofTechnical Optics. Weinheim: Wiley-VCH Verlag, 2005. (see also PPT IAP Jena)3 [Stoerkle18] Störkle, J.: Dynamic Simulation and Control of Optical Systems. No. 58 in Dissertation, Schriften ausdem Institut für Technische und Numerische Mechanik der Universität Stuttgart. Shaker Verlag, Aachen(2018). Shaker Verlag

Johannes Störkle, 2020-03-183

Page 4: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

If R y<rx

1+κIf R y r x≥0

zcorr=z+2( rx

1+κ−R) (6)

If R y r x<0

zcorr=z+2( rx

1+κ−R)−2R (7)

Johannes Störkle, 2020-03-184

Page 5: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Range of x & y for Solutions at Real NumbersIn order to avoid complex results for z, the range of the x- and y-coordinates can be limited. Therefore, the terms under the square roots of to equation (2) are considered. For the term within the inner square root it results

r x2−(1+κ ) y2≥0

r x2

(1+κ )≥ y2

−|r x|√1+κ

≤ y ≤|r x|

√1+κ(8)

If R y ≠0, the outer square root results with real values for

(R y+11+κ (√r x

2−(1+κ ) y2−r x))2

≥ x2

|R y+11+κ (√r x

2−(1+κ ) y2−r x)|≥|x|A more conservative estimation leads to

||R y|+11+κ (√r x

2−(1+κ ) y2−|rx|)|≥|x|.

Johannes Störkle, 2020-03-185

Page 6: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Normal Vector of Toroidal SurfaceThe surface description given by equation (2) can also be interpreted as a zero-isoplane at the potential V (x , y , z) , which is also called implicit surface representation

V ( x , y , z )=R y−sign (r x )√(Ry+11+κ (√r x

2−(1+κ ) y2−rx ))2

−x2−z=0

if |R y|≥| rx

1+κ|∧r x≥0 ,∨|R y|≤| rx

1+κ|∧r x≤0 .(9)

Thereby, the gradient is equal to the direction ni of the unit vector, which is orthogonalto the surface.

n=grad (V ( x , y , z ) )=[ ∂V∂x ∂V∂ y

∂V∂ z ]

T

At first, the partial derivative in the x-direction leads to

∂V∂x

=−12

sign ( rx )((R y+11+κ (√r x

2−(1+κ ) y2−r x))2

−x2)−12 (−2 x )

¿ sign (r x ) x

√(R y+11+κ (√rx

2−(1+κ ) y2−r x))2

−x2=z x .

Second, the partial derivative in the y-direction leads to

∂V∂ y

=−12

sign ( rx )((R y+11+κ (√r x

2−(1+κ ) y2−r x))2

−x2⏟

u ( x, y ))−12 ∂u1 ( x , y )

∂ y,

where ∂u1 ( x , y )

∂ y=2(Ry+

11+κ (r x

2−(1+κ ) y2 )12−

rx

1+κ ) ∂u2 ( x , y )∂ y

and where∂u2 ( x , y )

∂ y =1

2(1+κ )(r x2−(1+κ ) y2)

−12 (−2(1+κ ) y )

As a consequence, it follows

∂V∂ y

=−12

sign ( rx )((R y+11+κ (√r x

2−(1+κ ) y2−r x))2

−x2⏟

u ( x, y ))−12 …

2(R y+11+κ (rx

2−(1+κ ) y2 )12−

r x

1+κ ) 12(1+κ )

(r x2−(1+κ ) y2 )

−12 (−2(1+κ) y )

¿ sign (r x )y (Ry+

11+κ (√r x

2−(1+κ ) y2−rx ))√r x

2−(1+κ ) y2√(Ry+11+κ (√r x

2−(1+κ ) y2−rx ))2

−x2=z y

Third, the partial derivative in the y-direction results with∂V∂ z

=−1

Johannes Störkle, 2020-03-186

Page 7: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

In contrast, the partial derivatives for the cases

if |R y|<| r x

1+κ|∧rx>0 ,∨|R y|>| rx

1+κ|∧r x<0

results with∂V∂x

=sign (rx ) x

√(Ry+11+κ (−√r x

2−(1+κ ) y2−rx ))2

−x2=z x .

∂V∂ y

=sign (rx )y (R y+

11+κ (−√r x

2−(1+κ ) y2−r x ))−√rx

2−(1+κ ) y2√(R y+11+κ (−√r x

2−(1+κ ) y2−r x ))2

−x2=z y

Finally, the normal unit vector results with

~n= 1

√1+z x2+z y

2 [−zx

−z y

1 ] .

Johannes Störkle, 2020-03-187

Page 8: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Intersection of a Ray and a TorusThe intersection of a ray with a surface can be defined by the line

r i=r i−1+ai d i−1=[r i−1 , x

ri−1 , y

ri−1 ,z]+ai[d i−1 , x

d i−1 , y

d i−1 , z] , (

10)

which starts at the former intersection point (or starting point) ri−1,by the ray direction d i−1and the by distance a i between the intersection points. During the ray tracing, this unknown distance a i must be computed.The toroidal surface according to equation (2) can be rearranged to

( z−R y )2=(R y+11+κ (√rx

2− (1+κ ) y2−r x ))2

−x2

and the line equation (10) can be insert, which leads to

(ri−1 , z+a id i−1 , z−R y )2=(R y+11+κ (√r x

2−(1+κ )(r i−1 , y+ai d i−1 , y )2−r x))

2

−(ri−1, x+ai d i−1 , x)2

(r i−1 , z−R y+ai d i−1 , z )2=(R y+

11+κ (√r x

2−(1+κ ) (r i−1 , y+aid i−1 , y )2−r x ))2

−…

(r i−1 , x2 +2air i−1 , x d i−1, x+a i

2d i−1 , x2 )

( (r i−1 , z−R y)2+2a i (ri−1 , z−R y )d i−1, z+ai

2di−1 , z2 )=R y

2+2 R y11+κ (√r x

2−(1+κ ) (ri−1 , y+ai d i−1, y )2−r x )+ 1(1+κ )2

(√r x2−(1+κ ) (ri−1 , y+a id i−1 , y)

2−r x)2−(r i−1 , x

2 +2ai ri−1 , xd i−1 , x+ai2d i−1, x

2 )

( (r i−1 , z−R y)2+2a i (ri−1 , z−R y )d i−1, z+ai

2di−1 , z2 )+(r i−1 , x

2 +2ai r i−1 ,x d i−1 , x+a i2d i−1 , x

2 )=R y2−2 R y

11+κ

r x+2R y11+κ √rx

2−(1+κ ) (r i−1 , y+aid i−1 , y)2+ 1

(1+κ )2(rx2− (1+κ ) (ri−1 , y+aidi−1 , y )2−2 rx √rx

2− (1+κ ) (ri−1 , y+aidi−1 , y )2+rx2 )

(r i−1 ,z2 −2 r i−1 ,z R y+R y

2+2a i (r i−1 , z−R y )d i−1 ,z+ai2d i−1, z

2 )+(ri−1 , x2 +2ai ri−1, x d i−1 ,x+a i

2d i−1 , x2 )−R y

2+2R y11+κ

rx−1

(1+κ )2(r x2−(1+κ ) (r i−1 , y+a id i−1 , y)

2+rx2 )=2 1

1+κ (R y−rx

1+κ )√r x2−(1+κ ) (ri−1 , y+aid i−1 , y )2

a i2d i−1 , x

2 +ai2d i−1 , z

2 +2ai ri−1 , xd i−1 , x+2ai ( r i−1, z−R y )d i−1 , z+r i−1 , x2 +ri−1 , z

2 −2r i−1 , z Ry+Ry2−R y

2+2R y11+κ

r x−1

(1+κ )2(2r x

2−(1+κ ) (ri−1 , y2 +2ai ri−1 , yd i−1 , y+a i

2d i−1 , y2 ) )=2 1

1+κ (R y−rx

1+κ )√r x2−(1+κ ) (r i−1 , y+2ai r i−1 , y d i−1 , y+a i

2d i−1 , y2 )

a i2d i−1 , x

2 +ai2d i−1 , z

2 +2ai ri−1 , xd i−1 , x+2ai ( r i−1, z−R y )d i−1 , z+r i−1 , x2 +ri−1 , z

2 −2r i−1 , z Ry+2R y11+κ

r x−2 rx

2

(1+κ )2+ri−1 , y2

(1+κ )+2ai

ri−1 , y d i−1 , y

(1+κ )+ai

2 d i−1 , y2

(1+κ )=2 11+κ (R y−

rx

1+κ )√rx2−(1+κ ) (r i−1 , y+2a iri−1 , yd i−1 , y+ai

2d i−1 , y2 )

a i2d i−1 , x

2 +ai2 di−1 , y

2

(1+κ )+ai

2di−1 , z2 +2ai r i−1 , xd i−1 , x+2a i

ri−1 , y d i−1 , y

(1+κ )+2a i (r i−1 , z−R y )d i−1 ,z+r i−1 ,x

2 +r i−1 , y2

(1+κ )+ri−1 , z

2 −2r i−1 , z Ry+2R y11+κ

r x−2r x

2

(1+κ )2=2 11+κ (R y−

rx

1+κ )√rx2−(1+κ ) (r i−1 , y+2a iri−1 , yd i−1 , y+ai

2d i−1 , y2 )

a i2 (1+κ )2 (d i−1 , x

2 +d i−1, y2

(1+κ )+d i−1 ,z

2 )+a i (1+κ )(ri−1 , x d i−1 , x+ri−1, y d i−1 , y

(1+κ )+( r i−1 , z−R y )d i−1 , z)+ (1+κ )

2 (r i−1, x2 +

r i−1 , y2

(1+κ )+r i−1 , z

2 )−(1+κ )(ri−1 , z R y+R yr x

1+κ−

rx2

(1+κ )2 )=(R y−r x

1+κ )√r x2−(1+κ ) (ri−1 , y+2ai r i−1 , y d i−1 , y+ai

2d i−1 , y2 )

with ξ=(Ry−r x

1+κ )−1

it follows

a i2 (1+κ )ξ

2 (d i−1 , x2 +

d i−1 , y2

(1+κ )+d i−1 , z

2 )+ai (1+κ )ξ (ri−1 , x d i−1 , x+ri−1 , y d i−1 , y

(1+κ )+( ri−1, z−Ry )d i−1 , z)+ (1+κ ) ξ

2 (r i−1 , x2 +

ri−1, y2

(1+κ )+ri−1 ,z

2 )−(1+κ )ξ (r i−1 , z Ry+Ryr x

1+κ−

r x2

(1+κ )2 )=√r x2−(1+κ ) (r i−1, y+2air i−1 , y di−1 , y+ai

2d i−1, y2 )

Johannes Störkle, 2020-03-188

Page 9: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

[ai2 (1+κ ) ξ

2 (di−1 , x2 +

d i−1 , y2

(1+κ )+d i−1 , z

2 )+ai (1+κ ) ξ (ri−1 , xd i−1 , x+r i−1 , yd i−1 , y

(1+κ )+(ri−1 , z−R y )d i−1 , z)+ (1+κ ) ξ

2 (r i−1 , x2 +

r i−1 , y2

(1+κ )+ri−1 , z

2 )−(1+κ ) ξ (r i−1 , zR y+R yrx

1+κ−

rx2

(1+κ )2 )]2

=rx2−(1+κ ) (r i−1 , y+2air i−1 , y di−1 , y+ai

2d i−1 , y2 )

This leads to a cubic equation, where the solution can be computed by appropriate algorithms, see also the Attachement. However, it is probably simpler to compute the Ray-ConicTorus intersetions with an iterative zero searching algorithm, e.g. the Newton-Raphson Approach.

Johannes Störkle, 2020-03-189

Page 10: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Special Case: Cylinder LensThe toroidal surface according to equations (2) and (3) can also be used to describe a cylinder surface with the long axis in the direction of x. Therefore, the radius of rotation must tend to infinity, R y →∞,. As an alternative, once can set

x=0∧R y=0 ,which leads to

z=−sign ( rx ) 11+κ (√r x2−(1+κ ) y2−sign ( rx ) rx ) .

For the normal unity vector, it yields∂V∂x

=0=z x ,

∂V∂ y

=sign (rx ) y

√r x2−(1+κ ) y2

=z y .

Cylinder-Line Intersection

z=−sign ( rx ) 11+κ (√r x2−(1+κ ) y2−sign ( rx ) rx )

−sign (r x ) (1+κ ) z=√r x2−(1+κ ) y2−sign ( rx ) r x

For r x>0 and if the y-values are within the range of equation (8), it results

−(1+κ ) z=√rx2−(1+κ ) y2−r x

¿

r x2−2 (1+κ ) z rx+(1+κ )2 z2=r x

2−(1+κ ) y2

(1+κ )2 z2+(1+κ ) y2−2 (1+κ ) zr x=0

(1+κ )2 ( ri−1, z+aid i−1 , z )2+(1+κ ) (ri−1 , y+aid i−1 , y )2−2 (1+κ ) (ri−1 , z+a id i−1 , z ) r x=0

(1+κ )2 (ri−1 , z2 +2air i−1 , zd i−1 , z+ai

2d i−1 , z2 )+(1+κ ) (ri−1 , y

2 +2ai ri−1 , y d i−1 , y+ai2d i−1 , y

2 )−2 (1+κ ) (ri−1 , z+a id i−1 , z ) r x=0

(1+κ ) (ri−1 , z2 +2ai r i−1, z d i−1 , z+ai

2d i−1 , z2 )+(r i−1 , y

2 +2ai r i−1, y d i−1 , y+ai2d i−1 , y

2 )−2 ( r i−1, z+aid i−1 , z ) r x=0

a i2 ( (1+κ )d i−1 , z

2 +d i−1 , y2 )+2ai ( (1+κ ) r i−1 ,zd i−1 , z+r i−1 , yd i−1 , y−rx d i−1 , z )+(1+κ )r i−1 , z

2 +r i−1 , y2 −2 rx r i−1 , z=0

⇒ The solution of this quadratic equation H ai

2+2F ai−G=0where

H= (1+κ )d i−1 , z2 +d i−1 , y

2

F=(1+κ ) ri−1, zd i−1 , z+ri−1 , y d i−1 , y−rx d i−1, z

G=− (1+κ ) r i−1 , z2 −r i−1 , y

2 +2r x ri−1, z

is known as

⇒ ai ,1,2=−FH

±√ F2

H2−GH

=(±√ F2

H 2−GH

− FH )(±√ F2

H 2−GH

+ FH )

(±√ F2

H2−GH

+ FH )

= GF ±√F2+HG

.

Johannes Störkle, 2020-03-1810

Page 11: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

In detail it yields

⇒ ai=G

F−√F2+HG, for r x>0

⇒ ai=G

F+√F2+HG, for rx<0

Johannes Störkle, 2020-03-1811

Page 12: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Parametrical Toroidal Surface DescriptionA torus can be defined parametrically by

[ xyz ]=[ (Ry−r x+r xcosθ )cos ϕr xsin θ

(Ry−rx+r xcosθ ) sinϕ ]In case of κ≠0 it is proposed to use the implicit description for the z-term.

[ xyz ]=[ (R y−r x+r xcosθ )cos ϕ1

√1+κr xsin θ

zcorr]

Practical Example with MATLAB

A related MATLAB implementation can be found here:https://de.mathworks.com/matlabcentral/answers/95230-how-do-i-plot-a-toroid-in-matlab

Johannes Störkle, 2020-03-1812

Page 13: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

AttachementThe following screenshots help to understand the tori equations, which are from [Reithmann2009]4.

Page 12

4 [Reithmann2009] Reithmann, T.: Topologically correct Intersection Curves of Tori and Natural Quadrics, Dissertation der Johannes Gutenberg-Universität, FB 08: Physik, Mathematik und Informatik, 2009. (See also https://d-nb.info/995451133/34)

Johannes Störkle, 2020-03-1813

Page 14: Technical Notes for the Raytracing of Toroidal Surfaces ... · Web viewIn order to derive the three-dimensional formulation with a conic constant, one can first regard the curve within

Page 69

Johannes Störkle, 2020-03-1814