Skip to content
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

Remove new VectorX usage in static (out VectorX) methods #2397

Merged
merged 1 commit into from Apr 22, 2014

Conversation

danzel
Copy link
Contributor

@danzel danzel commented Apr 22, 2014

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

…ctly assign the fields rather than constructing new VectorXs.

Vector3.Reflect had the wrong spacing, fixed.
Vector4 must have had wrong line endings, sorry.

Fixes MonoGame#1611
tomspilman added a commit that referenced this pull request Apr 22, 2014
Remove new VectorX usage in static (out VectorX) methods
@tomspilman tomspilman merged commit 29a93ef into MonoGame:develop Apr 22, 2014
@tomspilman
Copy link
Member

Thanks!

@danzel danzel deleted the fix-1611-vectors branch May 19, 2014 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants