8000 Refactor bounds by almarklein · Pull Request #1049 · pygfx/pygfx · GitHub
[go: up one dir, main page]

Skip to content

Conversation

almarklein
Copy link
Member

When working on #1042 I actually was on the way for a bigger refactoring. I trimmed it down to avoid stalling. This PR shows what I was working towards.

This is very experimental and requires much more thoughts and discussions. I don't consider it a priority, so I may pick this back up (much) later.

Also see

Thoughts

  • The radius trick helps get tighter bounds, and prevents them from becoming larges are aabb's get transformed.
  • But it's also more CPU intensive. Its it worth it? Maybe some benchmarks.
  • Maybe make it optional?
  • What do we want a cpu-based picking API to look like?

@Korijn
Copy link
Collaborator
Korijn commented Mar 18, 2025
  • What do we want a cpu-based picking API to look like?

I recommend to review the Three.js API and also their implementation. It's quite straightforward.


def get_bounds_local_recursive(self):
"""Get the Bounds, local to this objects space, of itself and all its children."""
# TODO: this replicates get_bounding_box(), but should it not include this local.matrix??
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All bounding geometry should be local - in the space of the geometry buffers. It's much cheaper to transform a ray into this space than to transform bounding geometry into ray space (may or may not be world).

@Korijn
Copy link
Collaborator
Korijn commented Mar 18, 2025

I could maybe take this thing out of your hands, and free up some of your time? I have experience implementing this stuff. Maybe we can call so you can share your vision and ideas.

@almarklein
Copy link
Member Author

I could maybe take this thing out of your hands

I was hoping this'd nerd-snipe you 😉 But no rush from my end.

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

Successfully merging this pull request may close these issues.

2 participants
0