Standard surfaces, visualization

This is to illustrate constructing and visualizing surfaces in a notebook.

In [1]:
import $cp.bin.`superficial-6e81b70e5d.jar`
import superficial._
Out[1]:
import $cp.$                               

import superficial._
In [2]:
val genus2 = new StandardSurface(2)
Out[2]:
genus2: StandardSurface = superficial.StandardSurface@ba2d0d7
In [3]:
val pic = SvgPlot.plotComplex(genus2)
Out[3]:
pic: xml.Elem = Seq(
  Seq(
    Seq(
      Seq(
        Seq(
          Seq(
            Seq(
              Seq(
                Seq(
                  Seq(
                    Seq(
                      Seq(
                        Seq(
                          Seq(
                            Seq(
                              Seq(
                                Seq(
                                  Seq(
                                    Seq(
                                      Seq(
                                        Seq(
                                          Seq(
                                            Seq(
                                              Seq(
                                                Seq(
                                                  Seq(
                                                    Seq(
                                                      Seq(
                                                        Seq(
                                                          Seq(
                                                            Seq(
                                                              Seq(
                                                                Seq(
                                                                  Seq(
                                                                    Seq(
                                                                      Seq(
                                                                        Seq(
                                                                          Seq(
                                                                            Seq(
...
In [4]:
import almond.interpreter.api._
Out[4]:
import almond.interpreter.api._
In [5]:
val picData = DisplayData.svg(pic.toString)
Out[5]:
picData: DisplayData = DisplayData(
  Map(
    "image/svg+xml" -> """<svg version="1.1" baseProfile="full" viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg">
           <line x1="125" x2="110" y1="75" y2="110" stroke="hsl(0, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="114" x2="112" y1="101" y2="97" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="114" x2="117" y1="101" y2="99" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><text x="121" y="83">1</text><circle cx="125" cy="75" r="3" fill="hsl(40, 100%, 50%)"/><line x1="75" x2="110" y1="125" y2="110" stroke="hsl(162, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="101" x2="99" y1="114" y2="117" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="101" x2="97" y1="114" y2="112" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><text x="83" y="121">3</text><circle cx="110" cy="110" r="3" fill="hsl(40, 100%, 50%)"/><line x1="39" x2="75" y1="110" y2="125" stroke="hsl(0, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="66" x2="62" y1="121" y2="122" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="66" x2="64" y1="121" y2="117" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><text x="48" y="114">1</text><circle cx="75" cy="125" r="3" fill="hsl(40, 100%, 50%)"/><line x1="39" x2="25" y1="110" y2="75" stroke="hsl(162, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="28" x2="32" y1="83" y2="85" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="28" x2="27" y1="83" y2="87" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><text x="35" y="101">3</text><circle cx="39" cy="110" r="3" fill="hsl(40, 100%, 50%)"/><line x1="25" x2="39" y1="75" y2="39" stroke="hsl(243, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="35" x2="37" y1="48" y2="52" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="35" x2="32" y1="48" y2="50" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><text x="28" y="66">4</text><circle cx="25" cy="75" r="3" fill="hsl(40, 100%, 50%)"/><line x1="39" x2="74" y1="39" y2="25" stroke="hsl(81, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="66" x2="64" y1="28" y2="32" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="66" x2="62" y1="28" y2="27" stroke="black" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><text x="48" y="35">2</text><circle cx="39" cy="39" r="3" fill="hsl(40, 100%, 50%)"/><line x1="110" x2="74" y1="39" y2="25" stroke="hsl(243, 100%, 50%)" stroke-width="1" xmlns="http://www.w3.org/2000/svg"></line><line x1="83" x2="87" y...
In [6]:
kernel.publish.display(picData)
13134242
In [7]:
val q = genus2.quadrangulate
Out[7]:
q: TwoComplex = superficial.TwoComplex$quad$1$@1ca04c4e
In [8]:
kernel.publish.display(DisplayData.svg(SvgPlot.plotComplex(q).toString))
1234564781237568

We can rerun stuff after correcting, by using ./mill -w superficial.bin to recompile on change, and restarting kernel to load a fresh version.