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

System.Numerics conversions #1161

Merged
merged 4 commits into from
Oct 9, 2021
Merged

Conversation

ykafia
Copy link
Contributor

@ykafia ykafia commented Oct 4, 2021

PR Details

Adds implicit conversions between System.Numerics and Stride.Maths vectors
Some casts use Unsafe.As for better performance, haven't done any tests though.

Motivation and Context

A lot nugets use System.Numerics, it would be nice to be able to cast implicitely between Sys Nums and Stride Maths

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ykafia ykafia marked this pull request as draft October 4, 2021 09:34
@Eideren
Copy link
Collaborator

Eideren commented Oct 4, 2021

Thanks, not sure if you're done but you might want to cover matrix as well. Will have to verify whether they are row major or column major though.

@ykafia
Copy link
Contributor Author

ykafia commented Oct 4, 2021

Of course, there are other conversions i will add too that can be useful

@manio143
Copy link
Member

manio143 commented Oct 4, 2021

Can you also do the conversions the other way from Stride vectors into System.Numerics?

@ykafia
Copy link
Contributor Author

ykafia commented Oct 4, 2021

Didn't think of it but will do, shouldn't be much of a trouble!

@ykafia ykafia marked this pull request as ready for review October 4, 2021 12:50
@Eideren
Copy link
Collaborator

Eideren commented Oct 4, 2021

Are you sure that stride and dotnet's matrix have the same memory layout ? (more info #291)

@ykafia
Copy link
Contributor Author

ykafia commented Oct 4, 2021

OOH, i shouldn't have assumed it, will correct this !
It's a bummer but i guess we don't have the need for big perfs right there. (What's weirder is the System.Numerics ctor is in the same order as Stride's matrix).

@Eideren Eideren merged commit 0fd8f8d into stride3d:master Oct 9, 2021
@Eideren
Copy link
Collaborator

Eideren commented Oct 9, 2021

Thanks !

Eideren added a commit that referenced this pull request Oct 18, 2021
Eideren added a commit that referenced this pull request Oct 18, 2021
building for UWP, iOS and Android is broken, will merge back once a proper fix has been found
@Eideren
Copy link
Collaborator

Eideren commented Oct 18, 2021

As we've discussed on Discord, this PR breaks UWP, iOS and Android build. Someone will have to take a look at this and provide a fix before we can merge this back in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants