March 2017
Intermediate to advanced
480 pages
11h 3m
English
We already have a definition for Triangle in Geometry3D.h, we implemented this primitive in Chapter 7, 3D Primitive Shapes . The first operation we want to perform on a triangle is testing for point containment. The containment test works by moving the triangle into the point's local space, then constructing a pyramid out of the triangle and the point. If the pyramid is flat, the point is inside the triangle. If it's not, the point is outside.
We are about to implement a function that will test if a point falls inside of a triangle. This function will return a simple boolean result.
Follow these steps to implement a point in triangle test:
PointInTriangle function in Geometry3D.h:bool PointInTriangle(const ...
Read now
Unlock full access