提交 6e1f4857 编写于 作者: M Matt Pharr

Make sure not to return an intersection for degenerate triangles.

(Also, fixes the unit tests.)
上级 76f421db
......@@ -247,6 +247,10 @@ pstd::optional<TriangleIntersection> Triangle::Intersect(const Ray &ray, Float t
const Point3f &p0,
const Point3f &p1,
const Point3f &p2) {
// Return no intersection if triangle is degenerate
if (LengthSquared(Cross(p2 - p0, p1 - p0)) == 0)
return {};
// Transform triangle vertices to ray coordinate space
// Translate vertices based on ray origin
Point3f p0t = p0 - Vector3f(ray.o);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册