Design: 04.01.07/P02
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 2: Appearance of cell arrays
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
OPQA/INDIVIDUAL CELL COLORS: Minimal simulations of cell array
need only draw the correct cell array boundary in an arbitrary
color and style. If this workstation, however, uses the color
index array to render each cell (either to fill each cell, or
outline it in the specified color) answer "Y", otherwise "N".
MINIMAL SIMULATION OF 3D CELL ARRAYS: Several 3D cell arrays are
drawn. For all but one of these, the four vertices should be
accurately circled by a polymarker. Identify the cell array which
is not accurately marked.
MINIMAL SIMULATION OF 2D CELL ARRAYS: Same as MINIMAL SIMULATION
OF 3D CELL ARRAYS, above.
CELL ARRAY COLORING: Several cell arrays are displayed. In all
but one, the correct color for each cell is illustrated by
diagonal line segments of that color. For solidly colored cells,
therefore, these lines will be invisibile. For outlined cells,
the diagonals should match the cell boundary in color. Identify
the cell array whose diagonals do not match the cell color.
UNDEFINED CELL COLOUR INDICES: Several cell arrays are displayed.
All but one should contain a simple two-color checkerboard
pattern. Identify the cell array which differs from the others.
DESIGN:
OPQA/INDIVIDUAL CELL COLORS: Are the cells of a cell array on
this workstation displayed using the color index from the
specified array (y/n)?
solidc = (response = yes) true/false
divide screen into 6 square labelled areas for all tests
TEST: #SR 4 14
"A <cell array 3> should be rendered as a parallelogram
with the specified points P, Q, and R as vertices."
ngca = no-good cell array = random from 1 to 6
colia = 5x5 checkerboard 2D array, using 0 and 1 only.
radcir = radius of circle for cell array corners = 0.4
for ix = 1 to 6
set transform from 0:1,0:1 into square #ix
randomize geometry:
ang = random angle from 0 to 360 degrees
px = .5 + radcir * cos(ang)
py = .5 + radcir * sin(ang)
offset = + or - 1, randomly
qang = ang + offset * random(75 to 105 degrees)
rang = ang - offset * random(75 to 105 degrees)
qx = .5 + radcir * cos(qang)
qy = .5 + radcir * sin(qang)
rx = .5 + radcir * cos(rang)
ry = .5 + radcir * sin(rang)
pick_z3d:
pz = random real from 0 to 1
qz = random real from 0 to 1
rz = random real from 0 to 1
if (qz+rz-pz < 0 or > 1) goto pick_z3d
draw cell array 3, using
P,Q,R = (px,py,pz), (qx,qy,qz), (rx,ry,rz)
colia(1:5, 1:5)
compute correct position of cell array vertices
if (ix = ngca) then
distort vertex positions
endif
mark cell array vertices, using 2D circle polymarkers
next ix
OPQA/MINIMAL SIMULATION OF 3D CELL ARRAYS: For which cell array
are the vertices NOT accurately marked by a circle?
pass/fail depending on (operator chooses #ngca)
TEST: #SR 9 14
"A <cell array> should be rendered as a rectangle (in MC)
with the specified points P and Q as opposite vertices."
ngca = no-good cell array = random from 1 to 6
colia = 5x5 checkerboard 2D array, using 0 and 1 only.
radcir = radius of circle for cell array corners = 0.4
for ix = 1 to 6
set transform from 0:1,0:1 into square #ix,
shift to z = 0.5 plane
rotate 30 degrees around x and y axis
randomize geometry:
if (random from 0 to 1 < 0.5) then
px = 0.15; qx = 0.85
else
px = 0.75; qx = 0.25
endif
if (random from 0 to 1 < 0.5) then
py = 0.25; qy = 0.85
else
py = 0.75; qy = 0.15
endif
draw cell array, using
P,Q = (px,py), (qx,qy)
colia(1:5, 1:5)
compute correct position of cell array vertices
if (ix = ngca) then
distort vertex positions
endif
mark cell array vertices, using 2D circle polymarkers
next ix
OPQA/MINIMAL SIMULATION OF 2D CELL ARRAYS: For which cell array
are the vertices NOT accurately marked by a circle?
pass/fail depending on (operator chooses #ngca)
if (not solidc) then
informative message: this workstation does not support
coloring of the cells of a cell array.
goto end_coltest
endif
call DISCOL, requesting 5 distinct foreground colors.
fcol = number of available foreground colors
if (fcol > 1) then
colia = 5x5 array of color indices, using 0 thru fcol
when filling try to avoid adjacent cells of same color:
for row = 1 to 5
for col = 1 to 5
liscol = list of colors from 0 to fcol
if (row > 1) then
delete color of row-1, col from liscol
endif
if (col > 1) then
delete color of row, col-1 from liscol
endif
if (liscol empty) then
cell row,col = random color from 0 to fcol
else
cell row,col = random color from liscol
endif
next col
next row
else
leave colia as 0,1 checkerboard
endif
TEST: #SR 4 5 9 10 11 12
"The color index of the cells of a <cell array 3> and <cell
array> should be determined by the corresponding element
of the specified color index array."
ngca = no-good cell array = random from 1 to 6
for ix = 1 to 6
set transform from 0:1,0:1 into square #ix
dx = size of 1st dimension = random from 2 to 4
dy = size of 2nd dimension = random from 2 to 4
randomize geometry:
if (ix > 3) then
ang = random angle from 0 to 360 degrees
px = .5 + radcir * cos(ang)
py = .5 + radcir * sin(ang)
offset = + or - 1, randomly
qang = ang + offset * random(75 to 105 degrees)
rang = ang - offset * random(75 to 105 degrees)
qx = .5 + radcir * cos(qang)
qy = .5 + radcir * sin(qang)
rx = .5 + radcir * cos(rang)
ry = .5 + radcir * sin(rang)
z-values between 0 and 0.5 - behind diagonals
pz = random between 0.3 and 0.4
qz = random between 0.3 and 0.4
rz = random between 0.3 and 0.4
draw cell array 3, using
P,Q,R = (px,py,pz), (qx,qy,qz), (rx,ry,rz)
colia(1:dx, 1:dy)
else
if (random from 0 to 1 < 0.5) then
px = 0.15; qx = 0.85
else
px = 0.75; qx = 0.25
endif
if (random from 0 to 1 < 0.5) then
py = 0.25; qy = 0.85
else
py = 0.75; qy = 0.15
endif
draw cell array, using
P,Q = (px,py), (qx,qy)
colia(1:dx, 1:dy)
endif
compute correct cell boundary positions and color
if (ix = ngca) then
change some cell colors
endif
for each cell of this cell array, draw in diagonals of
the computed color.
diagonals are drawn in the z=1.0 plane so that they always
appear in front of the cell array in case HLHSR is
in effect by default.
next ix
OPQA/CELL ARRAY COLORING: For which cell array do the cell diagonals
NOT match the cell color?
pass/fail depending on (operator chooses #ngca)
TEST: #SR 12 13
"An index which is undefined in the color table should cause
entry number 1 to be used as the color of a cell which is
specified by that index."
set entry #1 in color table opposite from BCKCOL
set entry #1 different from FORCOL - make sure undefined index
defaults to *current* color-rep of #1, not just a predefined color.
set up three undefined indices
u1 = maximum defined entry in color table + 1
u2 = -1
u3 = maximum defined entry in color table + 100
perm = random order for 1-6
dx = size of 1st dimension = 3
dy = size of 2nd dimension = 3
px = 0.2
py = 0.2
for ix = 1 to 6
colia = 1 0 1
0 1 0
1 0 1
this = perm(ix)
set transform from 0:1,0:1 into square #this
if (this >= 2) then
colia(1,1) = u1
endif
if (this >= 3) then
colia(3,3) = u2
endif
if (this >= 4) then
colia(1,3) = u3
endif
if (this >= 5) then
colia(2,2) = u1
endif
if (this = 6) then
colia (3,1) = 0
ngca = ix
endif
if (ix > 3) then
qx = 0.8
qy = 0.2
rx = 0.2
ry = 0.8
pz = 0.5
qz = 0.5
rz = 0.5
draw cell array 3, using
P,Q,R = (px,py,pz), (qx,qy,qz), (rx,ry,rz)
colia(1:dx, 1:dy)
else
qx = 0.8
qy = 0.8
draw cell array, using
P,Q = (px,py), (qx,qy)
colia(1:dx, 1:dy)
endif
next ix
OPQA/UNDEFINED CELL COLOUR INDICES: Which cell array is
different?
pass/fail depending on (operator chooses #ngca)
end_coltest:
END PROGRAM 2