Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Ovelapping area of sphere

Author
Message
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Sep 2011 00:59
I'm not very good at maths. Two sphere overlap at their edges. What is a fast way to get the area? I want to turn the two sphere into 3 sphere. The two that overlap are reduced by the overlap area, and a new sphere is placed in the middle that is the size of the overlap area.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Sep 2011 01:45
Do you mean spheres (3D) or circles (2D)?
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Sep 2011 02:26
The overlap area is not a sphere or circle. You can work out it's area by dividing it in half down the middle. The area of each half you are left with is the result of subtracting the area of a triangle from the area of a sector of a circle (0.5*theta*radius^2 where theta is the angle of the sector)

[b]
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Sep 2011 03:54
Can't it be made into a sphere by squashing it down? I imagine that you get a sort of pointed oval that you can squash into a sphere. And how do I get the middle? Say I had two 3D model sphere moving around, and you never know how much of them is going to overlap. Can I get the overlap middle, and then turn it into a new sphere?

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Sep 2011 09:08 Edited at: 19th Sep 2011 09:19
@Pincho Paxton

It's actually not as complicated as it might seem. If you are interested in just a sphere resulting from the overlapping of 2 other spheres (not that weird elliptical thing that needs squashing), it can be found by just testing the distance between the centers of the spheres and subtracting that from the sum of the spheres radii. This gives you the diameter of the desired sphere.

I knocked together a quick example in DBC (sorry I have no computer at my disposal that'll run DBP) but it should be transferable. It's fairly well documented. Use the arrow keys to move around the smaller sphere. When the 2 spheres intersect, a 3rd sphere colored red is formed that represents the intersection area:



Enjoy your day.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Sep 2011 14:30
Sounds like you are all talking about 2D circles or disks not 3D spheres.

Can we have some clarity here?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Sep 2011 17:39 Edited at: 19th Sep 2011 17:51
Sphere overlapping in 3d space.

Quote: "@Pincho Paxton

It's actually not as complicated as it might seem. If you are interested in just a sphere resulting from the overlapping of 2 other spheres (not that weird elliptical thing that needs squashing), it can be found by just testing the distance between the centers of the spheres and subtracting that from the sum of the spheres radii. This gives you the diameter of the desired sphere.

I knocked together a quick example in DBC (sorry I have no computer at my disposal that'll run DBP) but it should be transferable. It's fairly well documented. Use the arrow keys to move around the smaller sphere. When the 2 spheres intersect, a 3rd sphere colored red is formed that represents the intersection area:"


Ok thanks! I'll try it out.

EDIT: Sorry but the middle sphere doesn't look big enough to be using all of the area of the elliptical (lens?) shape. If the elliptical shape were squashed down the diameter would widen... I think. Something like lens height + lens depth /2. But I don't know for sure.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Sep 2011 18:18 Edited at: 19th Sep 2011 18:29
What you want is the volume of two spherical caps combined. That page has the formula for the volume, all you need to do is add the volumes of the two caps giving you the volume of the lens shape. You can then work backwards to work out the radius of the sphere with that volume.

edit:
For different sized spheres with radius 'R' and 'r', a distance of 'd' apart, the equation is:


For spheres of the same size the equation for the volume is:


The new radius is given by (3V/(4*pi))^(1/3) where V is the volume.

[b]
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Sep 2011 18:40
Quote: "What you want is the volume of two spherical caps combined. That page has the formula for the volume, all you need to do is add the volumes of the two caps giving you the volume of the lens shape. You can then work backwards to work out the radius of the sphere with that volume.

edit:
For different sized spheres with radius 'R' and 'r', a distance of 'd' apart, the equation is:
+ Code Snippet

For spheres of the same size the equation for the volume is:
+ Code Snippet

The new radius is given by (3V/(4*pi))^(1/3) where V is the volume."


That's ace thanks! And that formula doesn't break down at all? It might sound odd, but I am trying to figure out how something as complex as that could happen naturally.

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Sep 2011 22:22
Quote: "EDIT: Sorry but the middle sphere doesn't look big enough to be using all of the area of the elliptical (lens?) shape. If the elliptical shape were squashed down the diameter would widen... I think. Something like lens height + lens depth /2. But I don't know for sure."


Oh ok, I thought you just wanted a sphere ( not a lens shape) that would fit within the captured area. Glad you've received a solution!

Enjoy your day.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 19th Sep 2011 23:00 Edited at: 19th Sep 2011 23:03
Quote: "Oh ok, I thought you just wanted a sphere ( not a lens shape) that would fit within the captured area. Glad you've received a solution! "


It's Ok, it was hard to describe.

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Sep 2011 12:08 Edited at: 20th Sep 2011 12:15
Quote: "For different sized spheres with radius 'R' and 'r', a distance of 'd' apart, the equation is:
+ Code Snippet

For spheres of the same size the equation for the volume is:
+ Code Snippet

The new radius is given by (3V/(4*pi))^(1/3) where V is the volume."


I'm trying to put the new maths in the other code to make the new sphere, but I have no idea how to do it...



Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Sep 2011 17:46
Errr.. I'm still stuck..

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 21st Sep 2011 20:45
When letters are next to each other it means multiply...



Translates to:



[b]
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Sep 2011 20:56 Edited at: 21st Sep 2011 20:57
Oh d*r.. that's what I didn't understand. Thanks!

I just saw dr...it was like a drill going off in my head. I don't like maths.

Login to post a reply

Server time is: 2026-07-10 13:45:30
Your offset time is: 2026-07-10 13:45:30