Design: 02.03.03/P06

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 6: Modelling transformation and clipping

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

m1 = random transformation matrix
   =   1.43  -2.41  3.25 -1.15
      -3.25  -3.13  2.54 -1.35
      -2.43  -1.54  2.31  1.42
       3.51  -2.32  2.41  3.25

m2 = random transformation matrix
   =   -1.23   1.23  -1.02   9.30
        1.28  -9.34   0.93  -4.89
        2.03   9.85   4.01  -9.23
        4.18  -0.12  -9.34   8.01


*** *** *** ***   Modelling transformations   *** *** *** ***

set up structure #101:
1. set local transformation = m1
2. execute structure 102

pmloc = polymarker location = -6.347, 4.637, 1.082

set up structure #102:
1. set global transformation = m2
2. polymarker at pmloc

exloc = expected WC location = m2 X m1 X pmloc

sdist = 0.1
SRP = exloc + sdist in x-direction

TEST: #SR 2 3 4 5 6 8 10
      "ISS should detect a primitive according to its location
       in world coordinates, computed with the current composite
       modelling transformation, including the effect of
       inherited transformations."

ISS twice with SRP, varying search distance
  starting path: 101,1,102,1
  search ceiling: 2

pass/fail depending on
  (not found with search distance = 0.98*sdist and
   found at 101,1 102,2 with search distance = 1.02*sdist )

exloc = expected WC location = m2 X pmloc

sdist = 0.1
SRP = exloc + sdist in x-direction

TEST: #SR 2 3 4 5 6 10
      "ISS should detect a primitive according to its location
       in world coordinates, computed with the current composite
       modelling transformation when there are no inherited
       transformations."

ISS twice with SRP, varying search distance
  starting path: 102,1
  search ceiling: 1

pass/fail depending on
  (not found with search distance = 0.98*sdist and
   found at 102,2 with search distance = 1.02*sdist )


*** *** *** ***   Modelling clipping   *** *** *** ***

clear CSS

set up structure #101:
1. set modelling clipping CLIP
2. set modelling clipping volume with:
      point         =  5, 5, 5
      normal vector = -1,-1,-1
3. set local transformation = shift by +3,+3,+3
4. polymarker at MC: 4,4,4 (WC will be 7,7,7)
5. polymarker at MC: 1,1,1 (WC will be 4,4,4)

TEST: #SR 2 3 4 5 6 10
      "If the modelling clip flag is NOCLIP, ISS should detect a
       primitive whether or not its location in world coordinates
       is outside the current modelling clipping volume, even if
       the current modelling clipping indicator is CLIP."

ISS twice with
  modelling clip flag: NOCLIP
  SRP:                 5.5,5.5,5.5
  search distance:     1.02*1.5

pass/fail depending on
  (found at 101,4 with starting path = 101,0  and
   found at 101,5 with starting path = 101,4)

change element #1 of structure 101 to:
1. set modelling clipping NOCLIP


TEST: #SR 2 3 4 5 6 10
      "If the modelling clip flag is CLIP, ISS should detect only
       those primitives whose location in world coordinates is
       inside the current modelling clipping volume, even if the
       current modelling clipping indicator is NOCLIP."

ISS with
  modelling clip flag: CLIP
  SRP:                 5.5,5.5,5.5
  search distance:     1.02*1.5

pass/fail depending on
  (found at 101,5 with starting path = 101,0)


*** *** *** ***   Complex primitive   *** *** *** ***

clear CSS

set up vertices for complex fill area:

   1----------2    p1: 0, 1
   |          |    p2: 3, 1
   |  5---6   |    p3: 3,-2
   |  |   |   |    p4: 1,-2
   |  |   |   |    p5: 1, 0
   8--+---7   |    p6: 2, 0
      |       |    p7: 2,-1
      4-------3    p8: 0,-1


tp1-tp8 = WC vertices = m1 X p1-p8

nvec = unit vector normal to WC plane of fill area

set up structure #101:
1. set global transformation = m1
2. fill area at p1-p8

SRP   = point over hole in fill area = average of pt5,pt6,pt7 + 0.02*nvec
sdist = distance from SRP to fill area, as computed by PTREGD

TEST: #SR 2 3 4 5 6 10 13
      "ISS should detect a complex primitive according to its
       location in world coordinates."

ISS twice with SRP, NOCLIP, varying search distance
  starting path:  101,0
  search ceiling: 1

pass/fail depending on
  (not found with search distance = 0.98*sdist and
   found at 101,2 with search distance = 1.02*sdist )


*** *** *** ***   Complex clipping   *** *** *** ***

set up vertices for fill area:

       1----------2     p1: 3,2
      /           /     p2: 6,2
     /           /      p3: 4,-1
    4           /       p4: 1,1
     \         /
      \       /
       \     /
        \   /
         \ /
          3

tp1-tp4 = WC vertices = m1 X p1-p4
clpt  = WC clip point  = point on tp2:tp4 line segment closest to tp1
  (tp1 normal projection onto line segment)
clvec = WC clip vector = vector from clpt to tp1 (in WC plane of
   fill area, normal to line between tp2 and tp4, towards tp1).

nvec  = unit vector normal to WC fill area plane

set up structure #102:
1. set modelling clipping volume with:
      point         = clpt
      normal vector = clvec
2. set global transformation = m1
3. fill area at p1-p4

dvec = vector away from clipping volume and up from fill area plane

SRP = clpt + dvec (outside clipping volume)
sdist = length of dvec

TEST: #SR 2 3 4 5 6 10 13
      "If the modelling clip flag is CLIP, ISS should detect only
       those portions of a complex primitive whose location in
       world coordinates is inside the current modelling clipping
       volume."

ISS twice with SRP, CLIP, varying search distance
  starting path:  102,0
  search ceiling: 1

pass/fail depending on
  (not found with search distance = 0.98*sdist and
   found at 102,3 with search distance = 1.02*sdist )

END PROGRAM 6