Register to reply

Surface point of collision of two spheres?

by rachmann
Tags: collision, point, spheres, surface
Share this thread:
rachmann
#1
Jan27-11, 07:21 PM
P: 1
Hi!

I need to calculate the point (or average point) of actual collision between any two spheres of any size and mass in any orientation in space.

I understand that I can zero things out a bit by assuming that one sphere is centered at (0,0,0).


OK, I know how to calculate collision detection, I've seen many examples:

calculate distance from centres and subtract sum of radiuses (radii?? lol)

public static bool Collision(Sphere A, Sphere B)
{
bool results = false;
Vector3 centerA = new Vector3(A.x, A.y, A.z);
Vector3 centerB = new Vector3(B.x, B.y, B.z);

if (centerA.Distance(centerB) < (A.radius + B.radius))
{
results = true;
}
return results;
}



and I know how to caculate point on sphere:

public static Vector3 GetPointOnSphere(Vector3 sphereOrigin, double radius, double theta, double psi)
{
Vector3 results = new Vector3();

if ((psi >= 0 && psi <= (2 * Math.PI)) && (theta >= 0 && theta <= Math.PI))
{
// x = x0 + r * Sin theta * cos psi
// y = y0 + r * sin theta * sin psi
// z = z0 + r * cos theta
results.X = sphereOrigin.X + radius * Math.Sin(theta) * Math.Cos(psi);
results.Y = sphereOrigin.Y + radius * Math.Sin(theta) * Math.Sin(psi);
results.X = sphereOrigin.X + radius * Math.Cos(theta);
}
return results;
}

so, I guess I want to find psi and theta from the theoretical new line that stretches between the centres of both spheres. If sphere 2 is at 0,0,0, then what are the 2 angles that describes the direction to the centre of sphere 1?

Help!

(ps - yes I use Richard Potter's Vector3 class from CodeProject.com - thanks!!)
Phys.Org News Partner Physics news on Phys.org
Optimum inertial self-propulsion design for snowman-like nanorobot
The Quantum Cheshire Cat: Can neutrons be located at a different place than their own spin?
A transistor-like amplifier for single photons

Register to reply

Related Discussions
Points where normal at point on surface equals line from origin to that point Calculus & Beyond Homework 6
If all normals to a surface pass through a point => surface contained in a sphere Calculus & Beyond Homework 3
Collision of twos spheres Introductory Physics Homework 6
Surface charge distribution of two metal spheres Introductory Physics Homework 2
Elastic Collision in 2D between 2 Hard Spheres Advanced Physics Homework 0