From 98c5dd291386154433f4f773dcd8eefb7ed7bb56 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Tue, 20 Jun 2017 16:01:34 -0600 Subject: [PATCH] mathlib: refactor ProjectPointOntoPlane --- include/common/mathlib.hh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/common/mathlib.hh b/include/common/mathlib.hh index 913a4ba8..008f9368 100644 --- a/include/common/mathlib.hh +++ b/include/common/mathlib.hh @@ -214,17 +214,17 @@ GetDir(const vec3_t start, const vec3_t stop, vec3_t dir) } static inline vec_t -DistanceAbovePlane(const plane_t *plane, const vec3_t point) +DistanceAbovePlane(const vec3_t normal, const vec_t dist, const vec3_t point) { - return DotProduct(plane->normal, point) - plane->dist; + return DotProduct(normal, point) - dist; } static inline void -ProjectPointOntoPlane(const plane_t *plane, vec3_t point) +ProjectPointOntoPlane(const vec3_t normal, const vec_t dist, vec3_t point) { - vec_t dist = DistanceAbovePlane(plane, point); + vec_t distAbove = DistanceAbovePlane(normal, dist, point); vec3_t move; - VectorScale(plane->normal, -dist, move); + VectorScale(normal, -distAbove, move); VectorAdd(point, move, point); }