5 |
Vobs are the basis of Gzz's graphics system. As discussed elsewhere(XXX) |
Vobs are the basis of Gzz's graphics system. As discussed elsewhere(XXX) |
6 |
they enable keyframe interpolation between unrelated views by associating |
they enable keyframe interpolation between unrelated views by associating |
7 |
keys from the structure with the elements of the scene. |
keys from the structure with the elements of the scene. |
8 |
|
|
9 |
The fundamental object diagram is shown below. The "pseudoclass" stereotype |
The following diagram shows the logical structure of the Vob system; we'll |
10 |
means that if we were using a stronger language such as C++ where making |
go into the implementation details later. |
|
the CoordinateSystem its own class in a template wouldn't cost us, we would. |
|
|
However, in the Java implementation, CoordinateSystems are represented by |
|
|
arrays inside the VobScene. |
|
11 |
|
|
12 |
.. UML:: vobs_overall |
.. UML:: vobs_overall |
13 |
|
|
14 |
class Vob "interface" |
class Vob "interface" |
15 |
methods |
methods |
16 |
draw |
draw |
17 |
|
assoc multi(*) - multi(*) role(coordinates) CoordSys |
18 |
|
|
19 |
class CoordSys "interface" |
class CoordSys "interface" |
20 |
methods |
methods |
21 |
|
|
22 |
transassoc = assoc CoordSys role(transformparent) multi(*) - multi(*) role(transchild) CoordSys |
transassoc = assoc CoordSys role(transformparent) multi(*) - multi(*) role(transchild) CoordSys |
23 |
matchassoc = assoc CoordSys role(matchparent) multi(1) - multi(*) role(matchchild) CoordSys |
matchassoc = assoc CoordSys aggreg role(matchparent) multi(1) - multi(*) role(matchchild) CoordSys |
24 |
|
|
25 |
class AnyObject |
class AnyObject |
26 |
assoc multi(1) role(coordsyskey) - multi(*) CoordSys |
assoc multi(1) role(coordsyskey) - multi(*) CoordSys |
27 |
|
|
28 |
--- |
--- |
29 |
|
|
30 |
|
Vob.c = (0,0); |
31 |
|
|
32 |
|
CoordSys.c = (150,0); |
33 |
|
AnyObject.c = (150,-100); |
34 |
|
|
35 |
|
pair p,pu,pl; |
36 |
|
p := CoordSys.e; |
37 |
|
pu := CoordSys.ne; |
38 |
|
pl := CoordSys.se; |
39 |
|
|
40 |
|
transassoc.p = .85[pu,pl]{right} .. p+(40,0){up} .. .15[pu,pl]{left}; |
41 |
|
|
42 |
|
pair m, mu, ml; |
43 |
|
m := CoordSys.n; |
44 |
|
mu := CoordSys.nw; |
45 |
|
ml := CoordSys.ne; |
46 |
|
matchassoc.p = .1[mu,ml]{up} .. m+(0,40){right} .. .9[mu,ml]{down}; |
47 |
|
|
48 |
|
As seen in the diagram, the Coordinate systems form two intertwined structures: |
49 |
|
a DAG of transform parents and a tree of match parents. See the ``VobScene`` javadoc |
50 |
|
for details. |
51 |
|
|
52 |
|
|
53 |
|
In the Java implementation, CoordinateSystems are represented by |
54 |
|
integer indices to various arrays, due to efficiency reasons. |
55 |
|
If we were using a stronger language such as C++ where making |
56 |
|
the CoordinateSystem its own class in a template wouldn't cost us, we certainly |
57 |
|
would do so. |
58 |
|
|
59 |
|
The class diagram of VobScene and related classes is shown below. |
60 |
|
The "pseudoclass" stereotype refers to the above array implementation of the |
61 |
|
coordsys "class"es. |
62 |
|
|
63 |
.. UML:: vobscene_overall |
.. UML:: vobscene_overall |
64 |
|
|
75 |
|
|
76 |
class VobMap "interface" |
class VobMap "interface" |
77 |
jlink |
jlink |
78 |
assoc aggreg multi(1) - multi(*) Vob |
assoc aggreg multi(*) - multi(*) Vob |
79 |
methods |
methods |
80 |
Vob getVobByCS(int coordsys) |
Vob getVobByCS(int coordsys) |
81 |
void put(Vob) |
void put(Vob) |
85 |
|
|
86 |
class VobCoorder "interface" |
class VobCoorder "interface" |
87 |
jlink |
jlink |
88 |
assoc compos - multi(*) CoordinateSystem |
assoc compos - multi(*) CoordSys |
89 |
methods |
methods |
90 |
int ortho(int parent, float depth, x, y, w, h) |
int ortho(int parent, float depth, x, y, w, h) |
91 |
int scale(int parent, float sx, sy) |
int scale(int parent, float sx, sy) |
110 |
int addToListGL(...) |
int addToListGL(...) |
111 |
boolean intersect(int x, int y, RenderInfo info1, info2) |
boolean intersect(int x, int y, RenderInfo info1, info2) |
112 |
|
|
113 |
class CoordinateSystem "pseudoclass" |
class CoordSys "pseudoclass" |
114 |
assoc multi(*) - multi(1) role(key) java.lang.Object |
assoc multi(*) - multi(1) role(key) java.lang.Object |
115 |
assoc multi(0..2{ordered}) - multi(*) Vob |
assoc multi(*) - multi(*) Vob |
116 |
|
|
117 |
class java.lang.Object |
class java.lang.Object |
118 |
methods |
methods |
119 |
int hashCode() |
int hashCode() |
120 |
boolean equals(Object o) |
boolean equals(Object o) |
121 |
|
|
122 |
hierarch = assoc CoordinateSystem aggreg multi(0..1) role(parent) - multi(*) role(child) CoordinateSystem |
transassoc = assoc CoordSys role(transformparent) multi(*) - multi(*) role(transchild) CoordSys |
123 |
|
matchassoc = assoc CoordSys aggreg role(matchparent) multi(1) - multi(*) role(matchchild) CoordSys |
124 |
|
|
125 |
|
|
126 |
--- |
--- |
127 |
VobScene.c = (0,0); |
VobScene.c = (0,0); |
128 |
|
|
129 |
horizontally(20, ooo, VobMap, VobCoorder, VobMatcher); |
horizontally(20, ooo, VobMap, VobCoorder, VobMatcher); |
130 |
Vob.c = (xpart VobMap.c, ypart CoordinateSystem.c); |
Vob.c = (xpart VobMap.c, ypart CoordSys.c); |
131 |
|
|
132 |
vertically(60, xxx, VobCoorder, CoordinateSystem, java.lang.Object); |
vertically(60, xxx, VobCoorder, CoordSys, java.lang.Object); |
133 |
|
|
134 |
VobCoorder.n = VobScene.s + (0,-50); |
VobCoorder.n = VobScene.s + (0,-50); |
135 |
|
|
136 |
pair mn,ms; |
pair p,pu,pl; |
137 |
mn := CoordinateSystem.ne; |
p := CoordSys.e; |
138 |
ms := CoordinateSystem.se; |
pu := CoordSys.ne; |
139 |
|
pl := CoordSys.se; |
140 |
hierarch.p = (0.2[mn,ms] {1,1} .. 0.5[mn,ms]+(60,0) .. 0.8[mn,ms]{-1,1}); |
|
141 |
|
transassoc.p = .85[pu,pl]{right} .. p+(40,0){up} .. .15[pu,pl]{left}; |
142 |
draw VobMap.c -- 0.7[Vob.c, CoordinateSystem.c] dashed evenly; |
|
143 |
draw VobMatcher.c -- 0.6[Vob.c, java.lang.Object.c] dashed evenly; |
pair m, mu, ml; |
144 |
|
m := CoordSys.n; |
145 |
|
mu := CoordSys.nw; |
146 |
|
ml := CoordSys.ne; |
147 |
|
matchassoc.p = .1[mu,ml]{up} .. m+(0,40){right} .. .9[mu,ml]{down}; |
148 |
|
|
149 |
|
% association minders |
150 |
|
draw VobMap.c -- 0.7[Vob.c, CoordSys.c] dashed evenly; |
151 |
|
draw VobCoorder.c -- point .5 of transassoc.p dashed evenly; |
152 |
|
draw VobMatcher.c -- 0.6[CoordSys.c, java.lang.Object.c] dashed evenly; |
153 |
|
draw VobMatcher.c -- point .5 of matchassoc.p dashed evenly; |
154 |
|
|
155 |
The construction of a VobScene goes as follows: |
The construction of a VobScene goes as follows: |
156 |
|
|