【发布时间】:2021-09-20 16:12:34
【问题描述】:
我理解这里的数学:http://lousodrome.net/blog/light/2020/07/03/intersection-of-a-ray-and-a-plane/
这是我对他的方程式的实现:
Vector3 difference = plane_point - ray_origin;
double product_1 = difference.dot(plane_normal);
double product_2 = ray_direction.dot(plane_normal);
double distance_from_origin_to_plane = product_1 / product_2;
Vector3 intersection = ray_origin - ray_direction * distance_from_origin_to_plane;
但是,除非我将第一行更改为:
Vector3 difference = ray_origin - plane_point;
但我不知道为什么会这样。他的数学很合理。工作代码没有意义。
谁能解释这是怎么回事?
【问题讨论】:
-
可以在标签中添加语言吗?
-
不应该 ray_origin - plane_point;绝对功能?
-
intersection = ray_origin - ray_direction * distance_from_origin_to_plane;听起来不正确,假设变量名称都是正确的。 (应该是+) -
您确定代码中所有轴的符号都与示例中的相同吗?或者您的代码中的所有标志都在正确的位置?我感觉有什么不对劲