Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision |
user_guide:visual_tutorial [2019/01/25 09:27] – ↷ Page moved from tutorial:visual_tutorial to user_guide:visual_tutorial oroehrig | user_guide:tutorials:visual_tutorial [2019/01/25 16:01] – ↷ Links adapted because of a move operation oroehrig |
---|
<code>polytope > simplex(3)->VISUAL(VertexColor=> '0 100 200');</code> | <code>polytope > simplex(3)->VISUAL(VertexColor=> '0 100 200');</code> |
| |
{{ :tutorial:visual_vertexcolor_val.jpg?300 }} | {{ user_guide:visual_vertexcolor_val.jpg?300 }} |
| |
You can also change the colors in the visualization backends (e.g. jReality). How to do this is explained below. | You can also change the colors in the visualization backends (e.g. jReality). How to do this is explained below. |
<code>polytope > simplex(3)->VISUAL(VertexColor=>['red','green','blue','yellow']);</code> | <code>polytope > simplex(3)->VISUAL(VertexColor=>['red','green','blue','yellow']);</code> |
| |
{{ :tutorial:visual_colors_array.png?300 }} | {{ user_guide:visual_colors_array.png?300 }} |
| |
The following line produces the same picture but each color is specified using a different color format: | The following line produces the same picture but each color is specified using a different color format: |
<code> polytope > simplex(3)->VISUAL(VertexColor=>['red','0 1 0',new RGB(0,0,1),'255 255 0']); </code> | <code> polytope > simplex(3)->VISUAL(VertexColor=>['red','0 1 0',new RGB(0,0,1),'255 255 0']); </code> |
| |
See [[tutorial:visual_tutorial#Specifying Colors|]] for different ways to specify colors. | See [[user_guide:tutorials:visual_tutorial#Specifying Colors]] for different ways to specify colors. |
| |
**Function**: You may also pass a function, i.e. a perl ''sub'', to the //VertexColors// attribute that returns a color depending on the vertex index. The following line produces a tetrahedron with colors ranging from black for vertex 0 to yellow for vertex 3: | **Function**: You may also pass a function, i.e. a perl ''sub'', to the //VertexColors// attribute that returns a color depending on the vertex index. The following line produces a tetrahedron with colors ranging from black for vertex 0 to yellow for vertex 3: |
<code> polytope > simplex(3)->VISUAL(VertexColor=> sub { $i = shift; new RGB($i*0.33,$i*0.33,0); });</code> | <code> polytope > simplex(3)->VISUAL(VertexColor=> sub { $i = shift; new RGB($i*0.33,$i*0.33,0); });</code> |
| |
{{ :tutorial:visual_vertexcolor_sub.jpg?300 }} | {{ user_guide:visual_vertexcolor_sub.jpg?300 }} |
| |
=== Labels === | === Labels === |
<code>polytope > simplex(3)->VISUAL(VertexLabels=>["A", "B", "C", "D"]);</code> | <code>polytope > simplex(3)->VISUAL(VertexLabels=>["A", "B", "C", "D"]);</code> |
| |
{{ :tutorial:visual_labels_array.png?300 }} | {{ user_guide:visual_labels_array.png?300 }} |
| |
If you want to set only one label for example, you can do so by passing the empty string ''""'' for the other vertices: | If you want to set only one label for example, you can do so by passing the empty string ''""'' for the other vertices: |
<code>polytope > simplex(3)->VISUAL(VertexLabels=>["", "", "My favorite vertex", ""]);</code> | <code>polytope > simplex(3)->VISUAL(VertexLabels=>["", "", "My favorite vertex", ""]);</code> |
| |
{{ :tutorial:visual_labels_array_2.png?300 }} | {{ user_guide:visual_labels_array_2.png?300 }} |
| |
** 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, we can use the following commands: | ** 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, we can use the following commands: |
</code> | </code> |
| |
{{ :tutorial:visual_labels_sub.png?300 }} | {{ user_guide:visual_labels_sub.png?300 }} |
| |
If you prefer dehomogenized float coordinates, then you need to use: | If you prefer dehomogenized float coordinates, then you need to use: |
</code> | </code> |
| |
{{ :tutorial:visual_labels_sub.png?300 }} | {{ user_guide:visual_labels_sub.png?300 }} |
| |
=== Vertex Size === | === Vertex Size === |
<code>polytope >simplex(3)->VISUAL(VertexThickness=>2);</code> | <code>polytope >simplex(3)->VISUAL(VertexThickness=>2);</code> |
| |
{{:tutorial:visual_sizes_single1.png?300 }} | {{user_guide:visual_sizes_single1.png?300 }} |
{{ :tutorial:visual_sizes_single2.png?300 }} | {{ user_guide:visual_sizes_single2.png?300 }} |
| |
** Array of sizes **: As in the case of colors and labels, you may also specify individual sizes using an array: | ** Array of sizes **: As in the case of colors and labels, you may also specify individual sizes using an array: |
<code>polytope >simplex(3)->VISUAL(VertexThickness=>[1,2,3,4]);</code> | <code>polytope >simplex(3)->VISUAL(VertexThickness=>[1,2,3,4]);</code> |
| |
{{ :tutorial:visual_sizes_array.png?300 }} | {{ user_guide:visual_sizes_array.png?300 }} |
| |
** Function **: You may define a function that returns the size of the vertex depending on the vertex index. The following | ** Function **: You may define a function that returns the size of the vertex depending on the vertex index. The following |
<code>polytope >cube(3)->VISUAL(VertexThickness=> sub { my $i = shift; if($i%2 == 0) { return 2; } else {return 1;} });</code> | <code>polytope >cube(3)->VISUAL(VertexThickness=> sub { my $i = shift; if($i%2 == 0) { return 2; } else {return 1;} });</code> |
| |
{{ :tutorial:visual_sizes_sub.png?300 }} | {{ user_guide:visual_sizes_sub.png?300 }} |
| |
If you do not want to display the vertices at all, you can use the //VertexStyle// attribute and set it to ''hidden'': | If you do not want to display the vertices at all, you can use the //VertexStyle// attribute and set it to ''hidden'': |
<code>polytope >cube(3)->VISUAL(VertexStyle=>"hidden");</code> | <code>polytope >cube(3)->VISUAL(VertexStyle=>"hidden");</code> |
| |
{{ :tutorial:visual_style_hidden.png?300 }} | {{ user_guide:visual_style_hidden.png?300 }} |
| |
==== Visualizing multiple polytopes ==== | ==== Visualizing multiple polytopes ==== |
===== application topaz ===== | ===== application topaz ===== |
| |
For information on how to visualize simlicial complexes and other topology-related objects, see [[tutorial:apps_topaz#visualization|here]]. | For information on how to visualize simlicial complexes and other topology-related objects, see [[user_guide:tutorials:apps_topaz#visualization|here]]. |
| |
=====Backends===== | =====Backends===== |
| |
=== Save View === | === Save View === |
Clicking the "Save View" button on the bottom of the jReality window attaches a "ViewTransformation" matrix to your object (read [[reference:clients#attachments|this]] if you don't know how attachments work). It contains the transformaiton necessary to convert the coordinates of your object to the coordinates of the (possibly rotated, translated etc. by you in the interactive visualization) object as you currently see it. This information is then used by jReality and Sketch to display the object in exactly that way if you visualize it the next time. | Clicking the "Save View" button on the bottom of the jReality window attaches a "ViewTransformation" matrix to your object (read [[user_guide:extend:clients#attachments|this]] if you don't know how attachments work). It contains the transformaiton necessary to convert the coordinates of your object to the coordinates of the (possibly rotated, translated etc. by you in the interactive visualization) object as you currently see it. This information is then used by jReality and Sketch to display the object in exactly that way if you visualize it the next time. |
| |
| |
| |
| |