Remove new VectorX usage in static (out VectorX) methods #2397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change all VectorX static methods with
out VectorX
parameters to directly assign the fields rather than constructing new VectorXs.Vector3.Reflect
had the wrong spacing, fixed.Vector4
must have had wrong line endings, sorry.Whitespace free diff (needed for
Vector4
)danzel@36b4c5e?w=1
When doing this I had to be careful not to always just assign to the output object. In cases where we use one of the values to calculate another (use X to calculate Y), we must not change X until all of the calculations are done as the objects may be referencing the same object.
A good example of this is
Vector2.Transform
:danzel@36b4c5e?w=1#diff-98c66ffb85bd2f51034c56bffda1119fL411
position and result could reference the same object, so we cannot assign result.X immediately or it would change the calculation of Y.
This is not normally necessary and leads to extra code, as such is only done when required.
Fixes #1611