Skip to content

KDTree : Add enclosedPoints() method that takes a list of half-spaces - #1565

Open
danieldresser-ie wants to merge 4 commits into
ImageEngine:mainfrom
danieldresser-ie:kdTreeHalfSpaces
Open

danieldresser-ie wants to merge 4 commits into
ImageEngine:mainfrom
danieldresser-ie:kdTreeHalfSpaces

Conversation

@danieldresser-ie

Copy link
Copy Markdown
Contributor

This adds the machinery needed in KDTree to do a frustum query, as needed by the paint tool. Converting a camera frustum to a set of half-spaces is not currently included here, since it doesn't require access to the KDTree internals ... maybe you want that in Cortex somewhere? Currently it's just an anonymous function in the paint tool.

The hardest part of this is probably naming the new method. "Intersection of a set of half-spaces" is not really a standard name for a geometric primitive, but it is the clearest way I can think of describing it ... especially if it needs to work in both 2D and 3D. If we could use Imath Planes to store the pair of origin and normal, I would use that, but that isn't defined for the 2D case.

Other slightly awkward things:

  • the top level bound being stored as dummy nodes at the end of the node list ( I'll put up another PR with a commit to get rid of that once we can break ABI )
  • the ugly enable_if guard to allow both the new and old signatures of the old enclosedPoints to co-exist. Seems to be working fine, though this stuff always feels like a mess. I did at one point find an invalid way of calling it that resulted in an ambiguous call ... which should only be possible if both IsIterator<T> and !IsIterator<T> ... still not sure what was going on there, but it seems to work OK for any valid calls, so hopefully this will keep any existing usage of enclosedPoints working.

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.

1 participant