File:FocalLength.png
Summary
| Description | Demonstrating the concept of focal length for a convex, spherical lens: Light beams entering from the left gets refracted twice before focusing at approximately distance f to the right of the lens. |
| Date | 2 March 2006 (original upload date) |
| Source | No machine-readable source provided. Own work assumed (based on copyright claims).Category:Assumed own work |
| Author | No machine-readable author provided. Peo~commonswiki assumed (based on copyright claims). Category:Files with no machine-readable source |
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 2.5 Generic license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
POV-Ray code
This image was rendered using POV-Ray for Windows version 3.6 and the scene description code below. Note that the POV-Ray installation needs to have access to the font file "timesbi.ttf" for rendering the bold italic "f" in the image.
If rendered as shown, this code will produce the above image, but by replacing the #switch (1) in the 13th line by a #switch (2), you get the image ShortFocalLength.png.
/*
================================================
Demonstrating ocal length for a convex lens
------------------------------------------------
Created by Søren Peo Pedersen - see my user page
at http://da.wikipedia.org/wiki/Bruger:Peo
================================================
*/
#declare IndexOfRefraction=1.66; // Simulated index of refraction
#declare LineWidth=0.02; // Width of light beam lines
#switch (1) // edit to 1 for long, 2 for short focal length
#case (1)
#declare LR=10;
#declare VisF=1;
#break
#case (2)
#declare LR=4.4;
#declare VisF=0;
#break
#end
#declare FL=1/(IndexOfRefraction-1)/(2/LR);
#declare LS=sqrt(LR*LR-5.29)-.05;
#macro DashedLine(L) // White dashed line for annotations
union {
#local cnt=0;
#while (cnt<L)
box {<-.03,cnt/2,-.02>,<.03,cnt/2+.25,-.021>}
#local cnt=cnt+1;
#end
}
#end
#macro Beam(Shift) // Renders one of the nine beams
#local pX1=LS-sqrt(LR*LR-Shift*Shift);
#local VI1=asin(Shift/LR);
#local VO1=-asin(Shift/LR/IndexOfRefraction);
#local LLa=-tan(VI1+VO1);
#local LLb=(Shift-LLa*pX1);
#local ALa=1+LLa*LLa;
#local ALb=(2*LS+2*LLa*LLb);
#local ALc=LS*LS+LLb*LLb-LR*LR;
#local ALD=ALb*ALb-4*ALa*ALc;
#local pX2=(-ALb+sqrt(ALD))/(2*ALa);
#local pY2=sqrt(LR*LR-(pX2+LS)*(pX2+LS))*select(LLa,1,1,-1);
#local Vud=atan(pY2/(pX2+LS));
#local VI2=Vud+VO1+VI1;
#local VO2=-asin(sin(VI2)*IndexOfRefraction);
#local DIR=Vud+VO2;
#local pX3=pX2+50*cos(DIR);
#local pY3=pY2+50*sin(DIR);
sphere_sweep {
linear_spline,4,
<-50,Shift,0>,LineWidth
<pX1,Shift,0>,LineWidth
<pX2,pY2,0>,LineWidth
<pX3,pY3,0>,LineWidth
pigment {color rgb<1,.95,.8>}
finish {ambient 1 diffuse 0}
no_shadow no_reflection
translate <0,0,-LineWidth>
scale <1,1,.5>
}
#end
#if (VisF != 0) // Include annotation of "f" length in image?
union {
#object {DashedLine(11) translate <0,-2.8,0>}
#object {DashedLine( 7) translate <FL-pi/LR,-2.8,0>}
text {ttf "timesbi.ttf"
"f",.1,0
translate <(FL-pi/LR)/2-.3,-3,0>
}
triangle {<0,-2.7,0>,<.5,-2.5,0>,<.5,-2.9,0>}
box {<.5,-2.66,.001>,<(FL-pi/LR)/2-.3,-2.74,0>}
triangle {<FL-pi/LR,-2.7,0>,<FL-.5-pi/LR,-2.5,0>,<FL-.5-pi/LR,-2.9,0>}
box {<FL-.5-pi/LR,-2.66,.001>,<(FL-pi/LR)/2+.3,-2.74,0>}
pigment {color rgb 1} finish {ambient 1 diffuse 0}
}
#end
intersection { // The lens itself
sphere {<-LS,0,0>,LR}
sphere {< LS,0,0>,LR}
cylinder {<-8,0,0>,<8,0,0>,2.3}
plane {<0,0,-1>,0}
pigment {color rgbt <.8,1,.9,.7>}
finish {phong 1 reflection .1 ambient .5}
interior {ior IndexOfRefraction}
}
#object {Beam( 2.0)} // Beams: The number
#object {Beam( 1.5)} // in parenthesis are
#object {Beam( 1.0)} // the Y coordinates
#object {Beam( 0.5)} // for each beam of
#object {Beam( 0)} // light coming in
#object {Beam(-0.5)} // from the left
#object {Beam(-1.0)}
#object {Beam(-1.5)}
#object {Beam(-2.0)}
camera {
location <FL/2,0,-500>
look_at <FL/2,0,0>
angle 1
}
light_source {<100,100,-100> color rgb 1}