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

Point selection #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jamierobertson1
Copy link
Contributor

Adds a polytope intersector and a polygon intersector along with a point selection example.

PointPolytopeIntersector is a vsg::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.

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