I am trying to develop algorithm to find out not only the fact of intersection but its section or maybe its area. I found at least 6 different cases which may occur and I suppose that there are many more. That is why I am looking for universal algorithm neither try to solve each case separately.
CodePudding user response:
Note that it is worth considering only the following points:
- Intersection of the box and triangle;
- The vertices of the triangle inside the box;
- The vertices of the box inside the triangle. (There are famous algorithms to find these points) These points are vertices of the polygon that is the desired Intersection section, but we need to sort these points in correct order. You can do this using Graham's algorithm for finding a convex hull. So, we have found a polygon that is box triangle intersection section. You also can find it's area using one of the famous algorithms.