Replies: 3 comments
-
I think for now this might be better as a separate crate just in that I'm not really keeping up with Probably he main question / difficulty is if more than |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback. I may just do a Bounds that parameterizes on a glam type. If I'm working separately from glam then that makes it less weird to break glam style and use a generic… (Unfortunately generic Box is out for obvious reasons…) It you think this is totally out feel free to close. |
Beta Was this translation helpful? Give feedback.
-
Converted to a discussion. I think this is a useful thing to do, but not something I want to take on myself right now. This might be a good place to co-ordinate if someone decides to take it on though. |
Beta Was this translation helpful? Give feedback.
-
I situation I frequently find myself in when working with vectors is I have a 2D rectangle or 3D volume and I need to know if a particular coordinate is "in bounds", IE, I have an axis-aligned bounding box and I need to know if a point is within it. It is straightforward to keep a minimum and maximum coordinate and >=/<= each component, but this is verbose and therefore error-prone. I like to have a single object encapsulating the bounds especially since this makes it easy to tack on convenience features such as "expand the bounds to include this point" and "offset the bounds".
There doesn't seem to be a good library for this with glam or in Rust in general. "Glamour" has Box2D/Box3D structs, but Glamour is somewhat heaviweight and expects you to use its own special specially-typed vector struct idiom, also it currently doesn't seem to be compatible with Glam 0.22 (requires 0.21). It would be great to have a Box/Bounds/AABB/multidimensional range struct that uses Glam types natively.
I previously contributed Bound2 and Bound3 classes to the CPML vector math library for Lua, and would be happy to create a PR or addon crate for Rust implementing a bounds object. It would be helpful though if while I work on the PR I could get feedback on how to fit glam's idioms best (For starters: should it be named Box2, Bound2 or something else? Would Box be preferred or specialized IBox2/DBox3 type classes? Would it be better to do this as a glam-rs PR or a new crate?).
Beta Was this translation helpful? Give feedback.
All reactions