Last active
October 26, 2020 16:13
-
-
Save wowjeeez/f5f02c0e904e9ae1ee9d2c29613a7f27 to your computer and use it in GitHub Desktop.
LUA snippet to calculate a point between 2 coords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPointOnLine(vec1, vec2, point) --the point on the line [point is always smaller then the distance between the 2 coords] (to get the coords on the center, just divide the distance with 2) | |
distance = #(vec1 - vec2) --distance | |
vec3 = vec1 + (point/distance) * (vec2 - vec1) | |
return vec3 | |
end | |
--p: one-dimensional numner |
Author
wowjeeez
commented
Oct 3, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment