<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Now THAT'S a constructive reply! Many thanks!<br>
    <br>
    Dave A.<br>
    <br>
    On 9/23/2010 12:53 AM, Bederov, Sergey wrote:
    <blockquote
      cite="mid:53137E4907C02940B69333CFAF37812116E6F9@grot.paragraph.ru"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"\0421\0442\0430\043D\0434\0430\0440\0442\043D\044B\0439 HTML \0417\043D\0430\043A";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTML
        {mso-style-name:"\0421\0442\0430\043D\0434\0430\0440\0442\043D\044B\0439 HTML \0417\043D\0430\043A";
        mso-style-priority:99;
        mso-style-link:"\0421\0442\0430\043D\0434\0430\0440\0442\043D\044B\0439 HTML";
        font-family:"Consolas","serif";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Arial","sans-serif";
        color:navy;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
        {page:WordSection1;}
-->
</style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">Hello Dave and Tony,<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">The problem is that PlaneSensor is inherently
            planar, even if it
            has minY=maxY. If you limit the Y motion, the output values
            will always be on
            one line, but the plane still matters. The sensor works in
            the following
            algorithm:<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">1. Calculate a ray from the camera through the
            mouse pointer<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">2. Intersect the ray with the PlanarSensor
            plane (Z=0 in its local
            coordinate system)<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">3. Calculate the local X and Y coordinates of
            the intersection
            point<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">4. Clamp X and Y values, if needed<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">5. Output the (X, Y, 0) event<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">In most non-trivial cases, a different plane
            yields different X and
            Y coordinates, and while Y is clamped, X is still different.
            The worst case is
            when you look almost along the plane. Any small movement of
            the mouse produces
            a large movement of the intersection point, and while Y is
            clamped, X changes
            rapidly. When the mouse pointer approaches the “horizon”,
            you can
            move the target object away from the screen and even to
            infinity.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">Dave, I would recommend you placing the
            PlaneSensor into a
            Billboard whose axisOfRotation coincides with the clamped
            area of the
            PlaneSensor. The billboard will always rotate the
            PlaneSensor to the best
            orientation respective to the camera, and everything will
            work in the most “natural”
            way. Effectively, this yields an (approximate) orthogonal
            projection of the
            mouse pointer to the needed line, in screen coordinates.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left: 177pt; text-indent:
          35.4pt;"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US">                                            
            Sergey Bederov<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="font-size: 10pt; font-family:
            "Arial","sans-serif"; color: navy;"
            lang="EN-US"><o:p> </o:p></span></p>
        <div style="border-right: medium none; border-width: 1pt medium
          medium; border-style: solid none none; border-color: rgb(181,
          196, 223) -moz-use-text-color -moz-use-text-color; padding:
          3pt 0cm 0cm;">
          <p class="MsoNormal"><b><span style="font-size: 10pt;
                font-family: "Tahoma","sans-serif";">From:</span></b><span
              style="font-size: 10pt; font-family:
              "Tahoma","sans-serif";">
              <a class="moz-txt-link-abbreviated" href="mailto:x3d-public-bounces@web3d.org">x3d-public-bounces@web3d.org</a>
              [<a class="moz-txt-link-freetext" href="mailto:x3d-public-bounces@web3d.org">mailto:x3d-public-bounces@web3d.org</a>] <b>On Behalf
                Of </b>Tony Parisi<br>
              <b>Sent:</b> Thursday, September 23, 2010 6:25 AM<br>
              <b>To:</b> Dave A<br>
              <b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:x3d-public@web3d.org">x3d-public@web3d.org</a><br>
              <b>Subject:</b> Re: [X3D-Public] Any way to do a
              'LineSensor' (Like PlaneSensor
              but in one dimension)<o:p></o:p></span></p>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal" style="margin-bottom: 12pt;">Hmmm,<br>
          <br>
          This might be an implementation artifact (possible even in two
          players), or it
          might be correct to-spec behavior.<br>
          <br>
          But now we've gone beyond my ability to visualize. Hoping KV
          can weigh in.
          Keith are you listening?!<br>
          <br>
          Tony<o:p></o:p></p>
        <div>
          <p class="MsoNormal">On Wed, Sep 22, 2010 at 6:27 PM, Dave A
            <<a moz-do-not-send="true"
              href="mailto:dave@realmofconcepts.com">dave@realmofconcepts.com</a>>
            wrote:<o:p></o:p></p>
          <div>
            <p class="MsoNormal">Yeah. I try to save myself some
              time/trouble by asking if
              anyone's seen anything, such that I don't have to reinvent
              a wheel.....<br>
              <br>
              Anyway, I see this behavior in Vivaty and Contact.<br>
              <br>
              Imagine you have a plane. Let's say it's face-on to the
              screen. The PlaneSensor
              works well in this case, and setting min.y = max.y will
              restrict motion to just
              X. That's fine. Intuitive interaction.<br>
              <br>
              Now navigate such that the plane is not face-on to the
              screen. It's a rhombus.
              If you were to draw bisectors on the plane (its local
              axes), you would see a
              line representing the X axis no longer parallel to screen
              X, and Y no longer
              parallel to Y.<br>
              <br>
              Now when you get translation events from the sensor, there
              are X and Y
              components to that. But if you map that to motion, you'll
              see that MOUSE motion
              in any direction will result in object motion (in one
              direction). And when the
              unwanted axis is 'shorter' (more oblique), there is much
              more motion resulting
              from mouse-movement in that direction. It's a horribly
              non-intuitive
              interaction.<br>
              <br>
              It's hard to describe, sorry, but try it. Make something
              in Vivaty studio with
              a PlaneSensor and just set the min/max values. Then run
              it, rotate the scene
              around, and play with it. Won't be long before you run
              into this behavior.<br>
              <br>
              I imagine I may have to transform the sensor's values to
              screen coords, filter,
              and transform back?<br>
              <span style="color: rgb(136, 136, 136);"><br>
                Dave A</span><o:p></o:p></p>
            <div>
              <div>
                <p class="MsoNormal"><br>
                  <br>
                  <br>
                  <br>
                  On 9/22/2010 5:34 PM, Tony Parisi wrote: <o:p></o:p></p>
                <p class="MsoNormal" style="margin-bottom: 12pt;">Poor
                  Dave, they're still
                  bashing you after all these years. I feel for ya man.<br>
                  <br>
                  Ok now on-topic: if I recall, there is a way to
                  constrain the PlaneSensor to
                  one dimension. From da spec:<br>
                  <br>
                  "<i>minPosition</i> and <i>maxPosition</i> may be set
                  to clamp <i>translation_changed</i>
                  events to a range of values as measured from the
                  origin of the Z=0 plane of the
                  local sensor coordinate system. If the X or Y
                  component of <i>minPosition</i>
                  is greater than the corresponding component of <i>maxPosition</i>,
                  <i>translation_changed</i>
                  events are not clamped in that dimension. If the X or
                  Y component of <i>minPosition</i>
                  is equal to the corresponding component of <i>maxPosition</i>,
                  that component
                  is constrained to the given value. This technique
                  provides a way to implement a
                  line sensor that maps dragging motion into a
                  translation in one
                  dimension."<br>
                  <br>
                  Tony<span lang="EN-US"><o:p></o:p></span></p>
                <p class="MsoNormal" style="margin-bottom: 12pt;"><span
                    style="font-size: 10pt; font-family:
                    "Arial","sans-serif"; color:
                    navy;" lang="EN-US"><o:p> </o:p></span></p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>