<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>I recalculate the last cycleTime<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"> </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">new</span> (yes really outpuOnly cycleTime):</div><div><br></div>cycleTime = currentTime - fraction * cycleInterval<div><br></div><div>From this time point you can calculate fraction as well:</div><div><br></div><div>fraction = (currentTime - cycleTime) % 1.0</div><div><br></div><div>Best regards,</div><div>Holger<br><div><br><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="text-align: start; text-indent: 0px; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">--</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Holger Seelig</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Leipzig, Germany</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;"><br></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">holger.seelig@yahoo.de</div><div>https://create3000.github.io/x_ite/</div></div></div></div></div></div></div>
</div>
<div><br><blockquote type="cite"><div>Am 15.08.2023 um 23:37 schrieb Andreas Plesch <andreasplesch@gmail.com>:</div><br class="Apple-interchange-newline"><div><div>I forgot the cycleTime is actually of type SFTime, not SFFloat. So<br>ScalarInterpolator would not work, although x3dom does not enforce the<br>type.<br><br>Back to the drawing board, using TimeTrigger now, or perhaps<br>elapsedTime from a TimeSensor to feed into cycleInterval.<br><br>Thanks, Holger, for the test scene. Great to see. Will try to come up<br>with a simple scene without a Script node. How do you maintain the<br>fraction after changing cycleInterval ?<br><br>Cheers,<br>-Andreas<br><br>On Tue, Aug 15, 2023 at 3:41 PM Andreas Plesch <andreasplesch@gmail.com> wrote:<br><blockquote type="cite"><br>Developing a test scene uncovered that the requirement to continue<br>smoothly on the same fraction after a cycleInterval change appears to<br>require a change to the startTime field value. An unintended<br>consequence, perhaps ?<br><br>Details:<br><br>Here is a simple test scene for dynamic changes to cycleTime based on<br>a vrml2 source book scene for OrientationInterpolator:<br><br>https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/bb3ee65b6748644f640cd5b73f30ed6e/raw/22a7b7f13bd597b55f136cee96a3b30747e14931/dynamicCycleInterval.x3d<br><br>For X3D3.3 the scene is expected to show a rotating column at constant<br>speed. For X3D4.0 the scene is expected to show a rotating column<br>which switches speed every 5 seconds without stuttering or resets.<br><br>Above includes a first, rough x3dom implementation (in the Scene,<br>javascript allows redefining almost anything) which at least shows the<br>changes in animation speed but is not successful at maintaining the<br>correct fraction to smoothly continue after a change.<br><br>Let's see. The fraction is elapsedTime/cycleInterval. This means that<br>either elapsedTime will need to change with a change to cycleInterval<br>or that startTime will need to change. Since elapsedTime is derived<br>from the current time and startTime this only leaves startTime.<br><br>new_fraction = old_fraction<br>new_fraction = elapsedTime/new_cycleInterval<br>elapsedTime - new_fraction * new_cycleInterval<br>time - startTime = new_fraction * new_cycleInterval<br>startTime = time - new_fraction * new_cycleInterval<br><br>I think it is safe to change startTime but it will also change<br>elapsedTime for the remainder of the cycle. Not sure what to do about<br>that. Also there may be scenes which somehow rely on startTime not<br>being changed. But the algorithm for calculating fraction in the spec<br>really requires startTime to change when cycleInterval changes if the<br>goal is to maintain the fraction. Is this a matter for the spec. to<br>address to remain internally consistent ?<br><br>https://andreasplesch.github.io/Library/Viewer/index.html?url=https://gist.githubusercontent.com/andreasplesch/bb3ee65b6748644f640cd5b73f30ed6e/raw/181894e010f35d242f9f24cf39478e941bccf234/dynamicCycleInterval.x3d<br><br>does adjust the startTime in that way and it does work to continue<br>smoothly with the same fraction after the speed change. Not sure if<br>there are implications for pausing and resuming. Probably worth adding<br>to the test scene, as well as enabling and disabling.<br><br>I guess the alternative is to keep an internal effective startTime for<br>fraction calculation which may be a bit messy.<br><br>I also tried briefly what happens when cycleTime changes every frame,<br>eg. at the same pace as Timesensor fractions are generated which also<br>seemed to work after the startTime adjustment.<br><br>-Andreas<br><br><br>On Tue, Aug 15, 2023 at 12:18 PM Andreas Plesch <andreasplesch@gmail.com> wrote:<br><blockquote type="cite"><br>It appears that a question on x3d-public back in 2016 was the trigger<br>for the change:<br><br>https://web3d.org/pipermail/x3d-public_web3d.org/2016-November/thread.html#start<br><br>It involves the x3d-svg-html "rosetta stone" page but that is not<br>really suitable as a focused test scene.<br><br>Since this is a new feature there are probably no existing examples. I<br>may try to generate a pure X3D one showing a bouncing sphere:<br><br>A sketch:<br><br>"SENSOR" TouchSensor<br>"POSITION" Transform<br> "BALL" Shape<br> ..<br>"CLOCK" TimeSensor<br>"MOVER" CoordinateInterpolator<br>ROUTE CLOCK.fraction_changed to MOVER.set_fraction<br>ROUTE MOVER.value_changed to POSITION.position<br>#Begin of cycleInterval switching without a script<br>#Use ScalarInterpolator to emit SFFloat (there is no ScalarSequencer)<br>"INTERVAL5" ScalarInterpolator keyValue="5.0"<br>"INTERVAL1" ScalarInterpolator keyValue="1.0"<br>ROUTE INTERVAL5.value_changed to CLOCK.set_cycleInterval<br>ROUTE INTERVAL1.value_changed to CLOCK.set_cycleInterval<br>"Use Timers to trigger<br>"TIMER5" TimeSensor loop=true enabled=false<br>"TIMER1" TimeSensor loop=true enabled=false<br>ROUTE TIMER5.fraction_changed to INTERVAL5.set_fraction<br>ROUTE TIMER1.fraction_changed to INTERVAL1.set_fraction<br>#Use BooleanToggle and BooleanFilter to control activity<br>"NEGATER" BooleanFilter<br>"TOGGLER" BooleanToggle<br>ROUTE SENSOR.isActive to TOGGLER.set_boolean<br>ROUTE TOGGLER.toggle_changed to NEGATER.set_boolean<br>ROUTE TOGGLER.toggle_changed TIMER5.set_enabled #on/off TIMER5<br>ROUTE NEGATER.inputeNegate TIMER1.set_enabled #off/on TIMER1<br><br>Is there an easier way to send a SFFloat to cycleInterval without a<br>script node ?<br><br>Thinking about it may be better to avoid all the event utilities in an<br>example and just switch continuously between speeds:<br>...<br>#Begin of cycleInterval switching without a script<br>"INTERVAL1OR5" ScalarInterpolator key='0 0.5 0.5 1' keyValue='1 1 5 5'<br>ROUTE INTERVAL1OR5.value_changed to CLOCK.set_cycleInterval<br>"SPEEDCLOCK" TimeSensor cycleInterval=5 # =3 for more challenging test<br>ROUTE SPEEDCLOCK.fraction_changed to INTERVAL1OR5.set_fraction<br><br>This brings up if it will be necessary in the spec. to define<br>behaviour for the case when cycleInterval receives a new value which<br>is the same as the existing value ? Probably not since the proposed<br>language only covers actual changes implying that nothing should<br>happen if there is no actual change.<br><br>-Andreas<br><br>On Tue, Aug 15, 2023 at 10:46 AM Brutzman, Donald (Don) (CIV)<br><brutzman@nps.edu> wrote:<br><blockquote type="cite"><br>Thanks for pointing out the error with CD1 urls in X3D Tooltips, which eluded prior search/replace.<br><br><br><br>Now fixed. Correct current url prefix follows, sourceforge commit and web3d.org deploy will happen later today.<br><br><br><br>https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-IS.proof/<br><br><br><br>The older behavior can be considered defunct and rectified by specification. Devising an example that explicitly shows such correct behavior is a good idea. All candidates welcome from any author.<br><br><br><br>Thanks for pursuing this important interoperability consideration… we want duck models to consistently walk, talk, and look like a duck.<br><br><br><br>Not sure what is going on with the following url, will investigate further. Probably an early (and now unintended) redirect.<br><br><br><br>https://www.web3d.org/documents/specifications/19775-1/V4.0<br><br><br><br>all the best, Don<br><br>--<br><br>Don Brutzman Naval Postgraduate School, Code USW/Br brutzman@nps.edu<br><br>Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149<br><br>X3D graphics, virtual worlds, navy robotics https://faculty.nps.edu/brutzman<br><br><br><br>-----Original Message-----<br>From: x3d-public <x3d-public-bounces@web3d.org> On Behalf Of Andreas Plesch<br>Sent: Monday, August 14, 2023 6:56 PM<br>To: X3D Graphics public mailing list <x3d-public@web3d.org><br>Subject: [x3d-public] change to cycleTime perhaps no longer ignored , example ?<br><br><br><br>https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/time.html#TimeSensor<br><br>(as linked from tooltips page)<br><br><br><br>has the change that resetting the value of cycleTime of an active TimeSensor in v.4-CD1 does what is probably expected rather than being completely ignored which was the old behaviour.<br><br><br><br>Is there an example scene somewhere which demonstrates that change, for testing purposes ?<br><br><br><br>A bouncing sphere which changes its frequency over time, perhaps ?<br><br><br><br>This proposal may have been taken out since<br><br><br><br>https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/time.html#TimeSensor<br><br><br><br>does not have the change ? In that case, apologies for the confusion.<br><br><br><br>-Andreas<br><br>--<br><br>Andreas Plesch<br><br>Waltham, MA 02453<br><br><br><br>_______________________________________________<br><br>x3d-public mailing list<br><br>x3d-public@web3d.org<br><br>http://web3d.org/mailman/listinfo/x3d-public_web3d.org<br></blockquote><br><br><br>--<br>Andreas Plesch<br>Waltham, MA 02453<br></blockquote><br><br><br>--<br>Andreas Plesch<br>Waltham, MA 02453<br></blockquote><br><br><br>-- <br>Andreas Plesch<br>Waltham, MA 02453<br><br>_______________________________________________<br>x3d-public mailing list<br>x3d-public@web3d.org<br>http://web3d.org/mailman/listinfo/x3d-public_web3d.org<br></div></div></blockquote></div><br></div></div></body></html>