Voronoi Neighbors as ascii output

Questions and problems about using polymake go here.
Burggraf
Posts: 8
Joined: 04 Sep 2012, 18:44

Voronoi Neighbors as ascii output

Postby Burggraf » 04 Sep 2012, 18:52

Hi,

iam pretty new to polymake, and I want to do some validation of my Voronoi algorithmn with polymake. Somehow I was able to visualize the dual_graph of some sites with VISUAL_DUAL_GRAPH, but I need this information as ascii output in order to do the comparison.
Can somebody please help me?
Furthermore, I am up to try to understand the scripting part of polymake in order to trigger and deliver input of my calculation.
Right now, I hope, that I only have to write into that file, what I would write on prompt. (Maybe...)

U see, every help is very welcome.

Thanks a lot.
Timo

p.s. I am familiar with perl, but this does not help a lot...

User avatar
joswig
Main Author
Posts: 282
Joined: 24 Dec 2010, 11:10

Re: Voronoi Neighbors as ascii output

Postby joswig » 05 Sep 2012, 10:11

Here is an example: three points in the plane (we use homogeneous coordinates, hence the extra "1" in front):

Code: Select all

> $V=new VoronoiDiagram(SITES=>[[1,0,0],[1,1,0],[1,0,1]]); > print $V->FACETS; 0 0 0 1 1 -2 0 1 1 0 -2 1 1 0 0 0
The FACETS correspond to the SITES (in the same ordering). The extra facet "1 0 0 0" at infinity is always there as the polyhedron describing the Voronoi diagram, is always unbounded. No actual computation took place so far. The following triggers the convex hull computation. The Voronoi diagram has only one vertex in this case (all other VERTICES of the polyhedron are rays).

Code: Select all

> print $V->VORONOI_VERTICES; 1 1/2 1/2
To see the adjacency information among the Voronoi cells:

Code: Select all

> print rows_numbered($V->DUAL_GRAPH->ADJACENCY); 0:1 2 3 1:0 2 3 2:0 1 3 3:0 1 2
The first line (numbered 0) says that site number 0 is adjacent to site 1 and site 2. The extra "3" does not carry information as it refers to the far face. Similarly for sites numbered 1 and 2. The last line (again related to the far face) just lists those Voronoi regions which are unbounded (all regions, in this case). To see which site is which:

Code: Select all

> print rows_numbered($V->SITES); 0:1 0 0 1:1 1 0 2:1 0 1
Of course, all those commands can also be used in a polymake script (e.g., to write this info into some file).


Return to “Helpdesk”