geometry – Intersection of a sphere and a triangle

Question:

I am now moving the sphere in space with collisions with other objects. There were problems with solving the problem about the intersection of a sphere and a triangle (of which I have polyhedra).

The coordinates of the center of the sphere and its radius are given, as well as three points of the triangle in space. You need to find out if the triangle intersects the sphere (with its side or area).

Even more formally: Given a point O (x0, y0, z0) – the center of the sphere. A real number r is given – the radius of the sphere. Three vertices of the triangle are given: A (x1, y1, z1), B (x2, y2, z2), C (x3, y3, z3). It is necessary to answer the question: does a triangle have at least one common point with a sphere?

Answer:

Recommended sequence of actions.

  1. Construct the plane of the triangle.
  2. Construct a projection onto this plane of the center of the sphere, and then the circle of intersection of the sphere and the plane.
  3. Solve the problem of the presence of a common point for a triangle and a circle on a plane.

To simplify the calculation, it is recommended to rotate about the center of the sphere so that the plane of the triangle is perpendicular to one of the coordinate lines.

Scroll to Top