DampedPositionInterpolator

This proto was posted by peter on 2007-08-14.

So far there is 1 comment. Feel free to add one.

Quick links

Description

A damped PositionInterpolator which can be used as a drop-in replacement for a standard PositionInterpolator.

It combines a PositionInterpolator, PositionDamper and TimeSensor node.

Interface

Field name Value type Field type Default value
set_fraction SFFloat inputOnly
Selects input key for corresponding keyValue output.
duration SFTime inputOutput 1.0
The duration of the interpolation (in seconds).
enabled SFBool inputOutput true
Flag to enable/disable the node behaviour
initialDestination SFVec3f inputOutput 1 1 1
The initial damper destination.
initialValue SFVec3f inputOutput 1 1 1
The initial damper value.
key MFFloat inputOutput 0 1
Defines parameters for interpolation function time intervals, in increasing order and corresponding to keyValues. Hint: number of keys must match number of keyValues!
keyValue MFVec3f inputOutput 0 0 0, 1 1 1
Output values of the interpolation, each corresponding to time-fraction keys. Hint: number of keys must match number of keyValues!
loop SFBool inputOutput false
Specifies if the interpolation is looped.
startTime SFTime inputOutput 0
Interpolation is started if value is >=now.
tau SFTime inputOutput 0.2
The field tau specifies the time-constant of the internal filters and thus the speed that the output of an X3DDamperNode responds to the input.
cycleTime SFTime outputOnly
Sends a time output at start time of the interpolation and also at the beginning of each new cycle (useful for synchronization with other time-based objects).
value_changed SFVec3f outputOnly
Interpolated output value determined by current key time and corresponding “keyValue” pair.

Proto code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' profile='Full' version='3.0' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.0.xsd'>
<Scene DEF='scene'>

<ProtoDeclare name='DampedPositionInterpolator' component='pyjax' documentation='A damped PositionInterpolator which can be used as a drop-in replacement for a standard PositionInterpolator. It combines a PositionInterpolator, PositionDamper and TimeSensor node.'>
        
    <ProtoInterface>
        <field name='key' type='MFFloat' accessType='inputOutput' value='0 1'
               documentation='Defines parameters for interpolation function time intervals, in increasing order and corresponding to keyValues. Hint: number of keys must match number of keyValues!' />
        <field name='keyValue' type='MFVec3f' accessType='inputOutput' value='0 0 0, 1 1 1'
               documentation='Output values of the interpolation, each corresponding to time-fraction keys. Hint: number of keys must match number of keyValues!' />
        <field name='enabled' type='SFBool' accessType='inputOutput' value='true' 
               documentation='Flag to enable/disable the node behaviour'/>
        <field name='value_changed' type='SFVec3f' accessType='outputOnly'
               documentation='Interpolated output value determined by current key time and corresponding "keyValue" pair.'/>
        <field name='set_fraction' type='SFFloat' accessType='inputOnly'
               documentation='Selects input key for corresponding keyValue output.'/>
        
        <field name='tau' type='SFTime' accessType='inputOutput' value='0.2' 
               documentation='The field tau specifies the time-constant of the internal filters and thus the speed that the output of an X3DDamperNode responds to the input.' />
        <field name='initialValue' type='SFVec3f' accessType='inputOutput' value='1 1 1' 
               documentation='The initial damper value.'/>
        <field name='initialDestination' type='SFVec3f' accessType='inputOutput' value='1 1 1' 
               documentation='The initial damper destination.'/>
        
        <field name='duration' type='SFTime' accessType='inputOutput' value='1.0' 
               documentation='The duration of the interpolation (in seconds).' />
        <field name='startTime' type='SFTime' accessType='inputOutput' value='0' 
               documentation='Interpolation is started if value is &gt;=now. '/>
        <field name='loop' type='SFBool' accessType='inputOutput' value='false'
               documentation='Specifies if the interpolation is looped.'/>
        <field name='cycleTime' type='SFTime' accessType='outputOnly'
               documentation='Sends a time output at start time of the interpolation and also at the beginning of each new cycle (useful for synchronization with other time-based objects).'/>
    </ProtoInterface>
        
    <ProtoBody>     
        <Group>
            <PositionInterpolator DEF='posInterpol'>
                <IS>
                    <connect protoField='key' nodeField='key'/>
                    <connect protoField='keyValue' nodeField='keyValue'/>
                    <connect protoField='enabled' nodeField='enabled'/>
                    <connect protoField='set_fraction' nodeField='set_fraction'/>
                </IS>
            </PositionInterpolator>     
            
            <PositionDamper DEF='damper'>
                <IS>
                    <connect protoField='tau' nodeField='tau'/>
                    <connect protoField='initialValue' nodeField='initialValue'/>
                    <connect protoField='initialDestination' nodeField='initialDestination'/>
                    <connect protoField='enabled' nodeField='enabled'/>
                    <connect protoField='value_changed' nodeField='value_changed'/>
                </IS>
            </PositionDamper>
                        
            <TimeSensor DEF='ts'>  
                <IS>
                    <connect protoField='startTime' nodeField='startTime'/>
                    <connect protoField='duration' nodeField='cycleInterval'/>
                    <connect protoField='loop' nodeField='loop'/>
                    <connect protoField='cycleTime' nodeField='cycleTime'/>
                </IS>
            </TimeSensor>
            
            <ROUTE fromNode='ts' fromField='fraction_changed' toNode='posInterpol' toField='set_fraction' />
            <ROUTE fromNode='posInterpol' fromField='value_changed' toNode='damper' toField='set_destination' />            
            
        </Group>
    
    </ProtoBody>   
</ProtoDeclare>    

</Scene>
</X3D>
  
  
  

Test code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' profile='Full' version='3.0' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.0.xsd'>
<Scene DEF='scene'>

<ExternProtoDeclare name='DampedPositionInterpolator' url='DampedPositionInterpolator_PROTO.x3d' />
        
<!-- A simple test for the DampedPositionInterpolator.
     
     It animates a box from left to right. Note the "smoothness" of the animation due
     to the damper.
 -->

<Viewpoint position='0.5 0 2' />
<DampedPositionInterpolator DEF='dampedPosInterpol' loop='true' key='0 0.5 1' keyValue='0 0 0, 1 0 0, 0 0 0' />

<Transform DEF='boxTrans'>
    <Shape>
      <Box size='.1 .1 .1' containerField='geometry' />
    </Shape>  
</Transform>

<ROUTE fromNode='dampedPosInterpol' fromField='value_changed' toNode='boxTrans' toField='translation' />

</Scene>
</X3D>

Comments

Darnell Landry said on August 20, 2008

cynical hypernomian rhipidopterous lionet screamingly thaumatology exhaustlessly apprenticehood
http://www.hhs.state.ne.us/ems/emsind… >Nebraska Emergency Medical Services Program
http://www.bbc.co.uk/music/experiment…
http://www.balkan-speleo.org >Balkan Speleological Union
http://www.vintagemarque.com/
http://www.muslim-marriages.co.uk >Muslim-Marriages
http://www.earth.ox.ac.uk/~steve/Spec…
http://www.hotelmilano.org/ >Hotel Milano
http://tennesseeencyclopedia.net/imag…

Add a comment