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
N-dimensional bounding-boxes #135
Comments
@ekmett Pinging Ed. |
Nomenclature wise, forOf, unsafePartsOf, universeOf ... it by convention takes a combinator that is usually written against a standard class like Foldable/Traversable and makes it parameterized in a lens/traversal of that same sort. I'm kinda neutral on including an AABB at all. It does make nice use of pointwise min/max. corner based versions are better for us than center + radius versions as they are slightly more definable. |
Yes, I thought about that. I'm certainly not hung up on any particular naming scheme (I tend to use a short prefix, as it plays well with lenses and DuplicateRecordFields). data BoundingBox v = BoundingBox { fCorner :: v, fSize :: v } deriving (...) The rationale behind the corner-based definition is (as you say), that it works well even for integral types. I've defined a collection of lenses and functions that are designed to play well with any type of vector (for instance, the intersect logic is based on Again, I'm not sure if this functionality belongs in |
In data Box f a = Box !(f a) !(f a) or One downside is that this dredges up all the allowing corner-case semantic crap around providing instances that makes my |
Fair points. I'd be happy to be the maintainer for a standalone package (the one I have needs some love and attention at the moment, perhaps I should create a new one which focuses on AABB:s only). I'd appreciate your input and advice in that case, if you have time (I've seen your Hackage page, it goes on for miles). For instance, strictness annotations are something I've considered but haven't decided on. Are there any drawbacks at all, in this case? I suppose not, since you're mostly just doing arithmetic. Also, the rationale behind using a single type argument is that it allows one-dimensional 'boxes' too (ie. Finally, I wasn't familiar with Thanks for responding, I'm a bit of a neophyte when it comes to working on widely used software. I stick to my own projects mostly. Do you want to keep this issue open or should I close? |
@ekmett Pinging again, hope you don't mind. |
Sorry, am traveling. The problem with 1d vs. n-dimensional intervals is you kind of want different things for them and the combinators to work with the various As for corner cases that Kaucher-style intervals in the intervals package allow 'negative' bounding boxes, and then there is the question of if you include empty boxes or not. |
Let's keep the issue open at least. I'm not against adding a simple AABB type, for only non-empty intervals with the assumption that lo <= hi pointwise. It is probably the most common use type. |
I have a separate package ready for publication (-ish) that I've been working on for the last few days (very similar to the old one from Cartesian, which is in a bit of a state at the moment). It's very small and hasn't been properly tested yet, but you're welcome to take a look. Also working on a demo program for shits and giggles. As you'll see, there's no real integration with your intervals yet. I'm posting this as a sort of springboard for further discussion. |
I'm back from http://scala.world/ and now have internet access. Skimming:
It'd be safer to use the machinery from linear for merging at the cost of an If you switch to Exporting:
seems gratuitous. |
@ekmett Sorry about the recent silence, hope you had a blast at that conf. Yes, I'm not entirely happy with the way I'm using As for the I'd happily accept the input from other Haskellers who have ideas about how a general AABB might be used out in the wild. Maybe that'll improve the overall design. And finally, yes, exporting |
This might be a tad too low-brow for your tastes, but is there any chance we could export a simple polymorphic n-dimensional
BoundingBox
(or similarly named) type from this library?Given the universality of this package (and how it ties in quite nicely with the
V[N]
types)Since there is no 'standard' type, people keep defining their own, making interop a bit of a trudge (and Haskellers don't trudge; they stride, right).
My own definition looks a bit like this:
The suffix is partly for aesthetics (
cornerOf box
reads nicely;of
is a nice synonym forflip (^.)
, come to think of it), partly a guide for lens generation.This got a bit long (sorry), but I have a final question: if this functionality should not be part of
linear
, do you have a suggestion for where it might fit in? Is there already a nice library that could become the de-facto standard? Where should I turn for this type of discussion?Thanks for the good work.
The text was updated successfully, but these errors were encountered: