<div dir="ltr">Yes feel free to add video wherever you want it and yes add to prose if appropriate.<div>-Doug<br><div>Freewrl has had a multitouch emulator for a few years - could drag separate plane sensors simultaneously before. Let me check with the original developer -- yes he says OK to recommend it to all x3d browser developers. Recently added the circle cursors to the emulator to look like windows desktop touch cursors.</div></div><div>And I have verified its working like official touches, by using client-server to inject touches into windows desktop so they come in as WM_TOUCH events, So the emulator and WM_TOUCH have the same impact on the freewrl state machine.</div><div>Something else that might go in the prose: how to deal with isOver with a touch device. Some have suggested use of gestures. Freewrl has a menubar button HOVER which changes a touch down-drag into an up-drag like a mouse-button-up drag.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 7, 2020 at 11:35 PM Don Brutzman <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Wow!!  Very impressive Doug.  Have added links to<br>
<br>
* Mantis 1293: HypersurfaceSensor/MultiTouchSensor for multi-touch environments<br>
   <a href="https://www.web3d.org/member-only/mantis/view.php?id=1293" rel="noreferrer" target="_blank">https://www.web3d.org/member-only/mantis/view.php?id=1293</a><br>
<br>
It is quite interesting how you appear to use a single mouse to emulate a multitouch device, also providing visual feedback.  Looks like operation is very intuitive.  Am also wondering if we can write this us in spec prose as an alternate approach a multi-touch system as part of X3D4:<br>
<br>
* X3DArchitecture,Annex G Recommended navigation behaviours<br>
   <a href="https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/behaviours.html" rel="noreferrer" target="_blank">https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/behaviours.html</a><br>
<br>
Presumably OK to post your video to YouTube and Twitter later this week I hope, please advise if not.<br>
<br>
<br>
On 6/7/2020 3:49 PM, GPU Group wrote:<br>
> I found bugs in my first implementation and spent another 4.5 days working through them;<br>
> Results:<br>
> <a href="http://dug9.users.sourceforge.net/web3d/tests/sensors/DragCascade_MultitouchSensorII.mp4" rel="noreferrer" target="_blank">http://dug9.users.sourceforge.net/web3d/tests/sensors/DragCascade_MultitouchSensorII.mp4</a><br>
> <br>
> Method:<br>
> MultitouchSensor had output fields for rotation_changed, scale_changed, translation_changed<br>
> When computing the translation from 2 points you might end up with something like how Transform nodes are done - with a center point C for where you rotate and scale:<br>
> T x C x R x S x (-C)<br>
> And so to get a summary translation with no center, you need to solve:<br>
> TxRxS = TxCxRxSx(-C)<br>
> And I wasn't doing that properly. I found there are 2 ways:<br>
> 1) matrix decompose - you can chain transforms together, then decompose the final transform<br>
> <br>
> <a href="https://webdocs.cs.ualberta.ca/~graphics/books/GraphicsGems/gemsiv/polar_decomp/" rel="noreferrer" target="_blank">https://webdocs.cs.ualberta.ca/~graphics/books/GraphicsGems/gemsiv/polar_decomp/</a><br>
> <br>
> - GraphicsGems IV matrix decomposer<br>
> <br>
> 2) least squares similarity 2D solver - which solves for 4 params: rotation, scale, xy translation<br>
> <br>
> <a href="https://sourceforge.net/p/freewrl/git/ci/develop/tree/freex3d/src/lib/input/SensInterps.c" rel="noreferrer" target="_blank">https://sourceforge.net/p/freewrl/git/ci/develop/tree/freex3d/src/lib/input/SensInterps.c</a><br>
> <br>
> - lines 1725 - 2063 are marked MIT Lic or equivalent, and have the matrix solver and 2D similarity solver<br>
> <br>
> I used a bit of both - least squares for computing the transform from 2 drags,<br>
> <br>
> and matrix decomposer for combining with previous offsets .offset (translation) rotationOffset, scaleOffset.<br>
> <br>
> Tout = Tcomputed_from_current_drags X Toffsets<br>
> <br>
> - then decomposing Tout to set the translation_changed, rotation_changed, scale_changed fields.<br>
> <br>
> <br>
> A few days of my time were spent trying to diagnose freewrl-specific issues, primarily<br>
> <br>
> we 'freeze' the transform to the sensor while a button is down. For 2 buttons, what<br>
> <br>
> happens if you add a 3rd button, or remove one of 2 buttons. Having a way to update<br>
> <br>
> the transforms reliably took some time, and one thing that helped was rendering the touch/drag points<br>
> <br>
> in sensor space -by making it a renderable node, and rendering the drag ponits-<br>
> <br>
>   as well as screen / viewer space. Weird motions often made sense relative to<br>
> <br>
> the touch-down points in sensor space.<br>
> <br>
> <br>
> Having a built-in emulator for multitouch helped a bit - didn't need to fiddle with other devices,<br>
> <br>
> - just mouse.<br>
> <br>
> <br>
> Good luck - hope other x3d browsers are easier.<br>
> <br>
> -Doug<br>
> <br>
> <br>
> <br>
>     My experience implementing (v4 proposed) MultitouchSensor in freewrl:<br>
> <br>
>     Results:<br>
> <br>
>     <a href="http://dug9.users.sourceforge.net/web3d/tests/sensors/DragCascade_MultitouchSensor.mp4" rel="noreferrer" target="_blank">http://dug9.users.sourceforge.net/web3d/tests/sensors/DragCascade_MultitouchSensor.mp4</a><br>
> <br>
>     <a href="http://dug9.users.sourceforge.net/web3d/tests/sensors/DragCascade_MultitouchSensor.x3d" rel="noreferrer" target="_blank">http://dug9.users.sourceforge.net/web3d/tests/sensors/DragCascade_MultitouchSensor.x3d</a><br>
> <br>
> <br>
>     Method:<br>
>     freewrl has had a multitouch emulator built in for serveral years.<br>
>     - a command line option turns it on, then it uses the mouse differently<br>
>     -- a RMB click creates a new drag -with a touchID<br>
>     -- a LMB click near an existing drag will grab it, and LMB drag will drag it<br>
>     -- another RMB click on an existing drag will delete it<br>
>     - and then whereever we are passing around mouse coordinates and button status, we pass an additional touchID.<br>
>     -- I verified the touch emulator approach with another emulator that puts touches into the windows desktop from a 2nd computer, and inhales the touches via windows events.<br>
>     But all we did was drag 2 separate dragsensors with 2 separate touches.<br>
> <br>
>     This new spec node adds a node that will take 2+ touches and do something interesting - output a rotation and scale, along with the usual planesensor type translation.<br>
>     So I started by copying the Planesensor and hacking it to count active drags, and when it has only one, it acts like a PlaneSensor, and when it has 2+ it uses the first 2 to compute rotation and scale<br>
> <br>
>     Time:<br>
>     Took 2.5 days. fiddly hard to understand code in freewrl. Hope other browsers are more organized.<br>
> <br>
>     And of the 2.5 days I spent 1/2 day reviewing a least_squares option which I didn't use, but could be used with 3+ points to compute a best-fit affine (6 parameter - 2 scales, 1 shear, 1 rotation, and xy 2 translations)<br>
> <br>
>     -Doug<br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman  Naval Postgraduate School, Code USW/Br       <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><br>
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149<br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzman</a><br>
</blockquote></div>