mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Fix squared distance for CPU impl. (#83)
Summary: `PointLineDistanceForward()` should return squared distance. However, it seems that it returned non-squared distance when `v0` was near by `v1` in CPU implementation. Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/83 Reviewed By: bottler Differential Revision: D20097181 Pulled By: nikhilaravi fbshipit-source-id: 7ea851c0837ab89364e42d283c999df21ff5ff02
This commit is contained in:
committed by
Facebook Github Bot
parent
a0f3dc2d63
commit
f358b9b14d
@@ -271,7 +271,7 @@ T PointLineDistanceForward(
|
||||
const vec2<T> v1v0 = v1 - v0;
|
||||
const T l2 = dot(v1v0, v1v0);
|
||||
if (l2 <= kEpsilon) {
|
||||
return sqrt(dot(p - v1, p - v1));
|
||||
return dot(p - v1, p - v1);
|
||||
}
|
||||
|
||||
const T t = dot(v1v0, p - v0) / l2;
|
||||
|
||||
Reference in New Issue
Block a user