Design: 06.01.02/P09
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 9: Visual effect of modelling transformation
CHARACTERISTICS: ynny
OPERATOR SCRIPT:
3D MODELLING TRANSFORMATION: All but one of the six boxes should
contain a single line segment with its endpoints circled.
Identify the line whose endpoints are not accurately marked.
2D MODELLING TRANSFORMATION: Same as 3D MODELLING TRANSFORMATION
above.
DESIGN:
Divide screen up into 6 square labelled areas for all tests
idxf = 3D identity matrix
TEST: #SR 1 8 9 15 16 17
"The modelling coordinates of a 3D polyline should be
transformed into world coordinates by 3D local and
global modelling transformation."
lisbox = permutation of 1-6
ngbox = incorrect box = random from 1 to 6
for ix = 1 to 6
this = lisbox(ix)
xf = 4x4 matrix, values chosen randomly from 0.5 to 1.5
in order to see effect of z-coord:
if this = 1 or 4 then
rotxf = matrix to rotate 90 degrees around x-axis
elseif this = 2 or 5 then
rotxf = matrix to rotate 90 degrees around y-axis
else
rotxf = matrix to rotate 90 degrees around z-axis
endif
calculate effect on position of WC: 1,1,1 and 2,2,2
wc1x,wc1y,wc1z = rotxf X xf X (1,1,1)
wc2x,wc2y,wc2z = rotxf X xf X (2,2,2)
calculate boxf so as to scale and shift WCs into box #ix
composite transformation will be boxf X rotxf X xf
matrix fixf = boxf X rotxf
calculate expected position of WC: 1,1,1 and 2,2,2
wc1x,wc1y,wc1z = fixf X xf X (1,1,1)
wc2x,wc2y,wc2z = fixf X xf X (2,2,2)
if ix = ngbox then
distort result:
ngxf = rotate 10 degrees on z-axis, around box center
fixf = ngxf X fixf
endif
if this < 3 then
replace local with fixf
preconcatenate xf to local
elseif this < 5 then
replace local with xf
postconcatenate fixf to local
else
replace local with xf
replace global with fixf
endif
draw 3D polyline from (1,1,1) to (2,2,2)
replace local with idxf
replace global with idxf
draw expected positions as 2D circle polymarker at
wc1x,wc1y and wc2x,wc2y
next ix
OPQA/3D MODELLING TRANSFORMATION: Which box contains something
other than a single line segment with circled endpoints?
pass/fail depending on (operator chooses box #ngbox)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
TEST: #SR 4 8 12 15 16 17 18
"The modelling coordinates of a 3D polyline should be
transformed into world coordinates by 2D local and
global modelling transformation."
lisbox = permutation of 1-6
ngbox = incorrect box = random from 1 to 6
for ix = 1 to 6
this = lisbox(ix)
xf2 = 3x3 matrix, values chosen randomly from 0.5 to 1.5
in order to see effect of z-coord:
if this = 1 or 4 then
rotxf = matrix to rotate 90 degrees around x-axis
elseif this = 2 or 5 then
rotxf = matrix to rotate 90 degrees around y-axis
else
rotxf = matrix to rotate 90 degrees around z-axis
endif
calculate effect on position of WC: 1,1,1 and 2,2,2
wc1x,wc1y,wc1z = rotxf X xf X (1,1,1)
wc2x,wc2y,wc2z = rotxf X xf X (2,2,2)
calculate boxf so as to scale and shift WCs into box #ix
composite transformation will be boxf X rotxf X xf
matrix fixf = boxf X rotxf
calculate expected position of WC: 1,1,1 and 2,2,2
wc1x,wc1y,wc1z = fixf X xf X (1,1,1)
wc2x,wc2y,wc2z = fixf X xf X (2,2,2)
if ix = ngbox then
distort result:
ngxf = rotate 10 degrees on z-axis, around box center
fixf = ngxf X fixf
endif
if this < 3 then
replace local with fixf
preconcatenate xf2 to local
elseif this < 5 then
replace local with xf2
postconcatenate fixf to local
else
replace local with xf2
replace global with fixf
endif
draw 3D polyline from (1,1,1) to (2,2,2)
replace local with idxf
replace global with idxf
draw expected positions as 2D circle polymarker at
wc1x,wc1y and wc2x,wc2y
next ix
OPQA/2D MODELLING TRANSFORMATION: Which box contains something
other than a single line segment with circled endpoints?
pass/fail depending on (operator chooses box #ngbox)
END PROGRAM 9