Hi!(adsbygoogle = window.adsbygoogle || []).push({});

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!!)

**Physics Forums - The Fusion of Science and Community**

# Surface point of collision of two spheres?

Have something to add?

- Similar discussions for: Surface point of collision of two spheres?

Loading...

**Physics Forums - The Fusion of Science and Community**