Skip to content

Point selection#30

Open
jamierobertson1 wants to merge 1 commit intovsg-dev:masterfrom
jamierobertson1:point_selection
Open

Point selection#30
jamierobertson1 wants to merge 1 commit intovsg-dev:masterfrom
jamierobertson1:point_selection

Conversation

@jamierobertson1
Copy link
Copy Markdown
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