User:Tohline/vtk/SimpleCubeTutorial/CubeDetails

From VistrailsWiki
Jump to navigation Jump to search

Cube Definition Details

Whitworth's (1981) Isothermal Free-Energy Surface
|   Tiled Menu   |   Tables of Content   |  Banner Video   |  Tohline Home Page   |

A model of virtually any three-dimensional structure can be fed into VisTrails — and understood by the accompanying visualization toolkit (vtk) library of routines — using VTK's Simple Legacy Format. Here we explain how the set of vertices (POINTS) and POLYGONS of a simple cube can be defined using this Simple Legacy Format; this explanation is primarily intended to provide supplemental details for our accompanying Simple Cube Tutorial.


Defining the POINTS (vertices) & POLYGONS of a cube in Simple Legacy Format

Cube Details

# vtk DataFile Version 2.0 
Cube example 
ASCII 
DATASET POLYDATA 
POINTS 8 float 
0.0 0.0 0.0   <== (x,y,z) coordinates of POINT "0"
1.0 0.0 0.0   <== ... of POINT "1"
1.0 1.0 0.0   <== ... of POINT "2" 
0.0 1.0 0.0   <== ... of POINT "3" 
0.0 0.0 1.0   <== ... of POINT "4" 
1.0 0.0 1.0   <== ... of POINT "5"
1.0 1.0 1.0   <== ... of POINT "6"
0.0 1.0 1.0   <== ... of POINT "7"
POLYGONS 6 30  <== (see explanation in the accompanying text)
4 0 1 2 3   <== POLYGON "0": A four-sided polygon formed by connecting POINTS 0, 1, 2, & 3, in that order.
4 4 5 6 7   <== POLYGON "1": A four-sided polygon formed by connecting POINTS 4, 5, 6, & 7, in that order.
4 0 1 5 4   <== POLYGON "2": A four-sided polygon ... POINTS 0, 1, 5, & 4, in that order.
4 2 3 7 6   <== POLYGON "3": A four-sided polygon ... POINTS 2, 3, 7, & 6, in that order.
4 0 4 7 3   <== POLYGON "4": A four-sided polygon ... POINTS 0, 4, 7, & 3, in that order.
4 1 2 6 5   <== POLYGON "5": A four-sided polygon ... POINTS 1, 2, 6, & 5, in that order.

The following 30 (= 6 x 5) integers will define 6 polygons; 5 integers are needed for each polygon.