The distance between to Spheres
I know this is a very beginner question, but this is the beginner forum so I''ll ask away:
How can I find the distance between two spheres?
V = C0 - C1
D = ||V|| = sqrt(V.x*V.x + V.y*V.y + V.z*V.z)
The final distance is D minus the sum of the radii.
[edited by - zealouselixir on February 25, 2003 9:04:53 PM]
D = ||V|| = sqrt(V.x*V.x + V.y*V.y + V.z*V.z)
The final distance is D minus the sum of the radii.
[edited by - zealouselixir on February 25, 2003 9:04:53 PM]
[twitter]warrenm[/twitter]
the distance between 2 points is
sqrt(((x1^2)-(x2^2))((y1^2)-(y2^2)((z^2)-(z^2)))
so to find the distance between the centerpoints of the sphere, just use that.
to find the distance between the surfaces, simply add the radius of each sphere to the total, like this:
sqrt(((x1^2)-(x2^2))((y1^2)-(y2^2)((z^2)-(z^2))) + Radius1 + Radius2
i think...
[edited by - MattS423 on February 25, 2003 9:08:07 PM]
sqrt(((x1^2)-(x2^2))((y1^2)-(y2^2)((z^2)-(z^2)))
so to find the distance between the centerpoints of the sphere, just use that.
to find the distance between the surfaces, simply add the radius of each sphere to the total, like this:
sqrt(((x1^2)-(x2^2))((y1^2)-(y2^2)((z^2)-(z^2))) + Radius1 + Radius2
i think...
[edited by - MattS423 on February 25, 2003 9:08:07 PM]
Programmers of the world, UNTIE!
Hey,
Well I would assume all you need to do, is get the center point for each sphere and from there it should be easy as all you need to do is a point to point distance and substract the radiuses if you want the distance from the shells. Though I assume you thought of that and don''t have access to the origin/center.
If you do not have that data though it uses quite a lot of mathematical steps. I have a book in front of me that tells you how to calculate Circle to Circle in 3D but yet it confuses me a lot and would take me a while to figure out and yet more to type in. But the book is great and is called 3D Game Engine Design. The book explains a lot of mathematical concepts and provides all the source code for all of what it says but yet I think I am not allowed to post it, so sorry if I can''t help you.
Well I would assume all you need to do, is get the center point for each sphere and from there it should be easy as all you need to do is a point to point distance and substract the radiuses if you want the distance from the shells. Though I assume you thought of that and don''t have access to the origin/center.
If you do not have that data though it uses quite a lot of mathematical steps. I have a book in front of me that tells you how to calculate Circle to Circle in 3D but yet it confuses me a lot and would take me a while to figure out and yet more to type in. But the book is great and is called 3D Game Engine Design. The book explains a lot of mathematical concepts and provides all the source code for all of what it says but yet I think I am not allowed to post it, so sorry if I can''t help you.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement