used mathx for clamp01 in intersect

fixes #45
This commit is contained in:
Max Cahill 2021-11-23 10:25:09 +11:00
parent 7767802433
commit 5df717fe6d

View File

@ -90,7 +90,7 @@ function intersect.nearest_point_on_line(a_start, a_end, b_pos, into)
--solve for factor along segment --solve for factor along segment
local point_to_start = b_pos:pooled_copy() local point_to_start = b_pos:pooled_copy()
:vector_sub_inplace(a_start) :vector_sub_inplace(a_start)
local factor = math.clamp01(point_to_start:dot(segment) / lensq) local factor = mathx.clamp01(point_to_start:dot(segment) / lensq)
point_to_start:release() point_to_start:release()
into:set(segment) into:set(segment)
:scalar_mul_inplace(factor) :scalar_mul_inplace(factor)