~holger-seelig/titania-library/trunk

« back to all changes in this revision

Viewing changes to Tests/Components/Scripting/rotation.x3dv

  • Committer: Holger Seelig
  • Date: 2017-09-18 02:55:31 UTC
  • Revision ID: holger.seelig@yahoo.de-20170918025531-n60g34kd9bfs41t1
Updated prototypes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#X3D V3.3 utf8 Titania V1.4.5
 
2
 
 
3
META "comment" "World of Titania"
 
4
META "created" "Sun, 10 Jan 2016 23:26:54 GMT"
 
5
META "creator" "Holger Seelig"
 
6
META "generator" "Titania V1.4.5, http://titania.create3000.de"
 
7
META "identifier" "file:///home/holger/Projekte/Cobweb/excite/tests/Components/Scripting/rotation.x3dv"
 
8
META "modified" "Mon, 13 Jun 2016 12:30:29 GMT"
 
9
 
 
10
WorldInfo {
 
11
  metadata DEF Titania MetadataSet {
 
12
    name "Titania"
 
13
    reference "http://titania.create3000.de"
 
14
    value [
 
15
      DEF NavigationInfo MetadataSet {
 
16
        name "NavigationInfo"
 
17
        reference "http://titania.create3000.de"
 
18
        value DEF type MetadataString {
 
19
          name "type"
 
20
          reference "http://titania.create3000.de"
 
21
          value "EXAMINE"
 
22
        }
 
23
      }
 
24
      DEF Viewpoint MetadataSet {
 
25
        name "Viewpoint"
 
26
        reference "http://titania.create3000.de"
 
27
        value [
 
28
          DEF position MetadataDouble {
 
29
            name "position"
 
30
            reference "http://titania.create3000.de"
 
31
            value [
 
32
              0,
 
33
              0,
 
34
              10
 
35
            ]
 
36
          }
 
37
          DEF orientation MetadataDouble {
 
38
            name "orientation"
 
39
            reference "http://titania.create3000.de"
 
40
            value [
 
41
              0,
 
42
              0,
 
43
              1,
 
44
              0
 
45
            ]
 
46
          }
 
47
          DEF centerOfRotation MetadataDouble {
 
48
            name "centerOfRotation"
 
49
            reference "http://titania.create3000.de"
 
50
            value [
 
51
              0,
 
52
              0,
 
53
              0
 
54
            ]
 
55
          }
 
56
        ]
 
57
      }
 
58
      DEF Selection MetadataSet {
 
59
        name "Selection"
 
60
        reference "http://titania.create3000.de"
 
61
        value DEF previous MetadataSet {
 
62
          name "previous"
 
63
          reference "http://titania.create3000.de"
 
64
        }
 
65
      }
 
66
    ]
 
67
  }
 
68
}
 
69
 
 
70
DEF NewScript Script {
 
71
  url "ecmascript:
 
72
 
 
73
function initialize ()
 
74
{
 
75
        var a = new SFRotation (new SFVec3f (1,2,3), 4);
 
76
        var b = new SFRotation (2,3,4, 5);
 
77
 
 
78
        print (\"a:     \", a);
 
79
        print (\"b:     \", b);
 
80
        print (\"a * b: \", a .multiply (b));
 
81
        print (\"b * a: \", b .multiply (a));
 
82
 
 
83
        //a:     0.26726124191242434 0.5345224838248487 0.8017837257372732 4
 
84
        //b:     0.3713906763541037 0.5570860145311556 0.7427813527082074 5
 
85
        //a * b: -0.26592817455420725 -0.5950036244205548 -0.7584542787173597 3.558116575687694
 
86
        //b * a: -0.3211364397440548 -0.4845870940408597 -0.8136625439072073 3.558116575687694
 
87
 
 
88
        var m = new SFMatrix3f ();
 
89
        
 
90
        m .setTransform (new SFVec2f (1, 2),
 
91
                         Math .PI,
 
92
                         new SFVec2f (2, 3),
 
93
                         Math .PI);
 
94
 
 
95
        print (\"identity: \",  m);
 
96
        print (\"transpose: \", m .transpose ());
 
97
        print (\"inverse: \",   m .inverse ());
 
98
        
 
99
        var
 
100
                t  = new SFVec2f (),
 
101
                r  = new SFVec3f (),
 
102
                s  = new SFVec2f (),
 
103
                so = new SFVec3f ();
 
104
 
 
105
        m .getTransform (t, r, s, so);
 
106
        
 
107
        print (\"translation: \", t);
 
108
        print (\"rotation: \",r);
 
109
        print (\"scale: \",s);
 
110
        print (\"scaleOritation: \",so);
 
111
}"
 
112
}