|Register to reply||
Surface point of collision of two spheres?
|Share this thread:|
Jan27-11, 07:21 PM
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;
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);
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?
(ps - yes I use Richard Potter's Vector3 class from CodeProject.com - thanks!!)
|Register to reply|
|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|