|
|
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote in message
news:web.49960b7e1af53e3ce65c467e0@news.povray.org...
>I need to design an Iris diaphragm, preferably like the ones in the
>following
> pictures:
>
> http://www.microscopy-uk.org.uk/mag/imgmar06/dismantle6.jpg
> http://www.microscopy-uk.org.uk/mag/imgmar06/dismantle7.jpg
> http://www.microscopy-uk.org.uk/mag/imgmar06/dismantle8.jpg
> http://www.microscopy-uk.org.uk/mag/imgmar06/dismantle9.jpg
>
> or something similar. I need to be able to re-size it to fit my project,
> and I
> would like to be able to control the aperture size.
>
> I would like to be able to do all of these things, without using a
> mechanics
> simulator, which is difficult because the shutter blades are interleaved.
>
> Any suggestions would be greatly appreciated.
>
The following code should do it.
The ApertureAngle is the angle through which the elements of the Iris
Diaphragm are turned inwards.
The element is created as a spiral of small boxes with a circular end. You
can obviously make that piece as complicated as you like, with the lugs etc.
I've used random colors so you can clearly distinguish each piece.
Regards,
Chris B.
camera {location <0,5,-15> look_at 0}
light_source {<30,70,-10> color rgb 1}
#include "math.inc"
#declare ApertureAngle = 30;
#declare InnerRadius = 5;
#declare OuterRadius = 6.5;
#declare Thickness = 0.03;
#declare Increment = 0.2;
#declare Width = OuterRadius-InnerRadius;
#declare MySeed = seed(1);
// Define a single moving part
#declare MetalPiece = difference {
union {
#local I = 0;
#while (I<50)
box {<-Increment/2,0,0>,<Increment/2,Thickness,Width> rotate z*1
translate z*InnerRadius
rotate I*y*asind(Increment/OuterRadius)
translate y*sind(I*Increment)
}
#local I = I+1;
#end
rotate -y*180*Width/(2*pi*(InnerRadius+Width/2))
translate -z*(InnerRadius+Width/2)
}
difference {
box {<-Width,-0.1,-Width><0,2*Thickness,Width>}
cylinder {-0.2*y,(2*Thickness+0.1)*y,Width/2}
}
rotate y*ApertureAngle
translate z*(InnerRadius+Width/2)
}
// Draw 20 moving parts in a circle
#local I = 0;
#while (I<20)
object {MetalPiece rotate I*y*360/20 pigment {rgb
<rand(MySeed),rand(MySeed),rand(MySeed)>}}
#local I = I+1;
#end
Post a reply to this message
|
|
|
|
"Anthony D. Baye" <Sha### [at] spamnomorehotmailcom> wrote:
> Any suggestions would be greatly appreciated.
Of course I needn't emphasize that you should try to understand this rather than
just use it, but, based on some pre-existing code, here's an approximation of
the iris in the photo you provided. To prevent overlap, you just have to
rotate the blades a little in the right direction. Interestingly, if you put
this right in front of the camera and use focal blur, you can use this physical
aperture to give you the right bokeh pattern. Kinda neat, but it takes a lot of
samples. Anyway:
- Ricky
camera{
location <0,2,-2>
look_at <0,0,0>
sky z
}
light_source{
<25,8,-10>
rgb 2
area_light 10*x,10*y,10,10
circular
orient
jitter
adaptive 2
}
#declare eps = 1.0e-5;
#declare major_rad = 1.0; //outer radius of the blades
#declare minor_rad = 0.15; //width of the blades
#declare hole_rad = 0.02; //radius of the holes
#declare blade_thickness = 0.005;
#declare blade_angle_span = 135; //where does the blade end?
#declare blade_angle = 30; //rotate the blades!
#declare num_blades = 7;
#declare casing_rim_width = 0.02;
#declare casing_rim_height = 0.04;
#declare casing_width = 0.02;
// The angle to rotate a blade by (degrees) so that
// the blades layer rather than collide.
#declare blade_overlap_fudge_factor = 0.4;
#declare blade =
difference{
union{
cylinder{-y*(blade_thickness-eps), y*(blade_thickness-eps),
minor_rad}
difference{
cylinder{<0,-blade_thickness,-major_rad+minor_rad>,
<0, blade_thickness,-major_rad+minor_rad>,
major_rad
}
cylinder{<0,-blade_thickness-eps,-major_rad+minor_rad>,
<0, blade_thickness+eps,-major_rad+minor_rad>,
major_rad-minor_rad*2
}
plane{ vrotate(-z,blade_angle_span*y), -minor_rad }
plane{ -x, 0 }
}
}
cylinder{<0,-blade_thickness-2*eps,0>,
<0, blade_thickness+2*eps,0>,hole_rad}
rotate y*blade_angle_span/2
rotate z*blade_overlap_fudge_factor
rotate -y*blade_angle_span/2
translate y*0.01
}
#declare casing =
difference{
cylinder{<0,-casing_width,0>,
<0,casing_rim_height,0>,major_rad+casing_rim_width}
cylinder{<0,-casing_width-2*eps,0>,
<0,casing_rim_height+2*eps,0>,major_rad-2*minor_rad}
cylinder{<0,0,0>,<0,casing_rim_height+eps,0>,major_rad}
// punch a hole in the casing
#declare b=0;
#while(b<num_blades)
cylinder{<0,-casing_width-3*eps,0>,
<0,casing_rim_height+2*eps,0>,hole_rad
translate z*(major_rad-minor_rad)
rotate y*360*b/num_blades
}
#declare b=b+1;
#end
}
#declare iris =
union{
object{casing}
#declare b=0;
#while(b<num_blades)
object{blade
rotate -y*blade_angle
translate z*(major_rad-minor_rad)
rotate y*360*b/num_blades
}
#declare b=b+1;
#end
translate y*casing_width
pigment{rgb 1.0}
finish{
ambient 0
diffuse 0.05
reflection 0.2
specular 1.0
roughness 0.1
}
}
plane{y,0
pigment{rgb <0.9,0.75,0.6>}
finish{ambient 0 diffuse 1.0}
}
sky_sphere{
pigment{
gradient y
color_map{
[0 rgb 0]
[0.5 rgb 0]
[1 rgb 1]
}
scale 1.2
turbulence 0.5
}
}
object{iris}
Post a reply to this message
|
|