Design: 04.03.04.02/P04

This is an abstract, language-independent design. Grim details may be found in the corresponding source code. You may return to the documentation for the module containing this program design, or to the entire hierarchical table of topics covered by the PVT.


PROGRAM 4: Appearance of invisible primitives

CHARACTERISTICS: ynny

OPERATOR SCRIPT:

INVISIBILITY FILTER: Several different numbered primitives are
displayed.  For each prompt, enter a list of integers indicating
which of them are invisible.

OBSCURING BY INVISIBLE PRIMITIVES: A set of dotted lines is
drawn, some invisible, some overlaid by solid invisible lines.
Enter a list indicating which lines appear as visible dotted
lines, not overlaid by any other primitives.

DESIGN:

If workstation allows, set up its color table with entries:
color index   RGB        color
-----------   ---        -----
   0          0,0,0      black
   1          0,1,0      green
   2          1,1,0      yellow
   3          1,1,1      white
   4          0,0,1      blue
rationale: make sure invisibility works for all colors

Set up structure of primitives to be displayed, numbered 1-8 down
the screen:
location   primitive        color    nameset
--------   ---------        -----    -------
   1       polyline           1      0, 1, 2
   2       polymarker         2      3, 4, 5
   3       fill area          3      6, 7, 8
   4       cell array         4      9,10,11
   5       text               1     12,13,14
   6       polyline 3         2     15,16,17
   7       annotation text    3     18,19,20
   8       fill area set      4     21,22,23

Throughtout:
incl = inclusion set
excl = exclusion set

TEST: #SR 5 8 10 11
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter when its inclusion set is the
       largest guaranteed by the standard."

incl = {0-63}
excl = random set of 6 elements chosen from 0-23

set invisibility filter using incl, excl
compute expected subset of invisible primitives
  from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

TEST: #SR 5 8
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter when its inclusion set is null."

set invisibility filter:
   incl = null, excl = {2,4,6,8}
compute expected subset of invisible primitives
   from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

<inquire PHIGS facilities> to determine:
nanams = number of available names for namesets
if (nanams too large for array size of program) then
   message to that effect
   goto end_maximpl
endif

TEST: #SR 5 8 12
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter when its inclusion set is the
       largest supported by the implementation."

incl = {0-nanams}
excl = random set of 6 elements chosen from 0-23

set invisibility filter using incl, excl
compute expected subset of invisible primitives
  from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

TEST: #SR 5 8 12
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter when its exclusion set is the
       largest supported by the implementation."

incl = random set of 6 elements chosen from 0-23
excl = {0-nanams}

set invisibility filter using incl, excl
compute expected subset of invisible primitives
  from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

end_maximpl:

TEST: #SR 5 8 12 13
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter by ignoring invalid names in its
       exclusion set."

incl = {0,63}
excl = random set of 6 elements chosen from 0-23 plus -11, nanams+11

set invisibility filter using incl, excl
compute expected subset of invisible primitives
  from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

TEST: #SR 5 8
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter when its exclusion set is null."

incl = random set of 6 elements chosen from 0-23
excl = null

set invisibility filter using incl, excl
compute expected subset of invisible primitives
  from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

TEST: #SR 5 8
      "Invisibility of primitives should be correctly controlled
       by the invisibility filter when its inclusion and
       exclusion set are neither null nor full."

incl = random set of 7 elements chosen from 0-23
excl = random set of 5 elements chosen from 0-23

set invisibility filter using incl, excl
compute expected subset of invisible primitives
  from incl,excl

OPQA/INVISIBILITY FILTER: Which primitives are invisible (n if
   none)?
pass/fail depending on (response = expected subset)

TEST: #SR 5 8 9
      "Invisible primitives should not obscure visible primitives."

Set up new structure with display priority of 0, containing 8
  numbered 2D (drawn in z=0 plane) thin dotted lines.  Some of
  these should be invisible, some visible but possibly obscured,
  and some directly visible:

location    color    nameset
--------    -----    -------
   1          1        {1}
   2          2        {2}
   3          3        {3}
   4          4        {4}
   5          1        {5}
   6          2        {6}
   7          3        {7}
   8          4        {8}

invobs = number invisible or obscured = random from 4 to 6
invset = randomize order of entries 1-8
numinv = number invisible = invobs/2

invset(1       :numinv) should be invisible
invset(numinv+1:invobs) should be visible, even though obscured
invset(invobs+1:8)      should be visible

set invisibility filter using incl = invset(1:numinv), excl = null

set up new root structure = nstruc, for obscuring primitives
post nstruc to workstation with priority = 1.0
set linewidth scale factor = wide
add names to set: invset(1) to make all obscuring primitives invisible
set linestyle = solid
for ix = numinv+1 to invobs (all entries to be obscured)
   set polyline color # = ix mod 2 (alternate between 0 and 1)
   3D polyline at location invset(ix), in z=0.5 plane
next ix

OPQA/OBSCURING BY INVISIBLE PRIMITIVES: Which primitives appear
   as visible dotted lines (n if none)?
pass/fail depending on
  (response = everything except invset(1:numinv))

END PROGRAM 4