-
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 color & lighting, more solids, Angle utilities #166
Conversation
3D: spherical and cylindrical 2D: using the same type classes as cylindrical
This all looks good to me, except it looks like there are some warnings causing the build to fail. |
I'm working on the warnings now, fighting with GHC about overlapping instances. |
Ouchies, good luck. |
This definition works in all vector spaces, and is probably more often useful. The cylindrical r is easy to refer to as cylindrical._1; it just happens that it was the case that motivated me to write these lenses.
Builds now, except for 7.8.1. Note that the last patch is a change of meaning; the other two are just to fix warnings. |
@@ -121,3 +121,7 @@ class HasY t where | |||
-- | The class of types with at least three coordinates, the third called _z. | |||
class HasZ t where | |||
_z :: Lens' t Double | |||
|
|||
-- | _r is the vector magnitude |
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.
Can we make a better comment for this? The vector magnitude of what?
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.
You're right, that is a terrible comment. I will write something better in the morning.
Angle's aren't specific to R2, and this way 3D modules don't need to import from 2D.
and move 3D angleBetweenDir next to the definition of Direction type
@@ -0,0 +1,113 @@ | |||
{-# LANGUAGE GeneralizedNewtypeDeriving #-} |
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 like the idea of moving angle stuff into a separate module. This also paves the way for something else I'd like to think about, which is to generalize Direction
over the vector space and do a better job distinguishing angles and directions (in 2D we currently conflate the two notions). (But note I'm not saying we should worry about that for this PR, it's just something I thought I would mention.)
Does Diagrams.Angle
need to be added to the exported modules list in the .cabal
file?
Incidentally, I think I've made all the changes @byorgey suggested, so it might be good to go. Thanks for all the feedback! (And I think a polymorphic type for Direction would be nice.) |
Oh, one more thing, is |
It's reexported from Diagrams.TwoD, so indirectly from Diagrams.Prelude. (And also from Diagrams.ThreeD). I did that because the functions used to be in TwoD, but I see that's inconsistent with everything else. |
Oh, I see, I missed that it was exported from |
3d color & lighting, more solids, Angle utilities
Let me know if you'd rather I break this up into multiple PRs.
FillColor
with some proper 3D Attributes that allow more realistic imagesThe matching branch in
diagrams-povray
can render these Prims and Attributes, is in the images below:trace test for box (png)
trace test for cone (png)
source for trace tests
shading demo (png)
source for shading demo