-
Notifications
You must be signed in to change notification settings - Fork 14
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
Circle packing example #72
Conversation
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.
Thanks @FayCarsons! Looks fantastic. A minor comment below, otherwise good to go.
examples/circle_packing.ml
Outdated
(107, 108, 163); | ||
(135, 188, 189); | ||
(111, 153, 84); | ||
(150, 155, 199); | ||
(137, 171, 124); | ||
(67, 68, 117); | ||
(44, 45, 84); |
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.
If it isn't too much work, it would be nice to add the color as a comment, so it's easier to use for future examples.
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.
Like add a comment above each tuple w/ the name of the color?
I refactored this to remove the typing issues, and labeled the colors in the palette. I still think there's probably a better way to do this, currently it doesn't really use the library for anything except rendering, but I'm not super sure what the solution is. |
I thought it would be nice to have an example of more complex use of this library, so I threw together a quick circle packing example. It has a couple of issues I would love some input on fixing - namely typing, accessing the point and radius of a circle, and doing destructuring of circles in function args isn't possible without the type declaration in shape.mli which brings up other issues. But that's the temporary fix I went with.
The result:
I would have liked to fill each circle with concentric circles of changing colors using the repeat function or similar, but getting all the types to play nice was difficult and I feel like getting advice from someone more experienced with OCaml would be better than me wasting more time wrestling with type inference.