-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector cleanups #2895
Vector cleanups #2895
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, was gonna say maybe lerp(nvv) to match gmod's function but looks like unity, godot and unreal do lerp(from, to, frac) so better to imitate that.
e2function vector min(vector vec1, vector vec2) | ||
return vec1:LengthSqr() < vec2:LengthSqr() and vec1 or vec2 | ||
end | ||
|
||
e2function vector max(vector rv1, vector rv2) | ||
local length1 = ( rv1[1] * rv1[1] + rv1[2] * rv1[2] + rv1[3] * rv1[3] ) ^ 0.5 | ||
local length2 = ( rv2[1] * rv2[1] + rv2[2] * rv2[2] + rv2[3] * rv2[3] ) ^ 0.5 | ||
if length1 > length2 then return rv1 else return rv2 end | ||
e2function vector max(vector vec1, vector vec2) | ||
return vec1:LengthSqr() > vec2:LengthSqr() and vec1 or vec2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are really stupid. Why don't they max/min the components? Is there a different function that does that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, maxVec
declared right below this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you even need that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could see uses for both.
This comment was marked as resolved.
This comment was marked as resolved.
Quit bitching, your server is 3 months outdated. (I do appreciate you at least doing this on github, though) |
lerp(vector, vector, number)
min
andmax
to use square magnitude insteadvector:toAngle
randVec
to useVector.Random
mix
to be more descriptivemix
to useLerpVector
ANGLE_ZERO
constant to use preexistingangle_zero
constantFixes #2893