Distance structs TODO item#213
Conversation
…radius is added to only the x component.
|
Ran some tests, found a bug. It may have existed before: Test_DistPoint2Circle2 Expected: 5.0d +/- 9.9999999999999995E-07d But was: 7.0710678118654755d Off by: -2.0710678118654755d Gemini's explanation:
|
|
yes that's a bug, make you can make a separate PR for it as I can't accept this entire thing right now. This is a major breaking change in the library API, because something that used to be a by-reference type is changed to a by-value type. IMO doing it w/ structs is better, but a lot of code is written assuming they are classes, and changing to by-value potentially could introduce subtle bugs in library user code (eg if someone is passing the object to a function that initializes it, that wouldn't work w/ a struct unless it's the argument is changed to be passed as ref, etc). The TODO was basically a note to myself to spend some time thinking about this. IE do I want to say that the new 'dotnet8' version is not backwards-compatible w/ the old version, and fix mistakes like this, or be safe and do things like make the struct versions have new names and keep/deprecate the class versions, etc. Also there is a bunch of internal usage in the library of these types that needs to be investigated / cleaned-up. So, appreciate the effort but I don't have time to think about all this right now, sorry. I will keep the PR open in case I get motivated on some weekend. |
|
Understood! |
Had some spare time, tried to handle a simple TODO item.
Classes within /distance converted to struct, aside from static Distance. Considering adding an Obsolete attribute to it?
MeshQueries hit a snag: it returns null on lines 17, 65, and 123. Structs cannot be null and I think wrapping with nullable defeats purpose of switching to struct. For now, returning a new struct.
Taking a guess on what you'd prefer to in the future for MeshQueries: