<div dir="ltr"><div>Here is a BooleanFilter implementation for x3dom:</div><div><br></div><div><a href="https://github.com/andreasplesch/x3dom/blob/EventUtilities/src/nodes/EventUtilities/BooleanFilter.js">https://github.com/andreasplesch/x3dom/blob/EventUtilities/src/nodes/EventUtilities/BooleanFilter.js</a><br></div><div><br></div><div>This is a fairly simple node to implement. It extends ChildNode directly, and only implements the fieldChanged 'lifecycle' method. The postMessage method produces output events. </div><div><br></div><div>It took a bit longer to put together a good test scene which exercises the filter node fields:</div><div><br></div><a href="https://x3dom-booleanfilter.glitch.me/">https://x3dom-booleanfilter.glitch.me/</a><div><br></div><div>This is pretty standard x3d except for use of the x3dom 'render' SFBool field which can be used to control rendering of a shape node. Is there a standard conforming way to use a SFBool event to control rendering ? 'render' is certainly convenient.</div><div><br></div><div>An example scene like this may be useful to add to the web3d x3d example archive.</div><div><br></div><div>The example uses TouchSensor as a source for boolean events but I keep thinking about a non-interactive test without a script node. Perhaps something with TimeSensor ?</div><div><br></div><div>I will submit this node as a PR to the x3dom github repository if there are no obvious hickups.</div><div><br></div><div>Any feedback or comments welcome,</div><div><br></div><div>-Andreas</div><div><br></div><div><br></div><div><br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 4, 2017 at 3:14 PM, Andreas Plesch <span dir="ltr"><<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>freewrl also uses inputFalse with a false value but not without a dedicated comment:</div><div><br></div><a href="https://sourceforge.net/p/freewrl/git/ci/master/tree/freex3d/src/lib/scenegraph/Component_EventUtils.c#l45" target="_blank">https://sourceforge.net/p/free<wbr>wrl/git/ci/master/tree/freex3d<wbr>/src/lib/scenegraph/Component_<wbr>EventUtils.c#l45</a><br><div><a href="https://sourceforge.net/p/freewrl/git/ci/master/tree/freex3d/codegen/VRMLNodes.pm#l2644" target="_blank">https://sourceforge.net/p/free<wbr>wrl/git/ci/master/tree/freex3d<wbr>/codegen/VRMLNodes.pm#l2644</a><br></div><div><br></div><div>-Andreas</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 4, 2017 at 9:49 AM, Andreas Plesch <span dir="ltr"><<a href="mailto:andreasplesch@gmail.com" target="_blank">andreasplesch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I agree, inputFalse should produce false since BooleanFilter is designed as a pass through filter. It is just a matter of the spec. language being a bit too concise.<br></div><div>'<span style="color:rgb(0,0,0);font-size:12.8px">based on the Boolean value received' mostly refers to which of the possible output event should be generated, inputTrue or inputFalse. But the phrase is ambiguous with regards to the associated values.</span></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><font color="#000000"><span style="font-size:12.8px">What about</span></font></div><div><font color="#000000"><span style="font-size:12.8px"><br></span></font></div><div><span style="color:rgb(0,0,0);font-size:12.8px">'When the set_boolean event is received, the BooleanFilter node generates two events: either inputTrue with a value of true or inputFalse with a value of false, depending on the Boolean value received;...' ?</span><font color="#000000"><span style="font-size:12.8px"><br></span></font></div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div><div>But since the question was raised, let's explore the design to see if is possible to decide which behaviour may be more useful. How may BooleanFilter be used ?</div><div>Sensors are probably the main sources of boolean outputs. Filtering a sensor output makes it possible to selectively choose separate responses to the output. It is a kind of branching. This branching is achieved by having either inputTrue or inputFalse events but is independent of their values.</div></div><div>Considering a 'false' output value as something positive (true) may often be appropriate but completely depends on the scene architecture. So I follow Don's reasoning that it is best to keep it simple by forwarding the input values.</div><div><br></div><div>-Andreas</div><div><span style="color:rgb(0,0,0);font-size:12.8px"><br></span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 4, 2017 at 12:39 AM, Don Brutzman <span dir="ltr"><<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">great question, thanks Andreas.  let's explore.<br>
<br>
On 9/3/2017 8:18 PM, Andreas Plesch wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Looking at BooleanFilter (<a href="http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/utils.html#BooleanFilter" rel="noreferrer" target="_blank">http://www.web3d.org/document<wbr>s/specifications/19775-1/V3.3/<wbr>Part01/components/utils.html#B<wbr>ooleanFilter</a>) I could not decide what the boolean output values for the inputTrue and inputFalse events were.<br>
<br>
The spec. just has:<br>
<br>
'BooleanFilter node generates two events: either inputTrue or inputFalse, based on the Boolean value received; ...'<br>
</blockquote>
<br>
full prose:<br>
<br>
"BooleanFilter filters Boolean events, allowing for selective routing of TRUE or FALSE values and negation.<br>
<br>
When the set_boolean event is received, the BooleanFilter node generates two events: either inputTrue or inputFalse, based on the Boolean value received; and inputNegate, which contains the negation of the value received."<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Especially, the value for inputFalse is difficult to determine. I actually was leaning towards the value true for inputFalse when the received value is false since it is then true that the input value was false.<br>
</blockquote>
<br>
yes the semantics of the spec phrasing is a bit ambiguous.  we should get more explicit.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
However, the tooltips here<br>
<br>
<a href="http://www.web3d.org/x3d/content/X3dTooltips.html#BooleanFilter" rel="noreferrer" target="_blank">http://www.web3d.org/x3d/conte<wbr>nt/X3dTooltips.html#BooleanFil<wbr>ter</a><br>
<br>
claim that the inputFalse value should be false instead, passing on the value of the input.<br>
</blockquote>
<br>
reviewing now, i think that is correct, since it is closely following the initial spec sentence clause "based on the Boolean value received".<br>
<br>
of additional note is the figure that was reviewed by a number of people, linked in tooltips:<br>
<br>
        Hint: X3D Event-Utility Nodes, Field Event Diagrams<br>
        <a href="http://x3dgraphics.com/examples/X3dForWebAuthors/Chapter09-EventUtilitiesScripting/X3dEventUtilityNodeEventDiagrams.pdf" rel="noreferrer" target="_blank">http://x3dgraphics.com/example<wbr>s/X3dForWebAuthors/Chapter09-E<wbr>ventUtilitiesScripting/X3dEven<wbr>tUtilityNodeEventDiagrams.pdf</a><br>
<br>
attached is image excerpt showing BooleanFilter inputs/outputs, plus copy of diagram for convenience.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is that really what other x3d browsers do ?<br>
</blockquote>
<br>
yes it is good to check.  perhaps a more explicit test scene will help also.<br>
<br>
I think that [inputFalse passing FALSE] is indeed the right approach, for a few reasons:<br>
<br>
a. the node name BooleanFilter indicates a filtering action, i.e. only passing some things through, rather than changing them<br>
<br>
b. if an author filters an event stream to detect a FALSE event, it is detected and usable as such, rather than requiring yet-another negation.<br>
<br>
c. precise logic like this leads to more succinct and less error-prone event chains.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Checking cobweb it appears that it rather uses inputFalse=true here:<br>
<br>
<a href="https://github.com/create3000/cobweb/blob/master/src/cobweb/Components/EventUtilities/BooleanFilter.js#L110" rel="noreferrer" target="_blank">https://github.com/create3000/<wbr>cobweb/blob/master/src/cobweb/<wbr>Components/EventUtilities/Bool<wbr>eanFilter.js#L110</a><br>
</blockquote>
<br>
good check, we need to make them all consistent.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It looks like clarification is needed,<br>
</blockquote>
<br>
yes, further comment welcome.  once we're clear, let's<br>
<br>
d. have an explicit test scene,<br>
e. have specific spec prose and perhap add the diagrams,<br>
f. add an inputFalse Warning to ensure no ambiguity remains.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-Andreas<br>
</blockquote>
<br>
thanks!<br>
<br>
all the best, Don<span class="m_2367896014566677175HOEnZb"><font color="#888888"><span class="m_2367896014566677175m_1324255874359692202HOEnZb"><font color="#888888"><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   <a href="tel:%2B1.831.656.2149" value="+18316562149" target="_blank">+1.831.656.2149</a><br>
X3D graphics, virtual worlds, navy robotics <a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">http://faculty.nps.edu/brutzma<wbr>n</a><br>
</font></span></font></span></blockquote></div><span class="m_2367896014566677175HOEnZb"><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_2367896014566677175m_1324255874359692202gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>Waltham, MA 02453</div>
</font></span></font></span></div></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_2367896014566677175gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="m_2367896014566677175gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>Waltham, MA 02453</div></div></div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Andreas Plesch<br>Waltham, MA 02453</div></div></div>
</div>