kons-9
kons-9 copied to clipboard
introduce point picking selection mode for ray and cone
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 to t
then the selection handlers are called with the previous keyword arguments. If it set to t
however, the selection handler is expected to contain an additional keyword argument for xs-point
(which is a list of the closest picked vertex for the list of selected shapes).