; ; WORLD PROJECTION ON REGULAR POLYHEDRA: ICOSAHEDRON ; ================================================== ; ; Nr. bei Wagner: 14b ; Name: World projection on regular Polyhedra: Icosahedron. ; Gnomonic Azimuthal Projection. ; Author: Rolf Böhm ; Direction: Inverse ; ; (C) Rolf Böhm Bad Schandau 2004, 2011, 2012 ; ; DECLARATIONS ; ============ ; ; Co-ordinates ; _name World~projection~on~regular~polyhedra/Icosahedron _var phi ; latitide _var lambda ; longitude _var alpha ; plane polar azimuth, oblique azimuth _var delta ; plane polar distance, oblique distance _var m ; plane polar radius _var phi' ; cartographic latitude _var lambda' ; cartographic longitude, solution 1 and common _var lambda" ; cartographic longitude, solution 2 ; ; Constants ; _var phi0 ; (oblique) central point latitude _var sinphi0 ; its sine _var cosphi0 ; its cosine _var lambda0 ; (oblique) central point longitude _var lambda1 ; rotation angle _var scale ; map scale denominator (e. g. 1000000, not 1/1000000) _var th ; triangle heigth _var pir ; pentagon inradius _var gamma1 ; pi/2-beta _var zeta ; angle between 2 faces _var gamma2 ; lower faces normal pole distance _var -gamma1 ; south hemisphere gamma1 _var -gamma2 ; south hemisphere gamma2 ; _var a ; Face triangle sind length _var h ; Face triangle heigth ; _var 5h/6 _var h/6 _var -h/6 _var -5h/6 _var -9a/4 _var -7a/4 _var -5a/4 _var -3a/4 _var -a/4 _var a/4 _var 3a/4 _var 5a/4 _var 7a/4 _var 9a/4 _var -4pi/5 _var -3pi/5 _var -2pi/5 _var -pi/5 _var pi/5 _var 2pi/5 _var 3pi/5 _var 4pi/5 _var 5pi/5 ; ; Cube face selection ; _var inr ; Inradius _var fir ; Pentagon inradius _var fcr ; Face circum radius _var snoff ; Solid number of faces _dim FCCL 20 ; Face center central lambda array _dim FCCP 20 ; Face center central phi array ; _dim FCCR 20 ; Rotation array (not used) _dim FCSX 20 ; Face center shift X (in inradius units) array _dim FCSY 20 ; Face center shift y (in inradius units) array _var d ; Distance on face _var i ; Index of face ; ; Miscelleanous ; _var sinl ; sin(lambda) _var cosl ; cosine(lambda) _var sinp ; sine(phi) _var cosp ; cosine(phi) _var dlambda ; delta lambda (=lambda-lambda0) _var sindl ; sine delta lambda _var cosdl ; cosine delta lambda _var return ; return target address _var initial ; program init flag ; ; x, y, x', y', Cx', Rx', °(, (°, pi, pi/2 etc. are pre-defined global variables ; ; INITIALISATION CODE ; =================== ; tstne initial 077$ ; ; Constants ; ; Definitions: ABCDET is a pentagon pyramide with pentagon ABCDE as base and point as top. ; M is the base pentagons center, R is a heigth "foot point" in middle between A and B. ; Triangle and pentagons side length a is 1. ; mov th 3 ; gamma1 (upper faces iunclination) I: heigth RT in triangle ABT root th 2 div th 2 ; = sine denominator ; mov pir 5 ; gamma1 (upper faces iunclination) II: incircle radius RM in pentagon ABCDE root pir 2 mul pir 10 add pir 25 root pir 2 div pir 10 ; = sine enumerator ; mov gamma1 pir ; gamma1 (upper faces iunclination) III: Pyramide heigth MT by sine rule, div gamma1 th ; pir is a adjacent leg ("Ankathete"), th the the hypothenuse asin gamma1 ; sin(gamma1) = pir/th = upper faces inclination ; mov zeta 5 ; formula see Wikipedia) root zeta 2 div zeta 3 neg zeta acos zeta ; differece upper faces inclination - lower faces inclination ; mov r0 pi/2 sub r0 gamma1 mov gamma2 zeta ; gamma2 (lower faces inclination) sub gamma2 r0 sub gamma2 pi/2 ; mov -gamma1 gamma1 neg -gamma1 mov -gamma2 gamma2 neg -gamma2 ; mov r0 5 root r0 2 add r0 3 mov r3 3 root r3 2 mul r0 r3 mov a 12 div a r0 ; triangle side length a in icosahedrons inradius units ; mov r0 3 root r0 2 div r0 2 mov h a mul h r0 ; triangle heigth if ikosahedrons inradius units ; mov h/6 h ; h fractions and multiples div h/6 6 mov 5h/6 h/6 mul 5h/6 5 mov -h/6 h/6 neg -h/6 mov -5h/6 5h/6 neg -5h/6 ; mov r0 a ; a fractions and multiples div r0 4 mov -9a/4 r0 mul -9a/4 -9 mov -7a/4 r0 mul -7a/4 -7 mov -5a/4 r0 mul -5a/4 -5 mov -3a/4 r0 mul -3a/4 -3 mov -a/4 r0 mul -a/4 -1 mov a/4 r0 mul a/4 1 mov 3a/4 r0 mul 3a/4 3 mov 5a/4 r0 mul 5a/4 5 mov 7a/4 r0 mul 7a/4 7 mov 9a/4 r0 mul 9a/4 9 ; mov r0 pi div r0 5 mov -4pi/5 r0 mul -4pi/5 -4 mov -3pi/5 r0 mul -3pi/5 -3 mov -2pi/5 r0 mul -2pi/5 -2 mov -pi/5 r0 mul -pi/5 -1 mov pi/5 r0 mul pi/5 1 mov 2pi/5 r0 mul 2pi/5 2 mov 3pi/5 r0 mul 3pi/5 3 mov 4pi/5 r0 mul 4pi/5 4 mov 5pi/5 r0 mul 5pi/5 5 ; ; Solid definition I: Face center lambda/phi on Earth table ; mov FCCL(1) -4pi/5 mov FCCP(1) gamma1 mov FCCL(2) -2pi/5 mov FCCP(2) gamma1 mov FCCL(3) 0 mov FCCP(3) gamma1 mov FCCL(4) 2pi/5 mov FCCP(4) gamma1 mov FCCL(5) 4pi/5 mov FCCP(5) gamma1 mov FCCL(6) -4pi/5 mov FCCP(6) gamma2 mov FCCL(7) -2pi/5 mov FCCP(7) gamma2 mov FCCL(8) 0 mov FCCP(8) gamma2 mov FCCL(9) 2pi/5 mov FCCP(9) gamma2 mov FCCL(10) 4pi/5 mov FCCP(10) gamma2 mov FCCL(11) -3pi/5 mov FCCP(11) -gamma2 mov FCCL(12) -pi/5 mov FCCP(12) -gamma2 mov FCCL(13) pi/5 mov FCCP(13) -gamma2 mov FCCL(14) 3pi/5 mov FCCP(14) -gamma2 mov FCCL(15) 5pi/5 mov FCCP(15) -gamma2 mov FCCL(16) -3pi/5 mov FCCP(16) -gamma1 mov FCCL(17) -pi/5 mov FCCP(17) -gamma1 mov FCCL(18) pi/5 mov FCCP(18) -gamma1 mov FCCL(19) 3pi/5 mov FCCP(19) -gamma1 mov FCCL(20) 5pi/5 mov FCCP(20) -gamma1 ; ; Solid definition II: Face center X/Y shift in the map table (in inradius units) ; mov FCSX(1) -9a/4 mov FCSY(1) 5h/6 mov FCSX(2) -5a/4 mov FCSY(2) 5h/6 mov FCSX(3) -a/4 mov FCSY(3) 5h/6 mov FCSX(4) 3a/4 mov FCSY(4) 5h/6 mov FCSX(5) 7a/4 mov FCSY(5) 5h/6 mov FCSX(6) -9a/4 mov FCSY(6) h/6 mov FCSX(7) -5a/4 mov FCSY(7) h/6 mov FCSX(8) -a/4 mov FCSY(8) h/6 mov FCSX(9) 3a/4 mov FCSY(9) h/6 mov FCSX(10) 7a/4 mov FCSY(10) h/6 mov FCSX(11) -7a/4 mov FCSY(11) -h/6 mov FCSX(12) -3a/4 mov FCSY(12) -h/6 mov FCSX(13) a/4 mov FCSY(13) -h/6 mov FCSX(14) 5a/4 mov FCSY(14) -h/6 mov FCSX(15) 9a/4 mov FCSY(15) -h/6 mov FCSX(16) -7a/4 mov FCSY(16) -5h/6 mov FCSX(17) -3a/4 mov FCSY(17) -5h/6 mov FCSX(18) a/4 mov FCSY(18) -5h/6 mov FCSX(19) 5a/4 mov FCSY(19) -5h/6 mov FCSX(20) 9a/4 mov FCSY(20) -5h/6 ; ; Solid definition III: Main values ; mov snoff 20 ; solid number of faces. Octahedron: 8 mov inr 1 ; insphere is the unit sphere mov fcr h ; face circumradius mul fcr 2 div fcr 3 ; ; Dialog ; input scale Map~scale~(denominator) clip scale 1 1E12 ; ; Program setted as initialized ; mov initial 1 077$: ; ; SIMD-CODE ; ========= ; ; Scale target geometry (0.1-mm-pixels) into centered unit sphere ; --------------------------------------------------------------- ; sub x Cx' ; Image center div x Rx' ; Earth radius mul x scale ; Map scale sub y Cy' div y Ry' mul y scale ; ; x, y now on unit sphere ; ; Detect the solids face index ; ---------------------------- ; mov r0 snoff ; solid number of faces = index mov d 1E90 ; current distance ("infinite") l_cycle: mov return l_return jump .euclid ; returns the distance actual point - face center in r1 l_return: cmpgt r1 d l_continue mov d r1 ; new distance mov i r0 ; new index l_continue: dec r0 tstgt r0 l_cycle jump l_end l_end: cmplt d fcr l_noout mov x' -9999 mov y' -9999 exit ; outside l_noout: ; ; now contains ... ; i ... the current face index ; d ... the distance actual point - face center ; ; Get the detected face lambda0/phi0/rotation from table ; ------------------------------------------------------ ; get lambda0 FCCL i ; lambda0 get phi0 FCCP i ; phi0 ; get lambda1 FCCR i ; iot runs without rotations ; mov cosphi0 phi0 ; phi0 angle functions cos cosphi0 mov sinphi0 phi0 sin sinphi0 ; ; Page the single faces in a local system ; --------------------------------------- ; get r0 FCSX i sub x r0 get r2 FCSY i sub y r2 ; ; Projection I: Cartesian x/y into Polar co-ordinates m/alpha ; ----------------------------------------------------------- ; mov alpha x div alpha y err . d_zero ; d_ error handler begin jump d_okok d_zero: mov alpha pi/2 tstgt x d_end neg alpha jump d_end d_okok: atan alpha tstgt y d_end ; If negative y then ... add alpha pi ; add 180° d_end: ; d_ error handler end 151$: power x 2 power y 2 clr m add m x add m y root m 2 ; ; Projection II: (Inverse) gnomonic projection ; -------------------------------------------- ; delta ... pole distance (90º-latitude) mov lambda alpha ; Longitude ; add lambda lambda1 ; Rotation mov delta m ; Latitude atan delta mov phi pi/2 sub phi delta ; ; Projection III: Pole centered phi/lambda pair into oblique delta/alpha co-ordinates ; ----------------------------------------------------------------------------------- ; ; alpha = (here) oblique longitude ; delta = (here) oblique pole distance (90º-latitude) ; ; Formulas: Fiala, Kartographische Netzentwürfe, Prague, p. 79f. ; compute constant angle functions mov sinl lambda sin sinl ; sine(lambda) mov cosl lambda cos cosl ; cosine(lambda) mov sinp phi sin sinp ; sine(phi) mov cosp phi cos cosp ; cosine(phi) ; phi' mov r1 sinp mul r1 sinphi0 mov r2 cosp mul r2 cosphi0 mul r2 cosl add r1 r2 mov phi' r1 asin phi' ; lambda 1st solution: arcsine mov r1 cosp neg r1 mul r1 sinl mov r2 phi' cos r2 div r1 r2 mov lambda' r1 ; lambda 2nd solution: arccosine mov r1 cosphi0 neg r1 mul r1 sinp mov r2 sinphi0 mul r2 cosp mul r2 cosl mov r3 phi' cos r3 add r1 r2 div r1 r3 mov lambda" r1 ; lambda by arcsine with the arccosine sign (using the FAI/full angle inversion instruction) asin lambda' lambda" add lambda' lambda0 ; ; Oblique co-ordinates from arc into degree ; ----------------------------------------- ; mul phi' (° mul lambda' (° ; ; Final Computations ; ------------------ ; mov x' lambda' mov y' phi' add x' 180 cmpgt x' -180 3$ add x' 360 3$: cmplt x' 180 4$ sub x' 360 4$: exit ; ; SUBROUTINES ; =========== ; ; .euclid - euclidean distance ; ---------------------------- ; ; Returns the euclidean distance between 2 Points ; P1(x, y) and P2(FCSX(i), FCSY(i)) in r1. ; x and y is a global co-ordinate pair. ; FCSX and FCSY are 2 global tables with x/y values, ; r0 is the table index i. ; .euclid: get r1 FCSX r0 sub r1 x power r1 2 get r2 FCSY r0 sub r2 y power r2 2 add r1 r2 root r1 2 jump return ; _end