Design: 06.01.02/P08
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 8: Miscellaneous tests of modelling clipping
CHARACTERISTICS: nnnn
OPERATOR SCRIPT: passive test.
DESIGN:
Throughout, use incremental spatial search (ISS) to test the
effects of modelling clipping.
P1 = matrix for transformation to shift by 1 in x-direction
P9 = matrix for transformation to shift by 9 in x-direction
S2 = matrix for transformation to scale by 2 in x-direction
R1 = matrix for random transformation
= | 0.7061 -0.2344 0.2709 0.3407 |
| -0.2336 0.8280 0.0524 0.3902 |
| 0.2953 -0.2632 0.6326 0.1875 |
| -0.2673 -0.2501 0.1435 1.2520 |
hsmcpt = half-space point in MC = -1,0,1
hsmcvc = half-space vector in MC = 2,3,4
a,b,c,d = coefficients for WC boundary plane when R1 is applied
to the MC half-space defined by hsmcpt and hsmcvc.
px,py,pz = the WC point where the line
x = a*u
y = b*u
z = 5
intersects the a,b,c,d plane; u = (-5*c-d) / (a*a + b*b)
nsdist = nominal search distance = .1
ux,uy,uz = unit vector parallel to a,b,c
inpt = WC point inside volume
inptx = px + nsdist * ux
inpty = py + nsdist * uy
inptz = pz + nsdist * uz
outpt = WC point outside volume
outptx = px - nsdist * ux
outpty = py - nsdist * uy
outptz = pz - nsdist * uz
Set up structure #101
1: set global transformation: S2
2: set MCV: MC point = 2,0
MC vector = 2,1
operator = replace
3: set global transformation: P1
4: polyline at MC: (2,1), (0,1), (2,2), (0,2), (2,3), (0,3)
5: set global transformation: R1
6: set MCV 3: MC point = hsmcpt
MC vector = hsmcvc
operator = replace
7: set global transformation: P9
8: polymarker 3 at outptx-9, outpty, outptz
9: polymarker 3 at inptx-9, inpty, inptz
In WC, polyline segment from (3,2) to (1,2) is clipped at 2,2 by
the MCV set up in element #2.
TEST: #SR 15 17 18 40 42 43 49 57
"When traversal causes different current modelling
transformations to be applied in the generation of a
polyline and a current MCV, the clipping should be
performed relative to WC space."
perform ISS with
srp = (2-nsdist,2)
clipping ON
starting at 101,0
and sdist just below and above nsdist
pass/fail depending on (found path = first empty and then = 101,4)
TEST: #SR 15 17 40 42 43 57
"When traversal causes a perspective current modelling
transformation to be applied in the generation of a
current MCV, and a different current modelling
transformation to be applied in the generation of a
polymarker, the clipping should be performed relative to
WC space."
perform ISS with
srp = outpt
clipping ON
starting at 101,0
and sdist just below and above 2*nsdist
pass/fail depending on (found path = first empty and then = 101,9)
To test several boundary planes, set up a sequence of polymarkers
all on the unit circle, and arrange each clipping plane so as to
eliminate just one of them, by slicing off the edge of the
circle. There will be only one polymarker left unclipped, and
this is the one to be found.
<inquire modelling clipping facilities> returns
ndpmcv = number of distinct planes for modelling clipping volume
nopl = number of planes to be tested = min (50, ndpmcv)
anginc = angle increment = 360 degrees / (nopl + 1)
radius = distance from origin of boundary planes
= (1 + cos(anginc)) / 2
A1 = matrix for transformation to rotate by anginc
idm = identity matrix
open structure #102
for ipl = 1 to nopl
set local transformation with A1, PRECONCATENATE
set MCV: point = radius,0
vector = -1,0
operator = intersect
next ipl
set local transformation with idm, REPLACE
for ipl = 1 to nopl+1
ang = anginc*ipl
polymarker at cos(ang), sin(ang)
next ipl
close structure #102
TEST: #SR 8 17 18 35 40 42 43 49 57
"During traversal, it should be possible to construct the
current MCV from as many half-spaces as are reported
available by <inquire modelling clipping facilities>."
expelm = expected element = 3*nopl + 2
perform ISS with
srp = 0,0
clipping ON
starting at 102,0
and sdist just below and above 1.0
pass/fail depending on (found path = first empty and then = 102,expelm)
END PROGRAM 8