-
Notifications
You must be signed in to change notification settings - Fork 63
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
3D utility functions #107
3D utility functions #107
Conversation
Having tried to work with this a bit more today, I think I'll add a Direction class, like the Angle class. That will make type signatures more useful Otherwise I think we'll end up with lots of comments saying that this or that R3 will be normalized. So spherical & fromSpherical will go away. Do you want to hold off merging until I have an implementation? |
OK, sounds good. |
Also,
|
Yes, I certainly did forget to update the documentation. Thank you! |
…m R3 use Direction instead of R3 in rotationAbout
I added the new Direction type class, which is specific to 3D. Polar is the only instance for now. I also stuck angleRatio in this branch, even though that commit doesn't touch any 3D files. I think this is good to go now. |
-- | ||
-- The angle can be expressed using any type which is an | ||
-- instance of 'Angle'. For example, @aboutZ (1\/4 :: | ||
-- 'Turn')@, @aboutZ (tau\/4 :: 'Rad')@, and @rotate (90 :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be aboutZ
instead of rotate
[ci skip]
fromPolar (Polar θ φ) = Polar (convertAngle θ) (convertAngle φ) | ||
|
||
-- | A direction expressed as a pair of polar coordinates | ||
data Angle a => Polar a = Polar a a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semantics of Polar
are not clear to me. Is it supposed to represent spherical coordinate angles? In that case might Spherical
be a better name? Though I guess "spherical coordinates" usually refers to two angles paired with a distance rather than just the bare angles. Or is it supposed to be more general somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant spherical coordinates. Renaming it Spherical makes sense to me. I think the Direction instance makes it clear enough that it doesn't include the distance. I'll try to improve the docstring while I'm at it. I took out the old version because it said that the angles were normalized (to [0,2pi), [-pi/2,pi/2]) which isn't true.
Some basic conveniences for working in 3D.
I'd like feedback on: