-
Notifications
You must be signed in to change notification settings - Fork 26
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
scaleTo methods for Vector2d and Vector3d #137
scaleTo methods for Vector2d and Vector3d #137
Conversation
Looking good, thanks for adding docs/tests! A few requests:
|
Yeah, don't worry about that test failure, I think I just set it up in a way that you occasionally have really numerically bad situations (like an axis that's almost parallel to the plane) where it's impossible to get super high accuracy no matter what you do. I do have to fix that test to avoid those cases (while being careful not to filter out actual problems), but it's certainly not related to anything you're doing! |
By the way, any chance you could tweak the |
For the tests, it's certainly good to have some explicit tests for the zero vector case, but I think there still needs to be something in the general case to handle the situation where the fuzzer produces a zero vector (I may not have explained this well). For example, taking \vector ->
Vector3d.normalize vector
|> Vector3d.length
|> Expect.quantity (Quantity.float 1) will fail if \vector ->
if vector == Vector3d.zero then
Vector3d.normalize vector
|> Expect.equal Vector3d.zero
else
Vector3d.normalize vector
|> Vector3d.length
|> Expect.quantity (Quantity.float 1) |
Oh, and I appreciate the attempt to simplify/clean up the old implementation of |
I'm ashamed by the looks of that bad 3d vector example 😂 For the Vector2d I used Pythagorean triplets, so that I could have nice looking numbers... but I had no idea of an example like that on a 3d vector 😅 I'll put one of the components as zero for now Now I see the problems with the tests and the implementation I did 😄 Let me fix that :) |
I think this is looking great now! Was there anything else you were thinking of adding or are you OK to have this merged? |
I think this is it, at least for this one 😁 |
Pull request related to #134
Pull request checklist:
master
?elm-format
as the rest ofelm-geometry
?@ianmackenzie let me know what you think! :)