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

[spine-cpp] SkeletonBounds intersects an other SkeletonBounds #2252

Closed
Niolak opened this issue Feb 19, 2023 · 3 comments
Closed

[spine-cpp] SkeletonBounds intersects an other SkeletonBounds #2252

Niolak opened this issue Feb 19, 2023 · 3 comments
Assignees

Comments

@Niolak
Copy link

Niolak commented Feb 19, 2023

Hello,

I would need to test if 2 SkeletonBounds intersect and get their respective bounds in contact. Currently, I do not see any way of doing this. I think one of the following should be done to make it possible, in order of what seems best to me:

  • add a Vector<Polygon>* getPolygons() to SkeletonBounds and a BoundingBoxAttachment *getBoundingBox(Polygon *polygon);,
  • make the _polygons and _boundingBoxes protected so we can inherit SkeletonBounds to add some methods,
  • add directly some features, but probably more time consuming and too specific to each need, what I would need is something like std::pair<std::vector<BoundingBoxAttachment*>,std::vector<BoundingBoxAttachment*>> intersects(SkeletonBounds* other); returning all bounding boxes of both the skeletonBounds (this and other).

In the meantime, I'll use a custom version implementing the first solution but I think it could be useful to others.

@badlogic badlogic self-assigned this Feb 19, 2023
@badlogic
Copy link
Collaborator

Solution 1 makes the most sense to me. While solution 2 would work just as well, it's a tiny hit cleaner to expose things via getters. We try to not rely on STL for various reasons, so solution 3 is not workable.

I'll add this tomorrow to the 4.1 and 4.2-beta branches.

@badlogic
Copy link
Collaborator

This is now implemented in the latest commit on the 4.1 and 4.2-beta branches.

@Niolak
Copy link
Author

Niolak commented Mar 11, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants