Fiducial

This proto was posted by peter on 2007-10-27.

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

Quick links

Description

A node representing a fiducial used in combination with the reacTIVision tracking framework.

A fiducial must be used within a FiducialManager node in order to work correctly. All output fields reflect the state and attributes of a fiducial and send events when changed. All the input fields of the Fiducial node are supposed to be called by the FiducialManager only.

Interface

Field name Value type Field type Default value
index SFInt32 initializeOnly 0
The unique index of the fiducial.
posScale SFVec3f initializeOnly 1 1 1
A fiducials pos is multiplied by this scaling. Default is no scaling (1,1,1).
add SFTime inputOnly
This is supposed to be called by the FiducialManager. Setting this input will trigger events on the “added” and “visible” output fields.
delete_ SFTime inputOnly
This is supposed to be called by the FiducialManager. The postfix underscore is used to prevent JavaScript errors (delete is a JavaScript keyword). Setting this input will trigger events on the “deleted” and “visible” output fields.
set_angle SFFloat inputOnly
Changes the angle and triggers an event on the angle output. This is supposed to be called by the FiducialManager. Setting this input will trigger an event on the “angle” output.
set_xpos SFFloat inputOnly
Changes the x-coordinate and triggers an event on the “pos” output. This is supposed to be called by the FiducialManager.
set_ypos SFFloat inputOnly
Changes the y-coordinate and triggers an event on the “pos” output. This is supposed to be called by the FiducialManager.
added SFTime outputOnly
Send when the fiducial was added (became visible to the camera).
angle SFFloat outputOnly
The angle of the fiducial (currently in the interval 0-1).
deleted SFTime outputOnly
Send when the fiducial was deleted (is no longer visible to the camera).
pos SFVec3f outputOnly
The position of the fiducial. The z-coordinate is always 0.
visible SFBool outputOnly
True when the fiducial is visible, False if not.

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
80
81
<?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='Fiducial' component='pyjax' documentation='A node representing a fiducial used in combination with the reacTIVision tracking framework. A fiducial must be used within a FiducialManager node in order to work correctly. All output fields reflect the state and attributes of a fiducial and send events when changed. All the input fields of the Fiducial node are supposed to be called by the FiducialManager only.'>            
      <ProtoInterface>
        <field name='pos' type='SFVec3f' accessType='outputOnly' documentation='The position of the fiducial. The z-coordinate is always 0.'/>
        <field name='posScale' type='SFVec3f' accessType='initializeOnly' value='1 1 1' documentation='A fiducials pos is multiplied by this scaling. Default is no scaling (1,1,1).' />
        <field name='angle' type='SFFloat' accessType='outputOnly' documentation='The angle of the fiducial (currently in the interval 0-1).' />
        <field name='index' type='SFInt32' accessType='initializeOnly' value='0' documentation='The unique index of the fiducial.'/>
        <field name='visible' type='SFBool' accessType='outputOnly' documentation='True when the fiducial is visible, False if not.'/>
        <field name='added' type='SFTime' accessType='outputOnly' documentation='Send when the fiducial was added (became visible to the camera).'/>
        <field name='deleted' type='SFTime' accessType='outputOnly' documentation='Send when the fiducial was deleted (is no longer visible to the camera).'/>  
        
        <!-- The following fields are used by the FiducialManager -->
        <field name='set_xpos' type='SFFloat' accessType='inputOnly' documentation='Changes the x-coordinate and triggers an event on the "pos" output. This is supposed to be called by the FiducialManager.' />
        <field name='set_ypos' type='SFFloat' accessType='inputOnly' documentation='Changes the y-coordinate and triggers an event on the "pos" output. This is supposed to be called by the FiducialManager.'/>
        <field name='set_angle' type='SFFloat' accessType='inputOnly' documentation='Changes the angle and triggers an event on the angle output. This is supposed to be called by the FiducialManager. Setting this input will trigger an event on the "angle" output.'/>  
        <field name='add' type='SFTime' accessType='inputOnly' documentation='This is supposed to be called by the FiducialManager. Setting this input will trigger events on the "added" and "visible" output fields.' />  
        <field name='delete_' type='SFTime' accessType='inputOnly' documentation='This is supposed to be called by the FiducialManager. The postfix underscore is used to prevent JavaScript errors (delete is a JavaScript keyword). Setting this input will trigger events on the "deleted" and "visible" output fields.' />  
      </ProtoInterface>
      <ProtoBody>
        <Script DEF='s' directOutput='true' mustEvaluate='true'>
          <field name='pos' type='SFVec3f' accessType='outputOnly' />
          <field name='posScale' type='SFVec3f' accessType='initializeOnly' value='1 1 1' />
          <field name='angle' type='SFFloat' accessType='outputOnly' />
          <field name='index' type='SFInt32' accessType='initializeOnly' value='0' />
          <field name='visible' type='SFBool' accessType='outputOnly' />
          <field name='added' type='SFTime' accessType='outputOnly' />
          <field name='deleted' type='SFTime' accessType='outputOnly' />        
          <field name='set_xpos' type='SFFloat' accessType='inputOnly' />
          <field name='set_ypos' type='SFFloat' accessType='inputOnly' /> 
          <field name='set_angle' type='SFFloat' accessType='inputOnly' />  
          <field name='add' type='SFTime' accessType='inputOnly' />  
          <field name='delete_' type='SFTime' accessType='inputOnly' />  
          <IS>
            <connect protoField='pos' nodeField='pos' />
            <connect protoField='posScale' nodeField='posScale' />
            <connect protoField='angle' nodeField='angle' />
            <connect protoField='index' nodeField='index' />
            <connect protoField='visible' nodeField='visible' />
            <connect protoField='added' nodeField='added' />
            <connect protoField='deleted' nodeField='deleted' />
            <connect protoField='set_xpos' nodeField='set_xpos' />
            <connect protoField='set_ypos' nodeField='set_ypos' />
            <connect protoField='set_angle' nodeField='set_angle' />
            <connect protoField='add' nodeField='add' />
            <connect protoField='delete_' nodeField='delete_' />
          </IS>
          <![CDATA[
              ecmascript:
              
              function initialize() { pos[2] = 0.0; }                                                  
              function set_xpos(val) { pos[0] = val * posScale[0]; }                
              function set_ypos(val) { pos[1] = val * posScale[1]; }                
              function set_angle(val) { angle = val; }                
              
              function add(t) {
                  println("Fiducial::add: t=" + t);
                  if(!visible) {                    
                    added = t;
                    visible = true;
                  }
              }
              
              /* The postfix underscore is used to prevent a name clash with 
                 the JavaScript keyword "delete". */
              function delete_(t) {
                  if(visible) {
                    deleted = t;
                    visible = false;
                  }
              }
          ]]>                    
            
        </Script>
      </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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?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'>
  
  <Engine desiredFrameRate='60' > 
    <RenderJob>
      <WindowGroup>
        <Window size='960 440' />
      </WindowGroup>
    </RenderJob>
  </Engine>

  <Scene DEF='scene'>
    
    <ExternProtoDeclare name='Fiducial' url='FiducialManager_PROTO.x3d#Fiducial' />  
    <ExternProtoDeclare name='FiducialManager' url='FiducialManager_PROTO.x3d#FiducialManager' />         
    
    <DirectionalLight DEF='light' />
    <NavigationInfo type='none' headlight='false' />
    <OrthoViewpoint position='0 0 20' fieldOfView='-4.5 -4.5 4.5 4.5' />
    <GradientBackground color='0 0 0, 0.2 0.2 0.2 ' position='0.7 1'/>    
    
    <FiducialManager DEF='fiducialManager' >
        <Fiducial DEF='fiducial0' index='0' posScale='10 8' containerField='fiducials' />
        <Fiducial DEF='fiducial1' index='1' posScale='10 8' containerField='fiducials' />
        <Fiducial DEF='fiducial2' index='2' containerField='fiducials' />
        <Fiducial DEF='fiducial3' index='3' containerField='fiducials' />      
    </FiducialManager>   
    
    <Transform translation='0 -0.5 0' >
      <Transform translation='-7.7 4 0' scale='0.8 0.8 0.8' >
        <Shape>
          <Text string='reacTIVision in InstantPlayer'>
            <FontStyle family='"Arial" "SANS"' style='bold' />
          </Text>
        </Shape>
      </Transform>        
      
      <Anchor url='http://www.pyjax.net/'>
        <Transform DEF='pyjaxTrans' translation='3.2 4 0' >
          <Shape>
            <Text DEF='pyjaxText' solid='false' string='"Find more X3D tutorials on pyjax.net"'>
              <FontStyle family='"Arial" "SANS"' style='plain' size='0.3' />
            </Text>
            <Appearance><Material /></Appearance>
          </Shape>
        </Transform>
      </Anchor>
          
    </Transform>      
      
    <Transform DEF='tr' translation='-4 -4 0' >
      <Transform DEF='transObj0' translation='-4.5 0 0' >
          <Shape containerField='children'>
            <Appearance>
              <Material diffuseColor='0 1 0' />
              <TextTexture string='F1' />
            </Appearance>
            <Plane solid='false' />
          </Shape>
      </Transform>
      <Transform DEF='transObj1'>        
        <Shape containerField='children'>
          <Appearance>
            <Material diffuseColor='0 0 1' transparency='0' />
            <TextTexture string='F2' />
          </Appearance>
          <Plane solid='false' />
        </Shape>  
      </Transform >      
    </Transform>
    
    <TimeSensor DEF='ts' cycleInterval='10' loop='true'/>
        
    <Logger DEF='logger' level='3' />
    <ROUTE fromNode='fiducial0' fromField='visible' toNode='transObj0' toField='render'/>
        
    <PositionChaser DEF='posChaser0' duration='0.5' />
    <ROUTE fromNode='fiducial0' fromField='pos' toNode='posChaser0' toField='set_destination'/>    
    <ROUTE fromNode='posChaser0' fromField='value_changed' toNode='transObj0' toField='translation'/>    
    
    <OrientationInterpolator DEF='oi2' key='0 0.25 0.5 0.75 1' keyValue='0 0 1 0  0 0 1 1.57  0 0 1 3.14  0 0 1 4.71  0 0 1 6.28'/>
    <OrientationChaser DEF='oc2' duration='0.5' />
    <ROUTE fromNode='fiducial0' fromField='angle' toNode='oi2' toField='set_fraction'/>    
    <ROUTE fromNode='oi2' fromField='value_changed' toNode='oc2' toField='set_destination'/>
    <ROUTE fromNode='oc2' fromField='value_changed' toNode='transObj0' toField='set_rotation'/>
    
    <ROUTE fromNode='fiducial1' fromField='visible' toNode='transObj1' toField='render'/>
    <PositionChaser DEF='posChaser1' duration='0.5' />
    <ROUTE fromNode='fiducial1' fromField='pos' toNode='posChaser1' toField='set_destination'/>    
    <ROUTE fromNode='posChaser1' fromField='value_changed' toNode='transObj1' toField='translation'/>    
            
  </Scene>
</X3D>

Comments

Lee Rhodes said on August 18, 2008

phase quarantine opinionatedly gibberella zaffar sweethearting comitia consultory
http://www.seasonsandamuse.com >seasons & a muse
http://www.highlandparkdentalcare.com
http://www.bmbl.net >Bedford Men’s Basketball League
http://www.co.hardin.tx.us/ips/cms/co…
http://www.idobridal.com/ >IdoBridal
http://cnn.com/ASIANOW/asiaweek/96/08…
http://www.topix.com/city/constablevi… >Constableville Local News: Topix
http://www.colintoke.com/

Add a comment