Ray-Triangle Intersection algorithm: 。3 vertices of a triangle could form a plane. 。Calculate a ray-plane intersection. 。Check if the intersection is inside the triangle. (this project using barycentric coordinates) Sliders to rotate and green flag to start rendering. Space bar to reset.
Normal of a triangle ABC n = (C-A) X (B-A} / || (C-A} X (B-A) || Plane equation: P。n - A。n = 0 (。= dot product) Combine with the ray equation P = Pο + P1 (t) (Pο + P1(t))。n = A。n t = (A。n - Pο。n) / P1。n