-+-+-+-+-+-+-+-+ START OF PART 12 -+-+-+-+-+-+-+-+ Xy(scale.z)g(=)f(\(zmax-zmin\))i(/)f(\(zmax-zmin\);)72 1004 Xy(shift2)g(=)f(ptk_point3\(-xmin,)j(-ymin,)e(-zmin\);)72 1103 Xy(ptk_shift3\(&shift1,)i(PREPLACE,)f(matrix\);)72 1153 y(ptk_scale3\(&scale, V) Xh(PPRECONCATENATE,)g(matrix\);)72 1203 y(ptk_shift3\(&shift2,)g X(PPOSTCONCATENATE,)g(matrix\);)0 1349 y Fq(The)12 b(resulting)e(matrix)g(can V) Xj(be)e(used)h(to)e(transform)h(the)g(point)f(\(X,Y)-5 b(,Z\))12 Xb(onto)e(\(U,V)-5 b(,N\))11 b(as)h(follows:)108 1445 y Fi(Ppoint3)37 Xb(x,)19 b(u;)108 1545 y(x)f(=)g(ptk_transform3\(mat)q(rix,)j(&u\);)0 X1641 y Fq(This)13 b(function)e(is)i(available)g(as)g(a)h(single)e(function)f X(call,)j(the)f Fi(boolean)h Fq(value)f(indicates)f(whether)h(or)g(not)f(to)g X(preserve)h(the)0 1691 y(aspect)f(ratio)f(of)g(the)g(window)f(in)h(the)g X(mapping.)108 1792 y Fi(Plimit3)19 b(window,)h(viewport;)108 X1842 y(boolean)f(pres;)108 1941 y(window)g(=)f(ptk_limit3\(xmin,)j(ymin,)e X(zmin,)g(xmax,)g(ymax,)g(zmax\);)108 1991 y(viewport)g(=)g(ptk_limit3\(umin, V) Xh(vmin,)f(nmin,)g(umax,)g(vmax,)g(nmax\);)108 2041 y(pres)g(=)f(FALSE;)108 X2140 y(ptk_box3tobox3\(&xlow)q(,)j(&ulow,)e(pres,)g(PREPLACE,)g(matrix,)g X(&err\);)0 2242 y Fq(T)m(able)12 b(4.1)f(shows)h(examples)g(of)f(the)g X(matrices)h(used)f(for)g(each)i(type)e(of)g(transformation.)0 X2404 y Fr(4.2)59 b(The)17 b(HashStrings)f(Library)0 2523 y XFq(This)e(tool,)f(enables)h(application)f(programmers)h(to)f(use)h(character V) Xh(strings)d(for)i(naming)f(PHIGS)h(entities,)f(such)h(as)h(struc-)0 X2573 y(tures)f(and)g(labels,)h(which)e(are)i(de\256ned)f(by)g(the)g(PHIGS)g X(Standard)f(`5B2`5D)h(to)f(be)h(integers.)23 b(It)14 b(is)g(very)f(easy)i(to V)f X(lose)g(track)g(of)0 2623 y(integer)9 b(identi\256ers,)h(and)g(the)g(ability V) Xf(to)g(use)i(character)g(strings)e(makes)i(programming)e(with)g(PHIGS)h X(safer)h(and)f(much)h(more)0 2672 y(convenient.)k(The)d(implementation)e X(details)h(of)g(this)f(tool)g(are)i(described)g(in)e(`5B4`5D.)0 X2748 y(HashStrings)g(provides)h(functions)f(for:)0 2956 y(13th)22 Xb(May)m(,)12 b(1992)636 b(27)839 b(2.01)p eop X%%Page: 28 29 Xbop 0 -137 a Fq(PHIGS)11 b(T)m(oolkit)f(User)i(Manual)1235 Xb(PTK/100)p 344 299 1178 2 v 343 349 2 50 v 741 334 a(Example)12 Xb(matrix)e(values)p 1521 349 V 344 351 1178 2 v 343 680 2 330 Xv 369 385 a(Identity/Unit)e(matrix)p 1058 680 V 1129 429 a XFg(0)1129 502 y(B)1129 527 y(B)1129 553 y(@)1186 462 y Fq(1)42 Xb(0)f(0)g(0)1186 512 y(0)h(1)f(0)g(0)1186 561 y(0)h(0)f(1)g(0)1186 X611 y(0)h(0)f(0)g(1)1415 429 y Fg(1)1415 502 y(C)1415 527 y(C)1415 X553 y(A)p 1521 680 V 344 682 1178 2 v 343 1011 2 330 v 369 X717 a Fq(Shift)369 767 y Fl(\()p Fk(x,)7 b(y)n(,)g(z)p Fl(\))23 Xb Fq(is)f(the)g(vector)f(by)h(which)f(trans-)369 816 y(formed)12 Xb(points)e(are)i(displaced)p 1058 1011 V 1129 760 a Fg(0)1129 X833 y(B)1129 858 y(B)1129 884 y(@)1186 793 y Fq(1)42 b(0)f(0)h XFk(x)1186 843 y Fq(0)g(1)f(0)h Fk(y)1186 893 y Fq(0)g(0)f(1)i XFk(z)1186 943 y Fq(0)f(0)f(0)g(1)1415 760 y Fg(1)1415 833 y(C)1415 X858 y(C)1415 884 y(A)p 1521 1011 V 344 1013 1178 2 v 343 1343 X2 330 v 369 1048 a Fq(Shear)n(.)369 1098 y(E.g.,)21 b(for)d XFl(\246)c(\271)h Fq(0,)20 b Fk(y)e Fq(coordinates)g(are)g(dis-)369 X1148 y(placed)11 b(by)f(an)h(amount)f(proportional)d(to)j(the)369 X1197 y(corresponding)g Fk(z)i Fq(coordinate.)p 1058 1343 V X1129 1091 a Fg(0)1129 1164 y(B)1129 1189 y(B)1129 1216 y(@)1186 X1124 y Fq(1)42 b(0)f(0)g(0)1186 1174 y(0)h(1)f Fl(\246)g Fq(0)1186 X1224 y(0)h(0)f(1)g(0)1186 1274 y(0)h(0)f(0)g(1)1415 1091 y XFg(1)1415 1164 y(C)1415 1189 y(C)1415 1216 y(A)p 1521 1343 XV 344 1344 1178 2 v 343 1674 2 330 v 369 1379 a Fq(Scale)369 X1429 y Fk(x)p Fq(,)12 b Fk(y)p Fq(,)f(and)f Fk(z)g Fq(are)g(the)g(scale)h X(factors)f(along)f(the)369 1479 y Fk(x)p Fq(,)k Fk(y)f Fq(and)f XFk(z)h Fq(axes)g(respectively)p 1058 1674 V 1129 1422 a Fg(0)1129 X1495 y(B)1129 1520 y(B)1129 1547 y(@)1187 1456 y Fk(x)44 b XFq(0)d(0)g(0)1186 1505 y(0)i Fk(y)g Fq(0)e(0)1186 1555 y(0)h(0)h XFk(z)h Fq(0)1186 1605 y(0)e(0)f(0)g(1)1415 1422 y Fg(1)1415 X1495 y(C)1415 1520 y(C)1415 1547 y(A)p 1521 1674 V 344 1676 X1178 2 v 343 2005 2 330 v 369 1711 a Fq(Rotate.)369 1760 y(E.g.,)12 Xb(for)e(a)h(rotation)e(of)h Fd(q)k Fq(about)9 b(the)i Fk(z)f XFq(axis,)369 1810 y(let)h Fk(c)h Fq(=)g(cos)7 b Fd(q)15 b Fq(and)c XFk(s)h Fq(=)g(sin)6 b Fd(q)p 1058 2005 V 1120 1754 a Fg(0)1120 X1827 y(B)1120 1852 y(B)1120 1878 y(@)1178 1787 y Fk(c)43 b XFl(-)p Fk(s)f Fq(0)f(0)1180 1837 y Fk(s)54 b(c)e Fq(0)41 b(0)1177 X1887 y(0)51 b(0)f(1)41 b(0)1177 1936 y(0)51 b(0)f(0)41 b(1)1424 X1754 y Fg(1)1424 1827 y(C)1424 1852 y(C)1424 1878 y(A)p 1521 X2005 V 344 2007 1178 2 v 343 2337 2 330 v 369 2042 a Fq(Perspective.)369 X2092 y(E.g.,)30 b(a)25 b(three-point)e(perspective)i(trans-)369 X2141 y(formation)h(which)g(maps)h(points)f(at)g(in-)369 2191 Xy(\256nity)f(on)h(the)g Fk(x)p Fq(,)31 b Fk(y)26 b Fq(and)g XFk(z)h Fq(axes)g(onto)369 2241 y(the)j(points)f Fl(\()p Fq(1/)q XFk(p,)7 b Fq(0)p Fk(,)g Fq(0)p Fl(\))p Fq(,)34 b Fl(\()p Fq(0)p XFk(,)7 b Fq(1/)q Fk(q,)g Fq(0)p Fl(\))30 b Fq(and)369 2291 Xy Fl(\()p Fq(0)p Fk(,)7 b Fq(0)p Fk(,)g Fq(1/)q Fk(r)p Fl(\))k XFq(respectively)m(.)p 1058 2337 V 1129 2085 a Fg(0)1129 2158 Xy(B)1129 2183 y(B)1129 2209 y(@)1186 2118 y Fq(1)42 b(0)f(0)g(0)1186 X2168 y(0)h(1)f(0)g(0)1186 2218 y(0)h(0)f(1)g(0)1186 2268 y XFk(p)h(q)h(r)h Fq(1)1415 2085 y Fg(1)1415 2158 y(C)1415 2183 Xy(C)1415 2209 y(A)p 1521 2337 V 344 2338 1178 2 v 559 2454 Xa Fq(T)m(able)12 b(4.1:)j(Example)d(transformation)e(matrices.)0 X2956 y(13th)22 b(May)m(,)12 b(1992)636 b(28)839 b(2.01)p eop X%%Page: 29 30 Xbop 0 -137 a Fq(PHIGS)11 b(T)m(oolkit)f(User)i(Manual)1235 Xb(PTK/100)64 8 y Fl(\267)21 b Fq(Hashing)11 b(a)g(string)f(to)h(a)h(unique)e X(integer)h(using)f(a)i(hashtable.)64 91 y Fl(\267)21 b Fq(Retrieving)9 Xb(the)j(original)d(string)h(corresponding)g(to)h(an)g(integer)g(hash)h X(value.)64 174 y Fl(\267)21 b Fq(Maintaining)9 b(several)j(separate)h X(hashtables.)64 257 y Fl(\267)21 b Fq(Storing)9 b(and)j(restoring)e X(hashtables)h(to)g(\256les.)0 405 y Fu(4.2.1)50 b(Using)14 Xb(HashStrings)0 512 y Fq(HashStrings)c(provides)g(a)i(mechanism)g(for)e X(creating)h(unique)f(mappings)h(between)g(character)h(strings)e(and)h X(integers)g(using)f(a)0 562 y(simple)h(hashing)e(mechanism.)17 Xb(Mappings)10 b(are)h(grouped)f(in)g(logically)f(distinct)g XFk(tables)p Fq(,)i(such)g(that)f(all)g(the)h(mappings)f(within)0 X611 y(one)h(table)g(will)f(be)i(unique.)j(The)d(fundamental)f(function)e(for V) Xi(converting)f(a)i(string)e(to)h(an)g(integer)g(is)g Fi(ptk_stringtoint)p XFq(:)54 732 y Fi(Pint)19 b(ptk_stringtoint\(Pchar)i(*table,)f(Pchar)e X(*string\))0 852 y Fq(This)12 b(routine)e(takes)i(the)g(string)e XFi(string)p Fq(,)j(and)f(uses)h(the)e(hashtable)h Fi(table)g XFq(to)f(derive)h(an)g(integer)n(.)k(Before)c(a)g(hashtable)g(can)0 X902 y(be)g(used)f(in)g(this)f(way)m(,)i(the)g(table)f(must)g(\256rst)g(be)g XFk(cr)n(eated)p Fq(,)i(and)f(it)e(is)h(the)g(responsibility)e(of)i(the)g X(application)f(to)h(do)f(this.)0 981 y(T)m(o)i(illustrate,)e(consider)h(the) Vg X(use)h(of)f(two)f(structures)h(used)h(to)e(model)i(a)f(helicopter)n(.)k(The) Vd X(usual)f(C)g(approach)g(might)g(be:)54 1101 y Fi(#define)19 Xb(HELICOPTER)h(1)54 1151 y(#define)f(BLADE)g(2)54 1251 y X(popenstruct\(HELICOPTE)q(R\);)54 1300 y(pexecutestruct\(BLADE\))q(;)54 X1350 y(pclosestruct\(\);)0 1471 y Fq(with)8 b(HashStrings,)h(the)f X(application)g(can)h(use)h(genuine)e(character)i(strings,)f(with)f(the)g X(associated)i(advantages)f(of)g(readability)m(,)0 1520 y(composition)i(and)i X(parsing.)19 b(There)13 b(is)f(some)i(red)f(tape:)k(\256rst,)c(the)g X(hashtable)f(mechanism)i(must)f(be)f(initialised,)g(using)f(the)0 X1570 y(function)i Fi(ptk_inithashtables)p Fq(.)29 b(Next)14 Xb(we)h(must)g(create)g(a)g(hashtable)g(to)f(hold)f(the)i(names.)26 Xb(This)15 b(is)f(done)h(using)e(the)0 1620 y Fi(ptk_createhashtable)k XFq(function,)12 b(which)h(takes)h(as)f(parameters)i(the)e(name)h(by)f(which) Vg X(the)g(table)g(is)g(to)g(be)g(known,)g(and)0 1670 y(two)d(integers)f(which)h X(specify)g(the)h(range)f(of)g(integer)g(hash)g(values)h(which)e(the)h X(hashing)g(mechanism)h(will)e(use)i(for)f(this)f(table.)0 1720 Xy(Whenever)j(the)f(table)g(is)g(used)h(for)f(hashing,)g(the)g(values)g X(returned)g(will)f(always)i(be)f(in)g(this)f(range.)54 1840 Xy Fi(ptk_inithashtables\(\);)54 1890 y(ptk_createhashtable\(")q(struct)q X(ureid)q(",)21 b(100,)e(200\);)0 2010 y Fq(Note)10 b(that)g(it)f(is)h(normal V) Xg(to)f(call)i Fi(ptk_inithashtables)i Fq(only)c(once)i(in)e(an)i(application V) Xe(program,)h(normally)f(at)i(the)f(start)g(of)0 2060 y(the)h(program.)k X(Similarly)m(,)10 b Fi(ptk_createhashtable)k Fq(will)c(be)h(called)g(once)g X(for)f(each)i(hashtable)f(the)g(application)e(wishes)i(to)0 X2110 y(use)h(\(see)g(Section)f(4.2.2\).)0 2189 y(Now)f(we)h(can)g(use)g(this V) Xe(table)h(in)g(conjunction)f(with)g(the)h Fi(ptk_stringtoint)j XFq(function,)c(using)h(the)g(integer)g(returned)f(by)h(the)0 X2239 y(function)g(as)i(a)g(PHIGS)f(structure)g(identi\256er)n(,)g(as)h X(follows:)54 2359 y Fi(popenstruct\(ptk_strin)q(gtoint)q(\("str)q(ucture)q X(id",)21 b("helicopter"\)\);)54 2409 y(pexecutestruct\(ptk_st)q(ringto)q X(int\(")q(struct)q(ureid")q(,)g("blade"\)\);)54 2459 y(pclosestruct\(\);)0 X2956 y Fq(13th)h(May)m(,)12 b(1992)636 b(29)839 b(2.01)p eop X%%Page: 30 31 Xbop 0 -137 a Fq(PHIGS)11 b(T)m(oolkit)f(User)i(Manual)1235 Xb(PTK/100)0 8 y Fu(4.2.2)50 b(Standard)12 b(hashtables)0 113 Xy Fq(HashStrings)c(enables)i(the)e(application)g(to)g(use)i(a)f(number)g(of) Vg X(dif)o(ferent)f(hashtables)h(simultaneously)m(,)g(and)g(it)f(is)h X(conventional)0 163 y(to)i(use)g(one)h(table)f(for)g(structure)f(names,)j X(another)e(for)g(label)g(identi\256er)f(names,)j(and)f(so)f(on.)0 X239 y(HashStrings)i(is)g(fundamental)h(to)f(the)g(PHIGS)h(T)m(oolkit,)f(and) Vh X(many)g(T)m(oolkit)e(modules)i(assume)h(that)e(the)g(application)g(has)0 X289 y(created)e(several)f(hashtables)g(for)g(storing)e(names)j(for)f X(structures,)g(views,)g(colours)g(and)g(so)f(on.)15 b(The)c(naming)e X(convention)g(for)0 339 y(these)j(tables)f(is)g(as)h(follows:)p X564 402 739 2 v 563 452 2 50 v 589 437 a Fp(Use)g(of)f(hashtable)p X920 452 V 63 w(Name)g(of)g(hashtable)p 1301 452 V 564 453 739 X2 v 564 463 V 563 513 2 50 v 589 498 a Fq(structure)g(identi\256er)p X920 513 V 48 w("structureid")p 1301 513 V 563 563 V 589 548 Xa(view)g(index)p 920 563 V 171 w("viewindex")p 1301 563 V 563 X613 V 589 598 a(label)p 920 613 V 275 w("label")p 1301 613 XV 563 663 V 589 648 a(pick)g(identi\256er)p 920 663 V 122 w("pickid")p X1301 663 V 563 712 V 589 697 a(colour)f(index)p 920 712 V 146 Xw("colourindex")p 1301 712 V 564 714 739 2 v 0 804 a(It)j(is)g(important)f X(to)g(use)i(these)g(hashtables,)g(and)g(we)f(recommend)i(you)e(create)h(each V) Xh(of)e(these)g(tables)h(at)f(the)g(beginning)f(of)0 853 y(every)g(program)f X(which)g(uses)g(the)h(PHIGS)f(T)m(oolkit.)0 997 y Fu(4.2.3)50 Xb(Important:)18 b(about)12 b(not)h(using)g(HashStrings)0 1101 Xy Fq(Several)g(of)e(the)h(PHIGS)g(T)m(oolkit)f(modules)g(are)i(dependent)f X(on)f(the)h(standard)g(hashtables.)17 b(If)12 b(the)g(required)f(hashtables) Vh X(are)0 1151 y(not)g(set)g(up)g(then)g(the)h(functions)e Fp(will)g(not)h(work V) Xp Fq(.)20 b(It)11 b(is)i(still)e(possible)g(to)h(use)h(some)g(of)f(the)h X(functions)e(without)f(hashtables)0 1201 y(and)g(these)h(are)g(usually)e X(lower)h(level)g(functions.)k(Modules)c(which)f(still)g(work)h(without)e X(hashtables)i(are)h(the)f(PHIGS)h(utilities)0 1250 y(library)m(,)g(the)g X(colour)f(library)m(,)h(the)g(TSL)i(library)m(,)d(the)h(structure)g(content) Vg X(drawer)g(and)h(Phinter)n(.)0 1327 y(If)f(you)f(already)h(have)g(a)h(program V) Xe(which)h(uses)g(certain)g(structure)f(identi\256ers)g(but)g(you)h(still)e X(want)i(to)f(use)h(the)g(debugger)f(and)0 1377 y(other)i(tools)f(then)h(it)g X(is)g(only)g(necessary)i(to)e(create)h(the)g Fi("structureid")h XFq(hashtable)f(with)e(bounds)h(that)g(will)f(not)h(interfere)0 X1427 y(with)e(your)h(own)g(structures.)k(The)d(PHIGS)g(T)m(oolkit)d(will)i X(use)g(structure)g(identi\256ers)g(between)h(these)f(bounds)g(but)f(no)h X(others.)0 1476 y(This)g(applies)g(to)g(other)g(hashtables)g(such)h(as)g XFi("colourindex")h Fq(and)f Fi("viewindex")p Fq(.)0 1641 y XFr(4.3)59 b(The)17 b(PHIGS)e(Utilities)g(Library)0 1760 y Fq(The)e(PHIGS)f X(Utilities)e(Library)h(provides)g(functions)g(for)g(assisting)h(the)f X(applications)g(programmer)h(in)g(a)g(variety)g(of)f(ways.)0 X1810 y(Many)f(of)f(the)h(utility)d(functions)i(`60bundle)g(up')g(commonly)h X(used)g(sequences)h(of)f(primitive)e(PHIGS)i(instructions)e(into)g(simple)0 X1860 y(`60macros'.)16 b(Often)11 b(these)h(are)g(to)f(provide)f(basic)i X(services)g(which)f(PHIGS)g(itself)f(does)i(not)e(directly)h(provide.)0 X1936 y(The)h(PHIGS)f(Utilities)f(Library)g(includes)h(functions)f(for:)64 X2043 y Fl(\267)21 b Fq(Searching)8 b(structures)h(for)f(speci\256c)h(types)g X(of)f(structure)g(element,)i(and)f(performing)e(element)i(inquiries)e(on)h X(structures.)64 2121 y Fl(\267)21 b Fq(Maintaining)9 b(a)j(stack)g(of)f(open V) Xg(structures,)g(and)g(edit)g(modes.)64 2200 y Fl(\267)21 b XFq(Retriving)9 b(structure)i(element)h(information.)64 2278 Xy Fl(\267)21 b Fq(Reading)11 b(integer)f(and)i(real)f(values)h(from)f(a)h X(string)e(input)f(device.)64 2357 y Fl(\267)21 b Fq(Computing)9 Xb(character)k(sizes)f(to)e(\256t)h(given)g(rectangles.)64 2435 Xy Fl(\267)21 b Fq(Setting,)10 b(inquiring)f(and)i(copying)f(bundle)h(tables) Vg X(and)g(workstation)f(\256lters.)64 2513 y Fl(\267)21 b Fq(Maintaining)9 Xb(an)j(ordered)f(list)f(of)h(structure)g(priorities.)64 2592 Xy Fl(\267)21 b Fq(Drawing)10 b(common)i(pictures,)f(including)e(arrows,)j(a) Vg X(positioning)c(grid,)j(boxes)g(and)g(a)h(representation)e(of)h(a)h(worksta-) X104 2642 y(tion')n(s)d(colour)i(table.)0 2748 y(The)h(demo)g(program)f XFi(plibtest)h Fq(illustrates)e(the)h(use)h(of)f(some)h(of)f(the)g(Utility)e X(Library)i(functions.)0 2956 y(13th)22 b(May)m(,)12 b(1992)636 Xb(30)839 b(2.01)p eop X%%Page: 31 32 Xbop 0 -137 a Fq(PHIGS)11 b(T)m(oolkit)f(User)i(Manual)1235 Xb(PTK/100)0 8 y Fr(4.4)59 b(The)17 b(PHIGS)e(T)l(raversal)f(State)i(List)g X(Library)0 129 y Fq(This)e(module)f(contains)g(a)i(set)f(of)f(functions)f X(which)i(enable)g(the)g(PHIGS)f(application)g(to)g(inquire)f(information)g X(about)h(the)0 179 y(traversal)e(state)h(list)e(\(TSL\).)0 X257 y(When)g(PHIGS)h(traverses)g(a)f(structure)g(network,)g(it)f(records)i X(the)f(current)g(values)g(of)g(primitive)f(attributes,)g(modelling)g(trans-) V0 X307 y(formations)j(and)i(other)f(quantities)f(in)h(a)h(data)g(structure)f X(called)g(the)h(`60T)o(raversal)g(State)f(List')g(\(TSL\).)i(Since)f(the)f(T VSL) +-+-+-+-+-+-+-+- END OF PART 12 +-+-+-+-+-+-+-+-