ASPL Manual v 1.00
© 2024 by SetSphere.COM


11-11

   RANDOM POLYGONS IN TWO 2D PLANES

[RANDOM POLYGONS IN TWO 2D PLANES]

WORKSPACE POLY2PLANES DESCRIPTION:

This workspace shows how to use ASPL operators to do contextual set operations on geometric data. Worspaces that have a name suffixed with GEO causes ASPL to switch it f& and f\ to do contextual set intersection and set difference according to contextual routines, here they are the GEOmetric routines. Read the ASPL book on how to create GEO workspaces. In this tutorial the 'aspl >' refers to the ASPL prompt, and the '#' refers to the shell prompt.

①  aspl> ks x1 y1 x2 y2 x3 y3
    (set the ks vector to shorten the displayed data)

②  aspl> P12_90 = ggRPI2Pov(N,90,glb1,P1,glb2,P2,nmfl,P12_90)
    (get random polygons in two 2D planes also generate named data in ~tmp)

③  aspl> split P12_90 into P1 P2
    (split the variable P12_90 for the two planes)

④  aspl> f& P1 P2
    (intersect the two planes)

⑤  aspl> f\ P1 P2
    (get the difference between 1st plane and the 2nd plane, the result is pushed on the stack)

⑥  aspl> f\ P2 P1
    (get the difference between 2nd plane and the 1st plane, the result is pushed on the stack)

⑦  aspl> ans
    (print the answer stack)

⑧  aspl> pop P2_1
    (pop the stack result into variable P2_1 as the difference f\ P2 P1)

⑨  aspl> pop P1_2
    (pop the stack result into variable P1_2 as the difference f\ P1 P2)

⑩  aspl> pop P12
    (pop the stack result into variable P12 as the intersection f& P1 P2)

⑪  aspl> ans
    (print the answer stack)

⑫  aspl> v
    (print the symbol table)

⑬  aspl> dumpgad P12;dumpgad P1_2;dumpgad P2_1;aspl> dumpgad P12_90
    (dump GADg of P12 P1_2 P2_1 P12_90 writing them to files in ~tmp directory)

The processing of 90 random triangles in each 2D plane result in 180 triangles total in both planes.

The following figure shows the random triangles in the two 2D planes:

       Figure P12_90-both-img.png
full view

Image File

 -F- Fig. 11.11.1   [Figure RANDOM TRIANGLES IN TWO 2D PLANES]
ASPL (C) 2024 Bassem Jamaleddine

The following figure shows the random triangles intersection processed through ASPL f& P1 P2 command:

       Figure P12-both-intersect-img.png
full view

Image File

 -F- Fig. 11.11.2   [Figure ASPL GEO-INTERSECTION FOR RANDOM TRIANGLES WITH HIGHLIGHTED OVERLAPPING TRIANGLES IN THE TWO 2D PLANES]
ASPL (C) 2024 Bassem Jamaleddine

The following figure shows the random triangles along their intersection (that is the overlapping polygons):

       Figure P12_90-both-and-intersect-img1.png
full view

Image File

 -F- Fig. 11.11.3   [Figure ASPL GEO-INTERSECTION CONTRASTED WITH SQUARE POINTS FOR THE RANDOM TRIANGLES OVERLAPPING IN THE TWO 2D PLANES]
ASPL (C) 2024 Bassem Jamaleddine

The following figure shows the random triangles along their intersection (that is the overlapping polygons):

       Figure P12_90-both-and-intersect-img2.png
full view

Image File

 -F- Fig. 11.11.4   [Figure ASPL GEO-INTERSECTION FOR RANDOM TRIANGLES WITH HIGHLIGHTED OVERLAPPING TRIANGLES IN THE TWO 2D PLANES]
ASPL (C) 2024 Bassem Jamaleddine

The following figure shows the random triangles union of their differences derived from ASPL ASPL f\ P1 P2 and f\ P2 P1 commands:

       Figure P12-both-disjointness-img1.png
full view

Image File

 -F- Fig. 11.11.5   [Figure ASPL GEO-DIFFERENCE SHOWING THE DISJOINTNESS OF THE TWO PLANES -- EXCLUDING THE INTERSECTING TRIANGLES]
ASPL (C) 2024 Bassem Jamaleddine

DRAWING THE DATA:

Generate the drawing data from the GADg for f\ P1 P2

# drawgad -gad P1_2-gad-aspl.tobj

Generate the drawing data from the GADg for f\ P2 P1

# drawgad -gad P2_1-gad-aspl.tobj

Generate the drawing data from the GADg for f& P1 P2

# drawgad -gad P12-gad-aspl.tobj

Drawing the data using the gpdata3 command:

# gpdata3 P12_90_o1.dat,1:2wlp P12_90_o1.dat,1:2wp P12_90_o2.dat,1:2wlp P12_90_o2.dat,1:2wp -title "ASPL GEO-INTERSECTION SHOWING THE OVERLAPPING TRIANGLES IN TWO 2D PLANES"

# gpdata3 P12_90_1.dat,1:2wl P12_90_o1.dat,1:2wp P12_90_2.dat,1:2wl P12_90_o2.dat,1:2wp -title "RANDOM TRIANGLES IN TWO 2D PLANES"

# gpdata3 P1_2_P1.dat,1:2wl P2_1_P2.dat,1:2wl-rgb-blue P12_90_o1.dat,1:2wl-rgb-green P12_90_o2.dat,1:2wl-rgb-yellow -title "RANDOM TRIANGLES AND THEIR INTERSECTIONS HIGHLIGHTED"

# gpdata3 P12_90_1.dat,1:2wl-rgb-red P12_90_2.dat,1:2wl-rgb-blue P12_90_o1.dat,1:2wp-ot-4-ps-1.7-rgb-red P12_90_o2.dat,1:2wp-pt-4-ps-1.7-rgb-blue -title "ASPL GEO-INTERSECTION CONTRASTED WITH SQUARE POINTS FOR THE RANDOM TRIANGLES OVERLAPPING IN THE TWO 2D PLANES"

# gpdata3 P1_2_P1.dat,1:2wl P2_1_P2.dat,1:2wl-rgb-blue P12_90_o1.dat,1:2wl-rgb-green P12_90_o2.dat,1:2wl-rgb-yellow -title "RANDOM TRIANGLES AND THEIR INTERSECTIONS HIGHLIGHTED"

# gpdata3 P1_2_P1.dat,1:2wl P2_1_P2.dat,1:2wl-rgb-blue -title "DISJOINTNESS OF THE TWO PLANES -- EXCLUDING THE INTERSECTING TRIANGLES"

# gpdata3 P1_2_P1.dat,1:2wl P2_1_P2.dat,1:2wl-rgb-blue -title "ASPL GEO-DIFFERENCE SHOWING THE DISJOINTNESS OF THE TWO PLANES -- EXCLUDING THE INTERSECTING TRIANGLES"

# gpdata3 P12_90_1.dat,1:2wl P12_90_o1.dat,1:2wp -every wp ::0::3 P12_90_2.dat,1:2wl P12_90_o2.dat,1:2wp -every wp ::0::3 -title "RANDOM TRIANGLES IN TWO 2D PLANES SHOWING THE OVERLAPPING TRIANGLES"

# gpdata3 P12_90_1.dat,1:2wl P12_90_o1.dat,1:2wp P12_90_2.dat,1:2wl P12_90_o2.dat,1:2wp -title "RANDOM TRIANGLES IN TWO 2D PLANES SHOWING THEIR OVERLAPPING TRIANGLES"

# gpdata3 P12_90_1.dat,1:2wl P12_90_o1.dat,1:2wp -every wp ::0::3 P12_90_2.dat,1:2wl P12_90_o2.dat,1:2wp -every wp ::0::3 -title "RANDOM TRIANGLES IN TWO 2D PLANES SHOWING THEIR OVERLAPPING TRIANGLES"

This example is shown in the following terminal.

       terminal for example: RANDOM POLYGONS IN TWO 2D PLANES
viewme

 -E- Display. 11.11.1   [RANDOM POLYGONS IN TWO 2D PLANES][RANDOM POLYGONS IN TWO 2D PLANES]
Terminal showing RANDOM POLYGONS IN TWO 2D PLANES