Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
user_guide:tutorials:visual_tutorial [2019/01/25 09:38] – ↷ Page moved from user_guide:visual_tutorial to user_guide:tutorials:visual_tutorial oroehrig | user_guide:tutorials:visual_tutorial [2019/02/04 22:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tutorial for Visualization ====== | + | {{page>.:latest:@FILEID@}} |
- | + | ||
- | This tutorial contains some examples for the visualization of the different objects dealt with in polymake. | + | |
- | + | ||
- | + | ||
- | ===== Intro ===== | + | |
- | The most straighforward way of visualizing things in '' | + | |
- | < | + | |
- | polytope > simplex(3)-> | + | |
- | </ | + | |
- | By default, this will open '' | + | |
- | + | ||
- | + | ||
- | To get a list of visualization methods available, you can use the build-in help system. To obtain the visualization possibilities for, e.g., Polytopes in application '' | + | |
- | < | + | |
- | polytope > help ' | + | |
- | + | ||
- | Subtopics of objects/ | + | |
- | GALE, SCHLEGEL, VISUAL, VISUAL_BOUNDED_GRAPH, | + | |
- | VISUAL_DUAL_GRAPH, | + | |
- | </ | + | |
- | Most visualization methods provide a variety of parameters. Get a list for the method of yout choice (here: '' | + | |
- | < | + | |
- | polytope > help ' | + | |
- | </ | + | |
- | The syntax for passing parameters can be seen in this example: | + | |
- | < | + | |
- | simplex(3)-> | + | |
- | </ | + | |
- | It visualizes a tetrahedron with really thick edges. See the section on [[visual_tutorial# | + | |
- | + | ||
- | ==== Specifying colors ==== | + | |
- | + | ||
- | Some visualization methods requite you to specify colors. There are various ways of doing this in polymake, i.e. the color red may be given by | + | |
- | * the String ''' | + | |
- | * the String ''' | + | |
- | * the String ''' | + | |
- | * an object '' | + | |
- | + | ||
- | ===== application polytope ===== | + | |
- | + | ||
- | The application ' | + | |
- | of them allow you to change the way things look a various ways. See the following | + | |
- | subsections for examples. | + | |
- | + | ||
- | ==== Changing vertex attributes | + | |
- | + | ||
- | It is possible to change the way the vertices are displayed directly from the command line. In the following we will explain how to change the color, labels, and size of the vertices. | + | |
- | + | ||
- | === Colors === | + | |
- | + | ||
- | There are different ways to specify the colors of the vertices. You may choose a single color for all vertices or set each vertex color individually. | + | |
- | + | ||
- | **Single color**: To specify one color for all vertices use the // | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | You can also change the colors in the visualization backends (e.g. jReality). How to do this is explained below. | + | |
- | + | ||
- | To set the colors of the vertices individually, | + | |
- | + | ||
- | **Array of colors**: Instead of passing one color to the // | + | |
- | <code>polytope > simplex(3)-> | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | The following line produces the same picture but each color is specified using a different color format: | + | |
- | < | + | |
- | + | ||
- | See [[user_guide:visual_tutorial# | + | |
- | + | ||
- | **Function**: | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | === Labels === | + | |
- | + | ||
- | The labels can be specified either by an array or a function that returns a label depending on the index of the vertex. | + | |
- | + | ||
- | ** Array of labels **: To label the vertices of a tetrahedron by A, B, C, and D we just pass the array '' | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | If you want to set only one label for example, you can do so by passing the empty string ''""'' | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | ** Function **: We may also write a perl function that returns a label depending on the index of the vertex. For example, if we want to label the vertices by their coordinates, | + | |
- | < | + | |
- | polytope > $tet = simplex(3); | + | |
- | polytope > $tet-> | + | |
- | </ | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | If you prefer dehomogenized float coordinates, | + | |
- | < | + | |
- | polytope > | + | |
- | </ | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | === Vertex Size === | + | |
- | + | ||
- | Similar to changing the colors using the // | + | |
- | attribute. Again, you may set the sizes of all vertices by a single value or use an array or a function to specify individual sizes. | + | |
- | + | ||
- | ** Single size **: To increase the size of the vertices, just pass a number larger than 1 to the // | + | |
- | < | + | |
- | + | ||
- | {{user_guide: | + | |
- | {{ user_guide: | + | |
- | + | ||
- | ** Array of sizes **: As in the case of colors and labels, you may also specify individual sizes using an array: | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | ** Function **: You may define a function that returns the size of the vertex depending on the vertex index. The following | + | |
- | example sets the size of the odd vertices to 1 and the sizes of the even vertices to 2: | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | If you do not want to display the vertices at all, you can use the // | + | |
- | < | + | |
- | + | ||
- | {{ user_guide: | + | |
- | + | ||
- | ==== Visualizing multiple polytopes ==== | + | |
- | + | ||
- | The following sequence creates a 0/1-cube and a translate. | + | |
- | + | ||
- | < | + | |
- | polytope > $c1=cube(3, | + | |
- | polytope > $c2=transform($c1, | + | |
- | polytope > compose($c1-> | + | |
- | </ | + | |
- | + | ||
- | If '' | + | |
- | + | ||
- | ===== application topaz ===== | + | |
- | + | ||
- | For information on how to visualize simlicial complexes and other topology-related objects, see [[user_guide: | + | |
- | + | ||
- | =====Backends===== | + | |
- | ' | + | |
- | ==== TikZ and Sketch ==== | + | |
- | Sketch is a script language which produces TikZ output. It is quite sophisticated. There is a interface from polymake to Sketch. | + | |
- | <code perl> | + | |
- | polytope> | + | |
- | polytope> | + | |
- | </ | + | |
- | When you downloaded the Sketch interpreter ([[http:// | + | |
- | <code perl> | + | |
- | sketch myfile.sketch > myfile.tikz | + | |
- | </ | + | |
- | + | ||
- | The drawback is that the produced TikZ code is quite cryptic and not really readable or editable anymore. If you do want to create TikZ code which is easier to edit afterwards, you might want to use polymake' | + | |
- | <code perl> | + | |
- | polytope> | + | |
- | </ | + | |
- | For a different viewing angle you may use jReality. Rotate the polytope into the position you want and click the ''' | + | |
- | + | ||
- | ==== jReality ==== | + | |
- | + | ||
- | The jReality viewer offers a versatile perspective for your favourite tools on 4 Panel which may be enabled/ | + | |
- | the keyboard shortcuts Alt+Shift+(Up|Down|Left|Right) or the window menu. The " | + | |
- | and " | + | |
- | + | ||
- | + | ||
- | === Appearance === | + | |
- | There are several objects which control the appearance of a geometry in jreality: | + | |
- | + | ||
- | - geometry attributes, | + | |
- | - appearances at a specific scene graph nodes, and | + | |
- | - the content appearance. | + | |
- | + | ||
- | The most versatile point to set different parameters for the appearance is via geometry attributes. This is needed, for example, if every vertex of the displayed | + | |
- | geometry should have its own thickness or color like in VISUAL_GRAPH-> | + | |
- | knowledge of the jreality API and in particular the attribute handling. | + | |
- | + | ||
- | An appearance at a scene graph node (every VISUAL object is put into one of these) may have its own appearance which stores single values for colors/ | + | |
- | of vertices/ | + | |
- | navigator. The navigator displays the entire scene graph. The polymake part of the scene graph starts with " | + | |
- | in seperate geometry nodes with its appearances. In each of the appearance you find the RenderingHints and Shader that either inherit properties of the content | + | |
- | appearance or override them with their own values. This is already much less tedious than using the beanshell. | + | |
- | + | ||
- | The content appearance comes into play if no other appearances exist in the content subtree, i.e. neither specific node appearances nor geometry attributes. The | + | |
- | sizes/ | + | |
- | set. | + | |
- | + | ||
- | So to be able to change the colors of the faces/ | + | |
- | and geometry attributes. This may be done using the "clear attributes" | + | |
- | + | ||
- | === Save View === | + | |
- | Clicking the "Save View" button on the bottom of the jReality window attaches a " | + | |
- | + | ||
- | + | ||