ASPL User Guide v 1.00
© 2025 Bassem W. Jamaleddine


22. 6
   Program Generator for Random Polygons on Three Spheres

 

Program Name: polyclouds.aspl

Element-Grouping-Class: GEOSPHERES

Example, to generate 130 polygons on each of the three spheres:

     polyclouds.aspl 130

GG-function: ggRPO3Sov()

GEOmetric Contextual Processors Via: ASPL::GGs::GEOSPHERES::CTXSETOP::GeoOps

Algorithmic GEO Modules Via:

ASPL::SOPALGO::ALGIMP_SETINTER_GEO17_INTERSECTION

ASPL::SOPALGO::ALGIMP_SETDIFFR_GEO17_DIFFERENCE

User GEOmetric Processors: Curaspace::MULTITRIOVERLAP

     Curaspace::MULTITRIOVERLAP::intersect2GG2d

     Curaspace::MULTITRIOVERLAP::intersect3GGG2d

     Curaspace::MULTITRIOVERLAP::diff2GG2d

     Curaspace::MULTITRIOVERLAP::diff3GGG2d

Program Generator for Random Polygons on Three Spheres

●  Program Generator for Random Polygons on Three Spheres

The script polyclouds.aspl creates the temporary workspace TRANSIENT whose element grouping class GEOSPHERES, hence switching the set operators f& and f\ to do contextual set intersection and set difference according to contextual routines, here they are the GEOmetric routines.

The script creates random polygons on three spheres and uses the set operations to find intersecting polygons between the spheres. The script invokes the ASPL interpreter using the two lines shebang: line 1 and line 2; the first specifies the interpreter, and the second specifies the arguments to be passed to the interpreter.

We can invoke the script on the shell prompt by specifying its name followed by a positive integer. This integer is being read and passed as an argument, represented by $1 to be concatenated to S123_ (line 15) to form a symbolic production. For instance, if we typed on the shell prompt the following command to create 130 random polygons:

polyclouds.aspl 130

then line 15 is turned into
S123_130 = ggRPO3Sov(N,130,glb1,S1,glb2,S2,glb3,S3,nmfl,S123_130)
hence creating the set variable S123_130 to be assigned the GADg group that contains the grouping of three spheres labeled S1, S2, and S3. Line 16 splits S123_130 into three set variables: S1, S2, and S3. Lines 17 to 19 get the intersection between each pair of spheres, namely: S1 and S2, S1 and S3, S2 and S3. Line 20 gets the interesection between all three spheres: S1 S2 S3. Since the results of the set operations have been pushed on the answer stack, lines 21 to 24 pop the stack into the set variables S123, S23, S13, and S12. Optinally, lines 25 to 28, the set variables are being dumped to ASPL ~tmp directory where we can invoke the utility script gpdata3 to drawn the polygons.


 -LIS- Listing. 22.6.1   [LISTING polyclouds.aspl][ASPL Script polyclouds.aspl]
(raw text)
1.     #!/usr/bin/env  aspl 
2.     #ENVARG= -wsname TRANSIENT -groupingclass GEOSPHERES
3.     
4.     ;;***********************************************************************
5.     ;;   polyclouds.aspl
6.     ;;   
7.     ;;   Copyright © 2021-2024 Bassem W. Jamaleddine
8.     ;;   All rights reserved.
9.     ;;   
10.    ;;***********************************************************************
11.    
12.    endScriptIfShellArgsLessThan 1
13.    
14.    print RANDOM POLYGONS ON THREE SPHERES WITH $1 POLYGONS ON EACH
15.    S123_$1 = ggRPO3Sov(N,$1,glb1,S1,glb2,S2,glb3,S3,nmfl,S123_$1)
16.    split S123_$1 into S1 S2 S3
17.    f& S1 S2                                                            
18.    f& S1 S3                                                            
19.    f& S2 S3                                                            
20.    f& S1 S2 S3                                                         
21.    pop S123                                                            
22.    pop S23
23.    pop S13
24.    pop S12
25.    dumpgad S123
26.    dumpgad S12
27.    dumpgad S13
28.    dumpgad S23                                
29.    
30.    endscript
31.    
32.    __END__
33.    
34.     Create random polygons on three spheres.
35.     $00 must be followed by one argument specifying the number of polygons
36.     to create on each sphere.
37.    
38.       draw 100 random polygons on three spheres
39.          $00 100
40.    
41.       In ASPL GEO's workspaces the set operations perform set operations
42.       on geometric data, and the command "dumpgad" dumps GAD objects that
43.       can be read by the command "drawgad" to draw such geometric data.

ASPL(C) 2025 Bassem Jamaleddine


full view

Image File

 -FG- Fig. 22.6.1   [GEOmetric Set Operation on Three Spheres]
ASPL (C) 2025 Bassem Jamaleddine




full view

Image File

 -FG- Fig. 22.6.2   [Intersection of Polygons on Three Spheres in 2D]
ASPL (C) 2025 Bassem Jamaleddine


full view

Image File

 -FG- Fig. 22.6.3   [Intersection of Polygons on Three Spheres in 3D]
ASPL (C) 2025 Bassem Jamaleddine


This example is shown in the following terminal.

viewme

 -TC- Display. 22.6.1   [Script polyclouds.aspl]
run for polyclouds.aspl