Editing
Vtk/SimpleCubeTutorial
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Comment Lines and Deleting XML Pieces=== Two major advantages of XML-formatted input data files is the ability to segment the data — and rendered elements of a scene — into separate ''Pieces'' and, then, the ability to "comment out" one or more of these pieces when you want to simplify the scene. The following ASCII data file illustrates how the ''Simple Cube'' can be subdivided into a pair of 3-sided figures and how, by simply inserting or deleting a comment line, the two ''Pieces'' can be rendered together or separately. <div align="left"> <pre> <?xml version="1.0"?> <VTKFile type="PolyData" version="0.1" byte_order="LittleEndian" compressor="vtkZLibDataCompressor"> <PolyData> <!-- This is three of the sides of the cube --> <Piece NumberOfPoints="8" NumberOfPolys="3"> <CellData Scalars="temperature" Normals="cell_normals"> <DataArray type="Float32" Name="temperature" format="ascii"> 0.14286 0.28571 0.42857 </DataArray> <DataArray type="Int32" Name="cell_normals" NumberOfComponents="3" format="ascii"> 0 0 1 0 0 1 0 -1 0 </DataArray> </CellData> <Points> <DataArray type="Float32" NumberOfComponents="3" format="ascii"> 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 </DataArray> </Points> <Polys> <DataArray type="Int32" Name="connectivity" format="ascii"> 0 1 2 3 4 5 6 7 0 1 5 4 </DataArray> <DataArray type="Int32" Name="offsets" format="ascii"> 4 8 12 </DataArray> </Polys> </Piece> <!-- This is the other three sides of the cube <Piece NumberOfPoints="8" NumberOfPolys="3"> <CellData Scalars="temperature" Normals="cell_normals"> <DataArray type="Float32" Name="temperature" format="ascii"> 0.57143 0.71429 0.85714 </DataArray> <DataArray type="Int32" Name="cell_normals" NumberOfComponents="3" format="ascii"> 0 1 0 -1 0 0 1 0 0 </DataArray> </CellData> <Points> <DataArray type="Float32" NumberOfComponents="3" format="ascii"> 0 0 0 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 </DataArray> </Points> <Polys> <DataArray type="Int32" Name="connectivity" format="ascii"> 2 3 7 6 0 4 7 3 1 2 6 5 </DataArray> <DataArray type="Int32" Name="offsets" format="ascii"> 4 8 12 </DataArray> </Polys> </Piece> --> </PolyData> </VTKFile> </pre> </div> <font color="blue">'''General Explanation:''' </font> * The fourth line of the above ASCII data file is a single, standard XML-formatted comment line — see the explanation provided, for example, on the [http://en.wikipedia.org/wiki/XML#Comments Wikipedia page that explains XML comment tags]. By XML convention, it begins with the string "<math>~< !--</math>" and ends with the string "<math>~--></math>". The same beginning and ending strings also appear, respectively, as lines 31 and 58 in the data file. In the first case, because the two strings appear on the same line of the file, they simply serve to encapsulate a short comment. In the second case, all of the ASCII text that falls between lines 31 and 58 are considered part of the "comment" and therefore the second ''Piece'' of the cube is ignored by the ''XMLPolyDataReader''. As presented here, this input data file will generate only three sides of the cube. The entire cube will be rendered if line 58 is deleted and the string "<math>~--></math>" is added to the end of line 31.
Summary:
Please note that all contributions to JETohlineWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JETohlineWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Tiled Menu
Table of Contents
Old (VisTrails) Cover
Appendices
Variables & Parameters
Key Equations
Special Functions
Permissions
Formats
References
lsuPhys
Ramblings
Uploaded Images
Originals
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information