|
|
Wasn't it Rob Brown-Bayliss who wrote:
>Hi,
>
>I am having trouble with mathss, now I know this isn't a maths group, so
>ill explain my problem and pray for forgivness..
>
>I have a cylinder object, its verticle like a tower, then rotated (tilted
>like the tower of pisa) 15 degrees.
>
>I want to place a series of windows around the tower, but so that they
>appear paralel to the ground plane. These windows are cutouts.
>
>The easy part is making each window vertical, by simply rotating it as I
>place them. But the hard part (for me) is working out the shape or size
>of the elipse that a level floor would be...
>
>Am I being clear? Even though it's a cylinder, because it's tilted the
>floor isnotacircle, so I need torotate the windows around an elipse...
>
>I can easily cut holes, but I want to place features on the cylinder
>surface.
>
>Were do I begin?
A fairly non-mathematical solution would be to use trace().
A more mathematical solution would be to consider that the semimajor
axis (A) of the ellipse you seek is R/Cos(Theta) where R is the radius
of the original cylinder and Theta is the tilt (15 degrees) expressed in
radians. The semiminor axis (B) of the ellipse is just R. The equation
of an ellipse with semiaxes A and B is x^2/A^2 + z^2/B^2 = 1 so if your
tilt is a z rotation:
x^2/(R/cos(radians(15))^2 + z^2/R^2 = 1
The centre of the ellipse depends on the height above or below the
centre of rotation. This can be incorporated by substituting
x => x-y/tan(Theta) in the above equation.
It might be easier to work with parametric equations:
x = R/cos(radians(15)) * cos(t) - y/tan(radians(15))
z = R * sin(t)
varying t from 0 to 2*pi.
For example:-
camera { location <0,2,-5> look_at <0,2,0>}
light_source { <2,5,-5> colour 1}
plane { y, 0 pigment { rgb 1}}
#declare R=1; // tower radius
#declare H=4; // tower height
#declare Tilt=15; // tower tilt (degrees)
cylinder {0,y*H 1 rotate z*Tilt pigment {rgb 1}}
#declare h=0;
#while (h<H)
#declare T=0;
#while (T<2*pi)
#declare X =R/cos(radians(Tilt)) * cos(T) - h*tan(radians(Tilt));
#declare Z =R*sin(T);
sphere {<X,h,Z>,0.05 pigment {rgb <1,1,0>}}
#declare T=T+0.4;
#end
#declare h=h+0.5;
#end
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
|