sourcelibs/Manifold/demos/tour.xtl

1⍝!/usr/bin/env xetal 2⍝ Manifold, the spaces drawn: a point of each kind from its map, and 3⍝ one distance measured along each space against the straight line 4⍝ through it. Run with "just demo Manifold tour". 5"mf:" u̲se< "Manifold" 6 7Pi ← p̲i @ 8 9⍝ Two points of the sphere a tenth of a radian apart along the 10⍝ equator, and two a quarter turn apart: the straight line and the 11⍝ great circle, nearly equal near, not far. 12near ← ᵐᶠs̲pherePoints 2 2 r̲eshape 0.0 0.0 0.1 0.0 13far ← ᵐᶠs̲pherePoints (Pi ÷ 2.0) × 2 2 r̲eshape 0.0 0.0 1.0 0.0 14(s̲qrt '+ r̲/ ((1 s̲elect near) − 2 s̲elect near) ^ 2.0) c̲at (1 s̲elect near) ᵐᶠs̲phereDistance 2 s̲elect near 15(s̲qrt '+ r̲/ ((1 s̲elect far) − 2 s̲elect far) ^ 2.0) c̲at (1 s̲elect far) ᵐᶠs̲phereDistance 2 s̲elect far 16 17⍝ Five points along the great circle between the two far points. 18(1 s̲elect far, 2 s̲elect far) ᵐᶠs̲phereArc 4 19 20⍝ The torus of radii 3 and 1: its outer rim, its inner rim, and how 21⍝ far off it the middle of the hole is. 223.0 1.0 ᵐᶠt̲orusPoints Pi × 2 2 r̲eshape 0.0 0.0 0.0 1.0 233.0 1.0 ᵐᶠt̲orusOff 0.0 0.0 0.0 24 25⍝ Two points of the Swiss roll one turn apart at the same height: 2 pi 26⍝ apart through the air, and along the sheet much farther. 27a ← 6.0 0.0 28b ← (6.0 + 2.0 × Pi) c̲at 0.0 29W ← ᵐᶠr̲ollPoints 2 2 r̲eshape a c̲at b 30W 31(s̲qrt '+ r̲/ ((1 s̲elect W) − 2 s̲elect W) ^ 2.0) c̲at a ᵐᶠr̲ollDistance b 32 33⍝ Two points of the Poincare disk 0.2 apart in the plane, near the 34⍝ middle and near the rim: the disk's distance between them. 35(0.0 0.0 ᵐᶠb̲allDistance 0.2 0.0) c̲at 0.78 0.0 ᵐᶠb̲allDistance 0.98 0.0 36(0.78 0.0, 0.98 0.0) ᵐᶠb̲allGeodesic 2