craftworkgames / MonoGame.Extended

Extensions to make MonoGame more awesome
http://www.monogameextended.net/
Other
1.44k stars 325 forks source link

Replace `Matrix2` with `Matrix3x2` #870

Closed AristurtleDev closed 6 months ago

AristurtleDev commented 6 months ago

Description

This pull request replaces the Matrix2 struct with a new Matrix3x2 struct. This is not the same as the System.Numerics.Matrix3x2.

Why not use System.Numerics

I would love to have this switched to using the System.Numerics.Matrix3x2 struct, however at this time it is currently to much work. MonoGame itself does not use the System.Numerics types currently, so implementing that here would mean that conversions would need to be made between Microsoft.Xna.Framework.Vector2 and System.Numerics.Vector2 all over the place. This would not only cause type ambiguity collisions within MonoGame.Extended, but also for consumers as well.

There is an open issue that can be tracked in the MonoGame repository for when MonoGame will switch to using System.Numerics https://github.com/MonoGame/MonoGame/issues/7204. When the base MonoGame performs that change, MonoGame.Extended will then be updated to reflect that.

Issues Resolved

This PR also resolves issue #587 by correctly accounting negative scale.

AristurtleDev commented 6 months ago

XML documentation needs to be added before PR is completed.