Fixed bug caused by a copy/paste error in Face3::get_closest_point_to

s * edge0 = -d / a * edge0 = -edge0⋅v0 / (edge0⋅edge0) * edge0 = vector projection of -v0 onto edge0

By incorrectly using -e/c instead of -d/a, Face3::get_closest_point_to was returning the wrong point in certain cases.  Specifically, I noticed it returning vertex[0] when it should have been returning vertex[1].
This commit is contained in:
stoofin 2019-11-19 22:30:28 -08:00 committed by GitHub
parent 1bd32388ae
commit 8abd64dcbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -393,7 +393,7 @@ Vector3 Face3::get_closest_point_to(const Vector3 &p_point) const {
s = CLAMP(numer / denom, 0.f, 1.f); s = CLAMP(numer / denom, 0.f, 1.f);
t = 1 - s; t = 1 - s;
} else { } else {
s = CLAMP(-e / c, 0.f, 1.f); s = CLAMP(-d / a, 0.f, 1.f);
t = 0.f; t = 0.f;
} }
} else { } else {