introduce point picking selection mode for ray and cone #259
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.
Hello @kaveh808 and thanks for the kons-9 project. I'm building a wavetable synth editor, so basically 3D height-field transformations that will be used in audio oscillators. As part of the editor I want dynamic mouse-driven point-and-click editing such as increasing height and decreasing height when mouse is clicked. Similar to the terrain builder mechanics in simulation games.
To accomplish this with kons-9 I have added point selection within the current shape selection machinery. Now, a custom selection handler can trigger an action like transforming the region around the selected point. I have provided a simple example that draws a sphere at the closest clicked point.
The code adds a very small fixed cost to object selection, most of the calculations for finding the closest vertex to the ray or cone was already there. Only a few basic vec operations to get the closest vertex point were necessary.
I've made the changes in a backwards compatible way. If
*point-picking-enabled*
is not set tot
then the selection handlers are called with the previous keyword arguments. If it set tot
however, the selection handler is expected to contain an additional keyword argument forxs-point
(which is a list of the closest picked vertex for the list of selected shapes).