Skip to main content
gamedev.net
🔒 Locked

Basic Geometry Help

Started by NuclearCarnage May 21, 2009 at 1:55 PM 6 replies 1.5k views
Original Post
NuclearCarnage
NuclearCarnage
Ok, just need a bit of help with some 3D geometry. Imagine a sector of a circle with an inner angle of 45 degrees. Now imagine that but 3D. So it's like a cone with a curved base. Anyone know how I could calculate the volume of that?
____________________________Portfolio (under construction) Nastycritter
My tutorial site: Noobic
(my video site is coming soon)
alvaro
alvaro
This is a solid of revolution, since you can obtain it by rotating the graph of f around the x axis:

f(x) = tan(pi/8)*x if 0 <= x < cos(pi/8)
f(x) = sqrt(1-x^2) if cos(pi/8) <= x <= 1

Now the volume is pi * integral(f(x)^2), as described in that Wikipedia page.

alvaro
alvaro
Alternatively, you can use the formulas given here to get the following expression for the volume of your spherical cone:
2/3*pi*(1-cos(pi/8))

Both methods give the same answer, which is about .1594263343 . Well, if the radius of your sphere is not 1, you'll have to multiply by the cube of the radius.

NuclearCarnage
NuclearCarnage
so if i have a "spherical cone" with angle as 45 degrees i get that answer? that doesn't seem to be right... if you divide a circle volume by that number you get 24 and a bit. there can't be 24 of those in a sphere with same diameter... this has been bugging me for like 2 hours now, i can't seem to get any reasonable numbers...
____________________________Portfolio (under construction) Nastycritter
My tutorial site: Noobic
(my video site is coming soon)
alvaro
alvaro
I actually get more than 26. What seems so wrong about it?

As further verification that the computation is correct, you can estimate the volume of the cone by doing Monte Carlo integration: Throw a million random points in the box [-1,1]x[-1,1]x[-1,1] and pick the ones that are inside the unit sphere, and among those the ones that form an angle with (1,0,0) that is smaller than 22.5 degrees. You get estimates of the volume of the sphere and of the volume of your shape:
$ perl -e '$pi=atan2(1,1)*4;$N=1000000; for $i (1..$N) {$x=-1+2*rand(); $y=-1+2*rand(); $z=-1+2*rand(); if ($x*$x+$y*$y+$z*$z <= 1) {++$in_sphere; if ($x/sqrt($x*$x+$y*$y+$z*$z)>cos($pi/8)) {++$in_cone;}}}END{print "Monte Carlo: ".(8*$in_sphere/$N)." ".(8*$in_cone/$N)."\nAnalitically: ".(4/3*$pi)." ".(2/3*$pi*(1-cos($pi/8)))."\n";}'Monte Carlo: 4.196456 0.158816Analitically: 4.18879020478639 0.159426334300242


NuclearCarnage
NuclearCarnage
You know what... i just realized something, mainly due to this being my fathers problem he asked for help with rather than my own. The angle of the cone we actually want to use is 90 degrees. Therefore there shouldnt be more than 6 whole ones now, if you imagine it. My dad made a little model for me to show you haha.


Here it is, he wasnt able to put the tops of the cones but just imagine that they have tops at the same gradient as the sphere they are held in.

http://nastycritter.com/6cones.jpg

I hope you get what i mean now, i can draw a diagram if that would help?

I'm sorry to ask for so much but could you recalculate it again? because im only 17 and my advance maths skills aren't that great!


Thanks for all your help,


Joe
____________________________Portfolio (under construction) Nastycritter
My tutorial site: Noobic
(my video site is coming soon)
alvaro
alvaro
Quote:
Original post by NuclearCarnage
You know what... i just realized something, mainly due to this being my fathers problem he asked for help with rather than my own. The angle of the cone we actually want to use is 90 degrees. Therefore there shouldnt be more than 6 whole ones now, if you imagine it. My dad made a little model for me to show you haha.

Hmmm... If your cone has an angle of 90 degrees it's not nice to ask for something different...

The answer is 2/3*pi*(1-cos(pi/4)) = 2/3*pi*(1-sqrt(2)/2) = .61343412300707340995

You can fit about 6.82842712474619009773 of them in a sphere.

Nice model, by the way. :)

NuclearCarnage
NuclearCarnage
Yea my dad told me 45 degrees and when he showed me the model i was like... "thats not 45 degrees". sorry about that! but i really appreciate your help, i'm very glad theres people like you to help novices like me :D have a nice summer :)

Joe
____________________________Portfolio (under construction) Nastycritter
My tutorial site: Noobic
(my video site is coming soon)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.