Triangle to plane

There are two scenarios in which a triangle and plane intersect:

  • Not every point of the triangle is on the same side of the plane
  • Every point of the triangle is on the plane
    Triangle to plane

Getting ready

We are going to implement the TrianglePlane function to test for intersection between a triangle and a plane. This function will use our existing PlaneEquation function to classify which side of the plane the triangle is on.

How to do it…

Follow these steps to test if a triangle and a plane intersect:

  1. Declare the new TrianglePlane function in Geometry3D.h:
    bool TrianglePlane(const Triangle& t, const Plane& p);
  2. Declare a convenience macro in Geometry3D.h ...

Get Game Physics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.