Skip to content
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

Unify cBoundingBox and cCuboid #4363

Open
madmaxoft opened this issue Aug 9, 2019 · 2 comments

Comments

@madmaxoft
Copy link
Member

@madmaxoft madmaxoft commented Aug 9, 2019

Both serve a very similar purpose, one is int-based, the other double-based. We should refactor to use only one, templated like Vector3.

Additionally, it could be useful to change the cCuboid's logic so that the min coord is inclusive, but the max coord isn't - that way empty cuboids can be represented simply.

@madmaxoft

This comment has been minimized.

Copy link
Member Author

@madmaxoft madmaxoft commented Aug 9, 2019

Note: cCuboid supports "unsorted" state - in some operations it doesn't care whether the first point is the max coords, min coords, or mixed. This is used in some plugins (WorldEdit's selection comes to mind). I think this is poor design and should be changed (along with the plugins), so that the cCuboid is always sorted. But that probably warrants a discussion, and a change in the API (the two individual points no longer accessible to Lua).

@madmaxoft

This comment has been minimized.

Copy link
Member Author

@madmaxoft madmaxoft commented Aug 9, 2019

Possible other ideas for refactoring (since it's already being changed):
cBoundingBox has constructors that create a bounding box centered around a point, with a specified diameter and height and optionally vertical offset. This should be changed to static functions fromCenter and fromCenterWithOffset (the second form only if it's heavily used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.