Quadrangulations and Edge paths

This is a demo of code due to Arka Ghosh and Chinmaya Kausik

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

import superficial._
In [2]:
import SphereComplex._
Out[2]:
import SphereComplex._
In [3]:
import Triangles._
Out[3]:
import Triangles._
In [4]:
import NonPosQuad._
Out[4]:
import NonPosQuad._
In [5]:
import EdgePath._
Out[5]:
import EdgePath._
In [6]:
import Quadrangulation._
Out[6]:
import Quadrangulation._
In [7]:
import StandardSurface._
Out[7]:
import StandardSurface._
In [8]:
import SvgPlot._
Out[8]:
import SvgPlot._
In [9]:
import almond.interpreter.api._
Out[9]:
import almond.interpreter.api._
In [10]:
def showPlot(c: TwoComplex) = kernel.publish.display(DisplayData.svg(SvgPlot.plotComplex(c).toString))
Out[10]:
defined function showPlot
In [12]:
showPlot(doubleBigon)
1221
In [13]:
showPlot(quadrangulate(doubleBigon)._1)
12344321
In [14]:
showPlot(doubleTriangle)
123321
In [15]:
showPlot(quadrangulate(doubleTriangle)._1)
123456214365
In [16]:
val genus2 = new StandardSurface(2)
Out[16]:
genus2: StandardSurface = superficial.StandardSurface@5bd01cc7
In [17]:
val quad = quadrangulate(genus2)._1
Out[17]:
quad: TwoComplex = superficial.Quadrangulation$quad$1$@7569521b
In [18]:
showPlot(genus2)
14142323
In [20]:
showPlot(quad)
1234567847852361
In [22]:
quad.edges
Out[22]:
res21: Set[Edge] = HashSet(
  superficial.EdgePair@4bd51a4c.negative,
  superficial.EdgePair@43413e75.negative,
  superficial.EdgePair@7f1f8d08.negative,
  superficial.EdgePair@3031e846.negative,
  superficial.EdgePair@5f0d2c37.negative,
  superficial.EdgePair@3d386e1e.negative,
  superficial.EdgePair@3e4cc37c.negative,
  superficial.EdgePair@1807f2b.negative,
  superficial.EdgePair@4bd51a4c.positive,
  superficial.EdgePair@43413e75.positive,
  superficial.EdgePair@7f1f8d08.positive,
  superficial.EdgePair@3031e846.positive,
  superficial.EdgePair@5f0d2c37.positive,
  superficial.EdgePair@3d386e1e.positive,
  superficial.EdgePair@3e4cc37c.positive,
  superficial.EdgePair@1807f2b.positive
)
In [23]:
val eds = quad.edges.toVector
Out[23]:
eds: Vector[Edge] = Vector(
  superficial.EdgePair@4bd51a4c.negative,
  superficial.EdgePair@43413e75.negative,
  superficial.EdgePair@7f1f8d08.negative,
  superficial.EdgePair@3031e846.negative,
  superficial.EdgePair@5f0d2c37.negative,
  superficial.EdgePair@3d386e1e.negative,
  superficial.EdgePair@3e4cc37c.negative,
  superficial.EdgePair@1807f2b.negative,
  superficial.EdgePair@4bd51a4c.positive,
  superficial.EdgePair@43413e75.positive,
  superficial.EdgePair@7f1f8d08.positive,
  superficial.EdgePair@3031e846.positive,
  superficial.EdgePair@5f0d2c37.positive,
  superficial.EdgePair@3d386e1e.positive,
  superficial.EdgePair@3e4cc37c.positive,
  superficial.EdgePair@1807f2b.positive
)
In [24]:
eds.map(_.initial)
Out[24]:
res23: Vector[Vertex] = Vector(
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Vertex@5d8c7cd9,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b,
  superficial.Quadrangulation$bFace$1$@6fc6261b
)
In [25]:
eds(0)
Out[25]:
res24: Edge = superficial.EdgePair@4bd51a4c.negative
In [28]:
val randomPath = turnPathToEdgePath(eds(0), Vector(1,2,3,4,5,6), NonPosQuad(quad))
java.lang.ClassCastException: superficial.Quadrangulation$quad$1$ cannot be cast to superficial.NonPosQuad
  superficial.NonPosQuad$.apply(NonPosQuad.scala:54)
  ammonite.$sess.cmd27$Helper.<init>(cmd27.sc:1)
  ammonite.$sess.cmd27$.<clinit>(cmd27.sc:7)
In [29]:
NonPosQuad(_)
Out[29]:
res28: TwoComplex => NonPosQuad = ammonite.$sess.cmd28$Helper$$Lambda$2458/1371042092@495d160b
In [30]:
NonPosQuad(quad)
java.lang.ClassCastException: superficial.Quadrangulation$quad$1$ cannot be cast to superficial.NonPosQuad
  superficial.NonPosQuad$.apply(NonPosQuad.scala:54)
  ammonite.$sess.cmd29$Helper.<init>(cmd29.sc:1)
  ammonite.$sess.cmd29$.<clinit>(cmd29.sc:7)