Design: 04.02.05.01/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 individual geometric attributes
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
ACCURACY OF PATTERN SIZE: Several patterned rectangles are drawn,
each on a background of horizontal and vertical dotted lines.
For all but one rectangle, these lines should be aligned with the
boundaries of the pattern cells. Identify the rectangle not so
aligned.
DEGENERATE PATTERN SIZE: Several patterned rectangles are drawn,
all but one with the same pattern and cell size. Identify the
rectangle with a distinct cell size.
EFFECT OF SET PATTERN REFERENCE POINT: Several patterned
rectangles are drawn, each on a background of horizontal and
vertical dotted lines. For all but one rectangle, these lines
should be aligned with the boundaries of the pattern cells.
Identify the rectangle not so aligned.
EFFECT OF PATTERN REFERENCE POINT, VECTORS, AND SIZE: Several
transformed and patterned fill areas are drawn. On top of each,
the expected location and color of each pattern cell is indicated
by two polylines of the expected color, connecting the diagonally
opposite corners of the cell. Thus, for all but one fill area,
these polylines should be undetectable. Identify the one
rectangle in which they are NOT aligned within cells, and thus
are visible.
DEGENERATE PATTERN VECTORS: Several patterned rectangles are
drawn, all but one with the same pattern reference point and
vectors. Their pattern cells are all of the same shape, but one
should have its cells oriented in a different direction than the
others. Identify the rectangle with distinct pattern vectors.
DESIGN:
use <inquire interior facilities> to determine:
if (pattern not available) then
message: skipping tests of geometric attributes, since these
apply only to pattern interior style.
goto endit
endif
ask operator:
if (transformable patterns not available) then
message: skipping tests of geometric attributes, since these
are predictable only for transformable patterns.
goto endit
endif
---------
| 0 | 1 |
set up simple checkerboard pattern representation |---+---|
as interior index #1: | 1 | 0 |
---------
*** *** *** *** pattern size *** *** *** ***
TEST: #SR 3 4 61 62 71 72 73 74 75 76 77 78 79
"The lengths of the sides of the pattern box should equal
the magnitudes of the pattern size attribute of a fill
area or fill area set primitive."
ngpat = random integer from 1 to 5
for ix = 1 to 5
patszx = pattern size #1 = random value from 0.06 to 0.12
patszy = pattern size #2 = random value from 0.04 to 0.08
randomly (50/50) set patszx = -patszx
randomly (50/50) set patszy = -patszy
exp1,exp2 = expected cell size = abs(patszx,patszy / 2)
if (ix = ngpat)
if (exp1 < 0.1) then
exp1 = 1.2 * exp1
else
exp1 = 0.8 * exp1
endif
endif
draw expected boundaries of pattern cells, based on exp1
and exp2, using dotted polylines
draw fill area or fill area set #ix
with pattern size = patszx, patszy
next ix
OPQA/ACCURACY OF PATTERN SIZE: For which rectangle are the dotted
lines NOT aligned with cell boundaries?
pass/fail depending on (operator identifies rectangle #ngpat)
TEST: #SR 3 4 61 63 71 72 73 74 75 76 77 78 79
"A degenerate value in a pattern size element (either
component zero) should not affect the traversal state
list, nor the value bound to fill area primitives."
set perm to randomize positions of primitives
use both fill area and fill area set
In structure:
set reasonable pattern size = patszx,patszy
draw area #1 at location perm(1)
set pattern size = 0,-2*patszy (no effect)
draw area #2 at location perm(2)
set pattern size = 3*patszx,0 (no effect)
draw area #3 at location perm(3)
set pattern size = 0,0 (no effect)
draw area #4 at location perm(4)
set pattern size = 1.2*patszx, 0.8*patszy
draw area #5 at location perm(5)
OPQA/DEGENERATE PATTERN SIZE: Which rectangle has a different
pattern size?
pass/fail depending on (operator identifies rectangle #5)
*** *** *** *** pattern reference point *** *** *** ***
TEST: #SR 3 4 67 69 71 72 73 74 75 76 77 78 79
"<Set pattern reference point> should set the x-y values of
the reference point as specified, the z-value to zero, and
the pattern reference vectors to (1,0,0) and (0,1,0)."
ngpat = random integer from 1 to 5
zoff = z-location of axis of rotation = 0.2
patszx,patszy = pattern size for this test = (0.15, 0.08)
set pattern size to patszx,patszy
for ix = 1 to 5
set up correct values:
refptx,refpty = random from within [-2,2]
rvec1, rvec2 always = (1,0,0), (0,1,0)
ang = angle of rotation around axis (x=0, z=zoff) for fill area plane
= random from within [15deg, 40deg]
celszx,celszy = size of cell = patszx/2, patszy/2
<set pattern reference point and vectors> to
refptx, refpty, patszx / (2 * sin(ang));
(if left in effect, this positions box boundary in
x-dimension exactly halfway from correct boundary; this
will be conspicuously wrong if not overridden by <set
pattern reference point>.)
vec1, vec2 = = random from within [-2,2]
exp1,exp2 = expected cell size as projected on to NPC plane
exp1 = abs(celszx * cosang)
exp2 = abs(celszy)
if (ix = ngpat)
if (exp1 < 0.1) then
exp1 = 1.2 * exp1
else
exp1 = 0.8 * exp1
endif
endif
draw expected boundaries of pattern cells, based on exp1
and exp2, using dotted polylines
set up z-values based on ang:
for ix = 1 to 4
za(ix) = xa(ix) * tan(ang) + zoff
next ix
<set pattern reference point> to refptx, refpty
draw fill area or fill area set #ix
next ix
OPQA/EFFECT OF SET PATTERN REFERENCE POINT: For which rectangle
are the dotted lines NOT aligned with cell boundaries?
pass/fail depending on (operator identifies rectangle #ngpat)
*** *** *** pattern reference point and vectors *** *** ***
TEST: #SR 3 4 66 68 71 72 73 74 75 76 77 78 79
"The geometric attributes pattern size, pattern reference
point, and pattern reference vectors should determine the
location of colored pattern cells within fill area and
fill area set primitives."
ngpat = random integer from 1 to 5
yloc = midpoint for next rectangle
xleft,xright = left,right MC edges of rectangle = -.1, +.1
set up 3 x 2 pattern representation as index #1, using as many
distinct colors as available.
loop to create 5 patterned fill areas, with simulated cells:
for ix = 1 to 5
pick_coeff:
a,b,c = first three coefficients for equation of fill area plane
= random from within [-5,5]
if (a,b,c too oblique) goto pick_coeff
calculate d such that rectangle MC center (0,yloc,.5) is
contained in plane
MC rectangle coordinates:
x: -1. : +.1
y: yloc + or - 0.4*yincr
set up z-values based on a,b,c,d plane coefficients
if (z-values of corners of rectangle not within [0,1]) then
plane too oblique
goto pick_coeff
endif
set up correct values:
refptx,refpty,refptz = reference point
= random from within [-2,2]
pick_vecs:
rfvc1,rfvc2 = reference vectors
= random from within [-2,2]
calculate shape of WC cell, based on vectors rfvc1, rfvc2
projected on to fill area plane, and then onto NPC.
if shape not rectangular enough (any angle < 55deg) then
goto pick_vecs
calculate patszx,patszy so as to make cell size visible
<set pattern size> to patszx,patszy
<set pattern reference point and vectors> to
ref point: refptx, refpty, refptz
ref vectors: rfvc1, rfvc2
<set local modelling transform> such that in x, -.1,+.1 maps
to .4,.8) at z=1, and in y, yloc maps to yloc at z=0.5:
2 0 0 0.6 x' = (2x + .6)/w
0 1 0 yloc/4 yields y' = (y + yloc/4)/w
0 0 1 0 z' = z/w
0 0 -0.5 1.5 w = (3-z)/2
draw fill area or fill area set #ix
<set local modelling transform> back to identity
calculate WC location and color of expected cells, based on
refpt, rfvc, patsz, and transformation
if (ix = ngpat) then
switch colors in expected cells (1,1) and (1,2)
endif
draw expected pattern cells, using diagonal polylines at
WC: z=0.999 (so that polylines are in front of fill area) to
connect diagonal corners.
next ix
OPQA/EFFECT OF PATTERN REFERENCE POINT, VECTORS, AND SIZE: For
which rectangle are colored pattern cell diagonals visible?
pass/fail depending on (operator identifies rectangle #ngpat)
TEST: #SR 3 4 66 68 70 71 72 73 74 75 76 77 78 79
"Degenerate values in the pattern reference vector (zero
length or parallel) should not affect the traversal state
list, nor the value bound to fill area primitives."
set reasonable pattern size
use 3x2 pattern from previous test
set perm to randomize positions of primitives
rfvc1,rfvc2 = reasonable pattern reference vectors; integer values
= (2,2,1), (-1,3,-1)
re-locate fill areas by applying modelling transformation; thus
pattern reference point (in MC) will be constant.
In structure:
<set pattern reference vectors> to rfvc1,rfvc2
draw area #1 at location perm(1)
<set pattern reference vectors> to 0,rfvc1
(zero length vector: no effect)
draw area #2 at location perm(2)
<set pattern reference vectors> to rfvc2,0
(zero length vector: no effect)
draw area #3 at location perm(3)
<set pattern reference vectors> to 5*rfvc1,rfvc1
(parallel vectors: no effect)
draw area #4 at location perm(4)
<set pattern reference vectors> to rfvc2,rfvc1
draw area #5 at location perm(5)
OPQA/DEGENERATE PATTERN VECTORS: Which rectangle's pattern cells
have a different orientation?
pass/fail depending on (operator identifies rectangle #5)
endit:
END PROGRAM 4