A cone with radius 6 and height 8 is sitting on a table. A spotlight with a cylindrical beam of radius 3 is shining directly at the cone. The beam is parallel to the surface of the table and the bottom of the beam just touches the table. The cone just barely blocks the entire light beam.
What is the illuminated area?
To find uniformly distributed points on the cone, the "number" of points along any level should be linearly related to the vertical distance from the level of the vertex, and then, along a chosen level, any part of the circumference should be equally likely.
Randomly choose a distance from the apex. Since the height is 8, if a random number from 0 to 1 is greater than 1/8 the level (distance from the top level), discard that choice; use only those random numbers less than 1/8 distance from top level.
Once a good level is found, choose a random point on the semicircumference:
The radius, r, of the circle and its semicircle is 6/8 = 3/4 of the distance chosen.
The circumference of the circle is 2*pi*r, and of the semicircle is pi*r
The angle, measured from the back slant element of the cone along the semicircle, is rand*pi radians where rand is a random number from 0 to 1, as its length is rand*r*pi.
The y coordinate (if beam is parallel to the x-axis) is r times the cosine of that angle.
The z coordinate of the point is 8 minus the distance from apex level.
If the y and z coordinates are within 3 units of z=3, y=0, you have a hit, otherwise it's a miss. Take the fraction of hits over (hits plus misses) of the total lateral area of the semicone, and that is your area. The lateral area of the full cone is pi*R*(sqrt(H^2+R^2)), so of the semicone is half of that.
hit=0; miss=0;
for pt=1:100000000
distFromTopLevel=8*rand;
if rand<distFromTopLevel/8
r=3*distFromTopLevel/4;
arc=rand*pi;
y=r*cos(arc);
z=8-distFromTopLevel;
if y^2+(z-3)^2<9
hit=hit+1;
else
miss=miss+1;
end
end
end
semicone=pi*6*(sqrt(8^2+6^2))/2;
area=hit/(hit+miss) * semicone
finds
area =
42.1286398395843
added hundreds of millions:
>> partiallyIlluminatedCone
area =
42.1367449237548
>> partiallyIlluminatedCone
area =
42.1251096613302
>> partiallyIlluminatedCone
area =
42.1294865432032
>> partiallyIlluminatedCone
area =
42.1381739788689
>> partiallyIlluminatedCone
area =
42.1329895480189
Edited on November 14, 2021, 11:35 am
|
Posted by Charlie
on 2021-11-14 11:24:44 |