Design: 02.03.03/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: Basic spatial search for 3-D primitives

CHARACTERISTICS: nnnn

OPERATOR SCRIPT: passive test.

DESIGN:

All ISS's from start of root (101,0), no modelling clipping,
null filter lists, search ceiling = 1.

*** *** *** ***   polymarker 3   *** *** *** ***

Build structure 101:
  1.  polymarker 3: (11,1,1), (12,2,2), (22,2,0.2), (13,2,3)
  2.  polymarker 3: (21,1,6), (12.3,2.3,2.3), (22,2,-0.1), (23,2,5)

TEST: #SR 1 2 4 5 6 7 9 10 11
      "The points of a qualifying three-dimensional polymarker
       should be found by a two-dimensional spatial search."

<incremental spatial search> with
   search reference point = 22.1, 2.1
   search distance        = 0.24
pass/fail depending on (no error and found path = (101,2))

TEST: #SR 2 4 5 6 7 9 10 11
      "The points of a qualifying three-dimensional polymarker
       should be found by a three-dimensional spatial search."

<incremental spatial search 3> with
   search reference point = 12.2, 2.2, 2.2
   search distance        = 0.25
pass/fail depending on (no error and found path = (101,2))

*** *** *** ***   polyline 3   *** *** *** ***

Build structure 101:
  1.  polyline 3: (2.0,2.2,0.2), (3,3,3)
  2.  polyline 3: (1,1,-0.1), (3,3,-0.3), (3,3,3.1)

TEST: #SR 1 2 4 5 6 7 9 10 12
      "The line segments of a qualifying three-dimensional polyline
       should be found by a two-dimensional spatial search."

<incremental spatial search> with
   search reference point = 2,2
   search distance        = 0.21
pass/fail depending on (no error and found path = (101,2))

TEST: #SR 2 4 5 6 7 9 10 12
      "The line segments of a qualifying three-dimensional polyline
       should be found by a three-dimensional spatial search."

<incremental spatial search 3> with
   search reference point = 3,3,3.2
   search distance        = 0.11
pass/fail depending on (no error and found path = (101,2))

*** *** *** ***   fill area 3   *** *** *** ***

Use plane: 3x + 4y - z - 7 = 0, so
  z = f(x,y) = 3x + 4y - 7

Build structure 101:
  1.  fill area 3: (1.1,0,z), (1.1,2,z), (2,2,z), (2,0,z)
  2.  fill area 3: (0,  0,z), (0,  2,z), (2,2,z), (2,0,z)

TEST: #SR 1 2 4 5 6 7 9 10 13
      "The interior of a qualifying three-dimensional fill area
       should be found by a two-dimensional spatial search."

<incremental spatial search> with
   search reference point = 1,1
   search distance        = 0.1
pass/fail depending on (no error and found path = (101,2))

TEST: #SR 1 2 4 5 6 7 9 10 13
      "The interior of a qualifying three-dimensional fill area
       should be found by a two-dimensional spatial search,
       even when the search distance is negative."

<incremental spatial search> with
   search reference point = 1,1
   search distance        = -22.22
pass/fail depending on (no error and found path = (101,2))

TEST: #SR 2 4 5 6 7 9 10 13
      "The interior of a qualifying three-dimensional fill area
       should be found by a three-dimensional spatial search."

<incremental spatial search 3> with
   search reference point = 1,2,4
   search distance        = 0.1
pass/fail depending on (no error and found path = (101,2))

*** *** *** ***   fill area set 3   *** *** *** ***

Use plane: 3x + 4y - z - 7 = 0, so
  z = f(x,y) = 3x + 4y - 7

Build structure 101:
  1.  fill area set 3: (1,0,z), (0,1,z), (1,2,z) /
                       (3,2,z), (4,1,z), (3,0,z)
  2.  fill area set 3: (11,2,z), (13,2,z), (13,0,z), (11,0,z)  /
                       ( 1,2,z), ( 3,2,z), ( 3,0,z), ( 1,0,z)

TEST: #SR 1 2 4 5 6 7 9 10 14
      "The interiors of a qualifying three-dimensional fill area
       set should be found by a two-dimensional spatial search."

<incremental spatial search> with
   search reference point = 2, 0.25
   search distance        = 0.1
pass/fail depending on (no error and found path = (101,2))

TEST: #SR 2 4 5 6 7 9 10 14
      "The interiors of a qualifying three-dimensional fill area
       set should be found by a three-dimensional spatial search."

<incremental spatial search 3> with
   search reference point = 2, 1, z
   search distance        = 0.1
pass/fail depending on (no error and found path = (101,2))

*** *** *** ***   text 3   *** *** *** ***

tdv1 =  first text direction vector = 1,   0.1, 0.2
tdv2 = second text direction vector = 0.1, 1,   0.2
tlcx = text local co-ordinate-x = tdv1
tlcy = text local co-ordinate-y = vector in tdv-plane,
       perpendicular to tlcx, and such that tlcy . tdv2 > 0
tlcz = perpendicular to text plane = tlcx X tlcy
tlcz1 = tlcz, normalized to unit length
tp2  = text position 2 = 3,4,0.1
tp1  = text position 1 = tp2 + tlcz1 (1.0 away from tp2)
a,b,c,d = coefficients of text plane containing tp2: ax+by+cz+d=0
srp2d   = 2D search reference point = (tp2x - 0.3, tp2y - 0.3)
dist2d  = distance of srp2d from tp2 plane; since this plane is
   close to z=0 plane, the 2D search reference point will be closer
   to it than to the text plane of tp1, which is about z=1.

Build structure 101:
  1.  set character height = 1.0
  2.  set text alignment   = (CENTRE, HALF)
  3.  text 3: "Viva PHIGS!" at tp1 with tdv1,tdv2
  4.  text 3: "Viva PHIGS!" at tp2 with tdv1,tdv2

TEST: #SR 1 2 4 5 6 7 9 10 15
      "The text extent rectangle of a qualifying three-dimensional
       text primitive should be found by a two-dimensional
       spatial search."

<incremental spatial search> with
   search reference point = srp2d
   search distance        = dist2d * 1.1
pass/fail depending on (no error and found path = (101,4))

TEST: #SR 2 4 5 6 7 9 10 15
      "The text extent rectangle of a qualifying three-dimensional
       text primitive should be found by a three-dimensional
       spatial search."

srp3d   = 3D search reference point = (tp2x + 0.3, tp2y + 0.3, z)
          where z puts srp3d in a,b,c,d plane
dist3d  = 0.95 (because text planes are 1.0 apart - see tp1 above)

<incremental spatial search 3> with
   search reference point = srp3d
   search distance        = dist3d
pass/fail depending on (no error and found path = (101,4))


*** *** *** ***   annotation text 3   *** *** *** ***

Build structure 101:
  1.  set annotation text character height = 1.0
  2.  set annotation text alignment        = (RIGHT, TOP)
  3.  annotation text relative 3: "Viva PHIGS!" at 5,0,0
         with offset = 0,5,1
  4.  annotation text relative 3: "Viva PHIGS!" at 5,5,1
         with offset = -1,2,-3

TEST: #SR 1 2 4 5 6 7 9 10 16
      "The annotation reference point of a qualifying
       three-dimensional annotation text should be found by a
       two-dimensional spatial search."

<incremental spatial search> with
   search reference point = 5,3
   search distance        = 2.5
pass/fail depending on (no error and found path = (101,4))

TEST: #SR 2 4 5 6 7 9 10 16
      "The annotation reference point of a qualifying
       three-dimensional annotation text should be found by a
       three-dimensional spatial search."

<incremental spatial search 3> with
   search reference point = 5,3,1
   search distance        = 2.1
pass/fail depending on (no error and found path = (101,4))

TEST: #SR 2 4 5 6 7 9 10 16
      "The annotation reference point of a qualifying
       three-dimensional annotation text should be found by a
       three-dimensional spatial search, even when the search
       distance is zero."

<incremental spatial search 3> with
   search reference point = 5,5,1
   search distance        = 0.0
pass/fail depending on (no error and found path = (101,4))

*** *** *** ***   cell array 3   *** *** *** ***

Use plane: 3x + 4y - z - 7 = 0, so
  z = f(x,y) = 3x + 4y - 7

colia = color index array =  1 0 1
                             0 1 1

Build structure 101:
  1.  cell array 3: colia with corners
                    P=(1.1,1.1,z), Q=(0.6,2.0,z), R=(2.0,0.6,z)
  2.  cell array 3: colia with corners
                    P=(1.2,1.3,z), Q=(1.5,0.5,z), R=(0.5,1.5,z)

TEST: #SR 1 2 4 5 6 7 9 10 17
      "The parallelogram of a qualifying three-dimensional cell
       array should be found by a two-dimensional spatial
       search."

<incremental spatial search> with
   search reference point = 1,1
   search distance        = 0.1
pass/fail depending on (no error and found path = (101,2))

TEST: #SR 2 4 5 6 7 9 10 17
      "The parallelogram of a qualifying three-dimensional cell
       array should be found by a three-dimensional spatial
       search."

<incremental spatial search 3> with
   search reference point = 1.6,0.5,z
   search distance        = 0.11
pass/fail depending on (no error and found path = (101,2))

END PROGRAM 2