Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a polytope intersector and a polygon intersector along with a point selection example.
PointPolytopeIntersector
is avsg::PolytopeIntersector
subclass with an additional step which transforms the polytope into the scaled packed integer vertex coordinates that VSG::Points uses.PolygonIntersector
is for selecting points within a screenspace polygon. The polygon is divided into a series of "edges" using the near / far planes for each polygon point. The number of edge intersects from a ray from each point is counted to ascertain if the point is inside or outside the polygon.There is a
pointselection
example which demonstrates and example usage of these intersectors. If no file name is supplied a default pointcloud is created with points that change from green to red when selected. If a file name is provided for an existing vsgPoints pointcloud, then intersection coordinates are output on the console:Keys:
"1" - Square (PointPolytopeIntersector) intersector mode
"2" - Polygon (PolygonIntersector) mode. Starts drawing a polygon by clicking points on screen, pressing 2 again stops adding points
R Mouse: Intersects
"r" - Resets point colours
"o" - Intersects points outside the polygon (polygon selection mode only).
Tested on windows. There is currently an issue if the window is resized as the overlay camera's (used to draw polygons on) ResizeHandler does not receive the latest window size following resizes.