sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.69k stars 638 forks source link

Some new math functions #923

Closed mrvux closed 6 years ago

mrvux commented 7 years ago

Hello, just a small pull request since I use those as extension methods almost everywhere, just thought this would benefit everyone:

Thanks Julien

bdachev commented 7 years ago

Out of curiosity why do you calculate Center that way but not (max+min)*0.5?

mrvux commented 7 years ago

@bdachev Good point indeed, updated it now.

manofstick commented 7 years ago

@mrvux / @bdachev

Not sure if it matters - but the previous way (i.e. min + (max-min)*.5) would have avoided overflow... But maybe that's just an academic point that would never occur in reality... Famous last words?

xoofx commented 6 years ago

Thanks, sorry for the delay (the (min+max)/2 blocked me, but after reading some paper, it is not a huge matter for floats...)