Defining Groups of Cells which Share Data
These questions are somehow related to my previous thread but I thought creating a new one will help new users experiencing similar problems.
Questions are: 1) Is it possible to define a certain number of triangular cells altogether in one row? "Triangle Strip" could be an option? 2) Is it possible to define groups of triangular cells and let them share some information as displacement? This would save a lot of computation time and reduce files sizes. Thanks! |
1 Attachment(s)
Hi Alessandro,
One of the tricks to figuring out what formats you can work with is to use ParaView to apply filters that change your original data to something else and then using "File -> Save Data". The following examples are based on the sample data you provided on the other thread and I used ParaView 3.12.0 (I'm more familiar with this version). My first example comes from using the "Extract Surface" filter, which extracts the surface mesh and stores it as polygonal data: Code:
# vtk DataFile Version 3.0 The second example is from using the filters in the following order:
This is because the filter "Triangle Strips" won't transfer the cell data. The resulting file was only achieved with ParaView 3.12.0 and was partially broken. The fixed file is as shown below: Code:
# vtk DataFile Version 3.0 Now, since in your example case you have 2 strips, of 2 triangles each with the same displacement, then the working example would be this: Code:
# vtk DataFile Version 3.0 But keep in mind that the strips are made up of contiguous triangles! Then there is an additional detail: you might want to look into doing binary encoding. Attached is an example of the last file, in both ASCII and binary formats. In this example, the file in binary format is worse, but only because the ASCII file only have single digit values and the binary format is using float precision (4 bytes, 32 bits). As soon as you go to at least a textual precision of 4-8 characters (4 or 3 digits or 8-7 digits, depending on the float/double precision), you reach the turning point between binary and ASCII format. Best regards, Bruno |
Wow Bruno, both examples look amazingly easy yet very powerful in terms of reducing file data. Talking about Triangle_strips, do the vertices need to be defined in some specific order (i.e. clockwise) or can i just list all the vertices the strip connects?
Thanks. |
Hi Alessandro,
Sorry, but I don't know for certain :( My guess is that the orientation should be consistent, i.e. the direction over which the triangles are recorded. But I do suggest that you test with these simple examples! Swapping vertices manually should be pretty easy :) Best regards, Bruno |
Dear Bruno,
I have been struggling with TRIANGLE_STRIPS polygons. This looks like the only efficient solution for my studies (I can reduce file sizes and calculation times by 1/10 or more). Using this kind of cells/polygons I have around 4,000 entries in the CELL_DATA instead of 80,000 ~ 100,000. Also the displacement vector reduces accordingly. Main problem is the declaration of the nodes. It has, of course, to be consistent with a certain rule (I think it is something like clock-wise order), but I can't find any example over the internet. Also, dealing with 3D strangely-shaped polygons, I am not sure about the correct order to use. I am attaching an example showing a single complex shape of those i am using. This is obtained with my "usual" 600 triangles: http://i58.servimg.com/u/f58/18/02/17/91/normal10.jpg This is obtained with a single triangle_strip: http://i58.servimg.com/u/f58/18/02/17/91/triang10.jpg It is evident that the shape is correct but the triangles are not properly connected (since I did not use any particular order to create the strip). Any idea? This is the code I am using. Code:
# vtk DataFile Version 4.0 |
Hi Alessandro,
It took me a long while to look into this. The example file you've provided is the one that is already damaged. I have a few questions:
I say this because the example file you provided is for an unstructured mesh, which uses cells and not just faces per-se. This means that it will try to close the cells by following a particular point+face order for creating each cell. While for using triangle strips, you strictly need to use the nomenclature shown in the examples I gave in post #2. As for the order of the points in the triangles, the description given here should be self-explanatory: http://www.vtk.org/doc/release/5.10/...p.html#details So, in other words, it's not the orientation in which you defined the points for the triangles that matters, what matters is that the last two points in the previous triangle make up the 2 points in the next triangle, so that only one more point has to be indicated. Keep in mind that this list is the one at "TRIANGLE_STRIPS", which is the list of indexes for the points that make up each triangle. If you want a source code example on how to reduce a list of polygonal triangles to a triangle strip list, have a look into VTK's own source code, for example here: https://github.com/Kitware/VTK/blob/...ngleFilter.cxx Best regards, Bruno |
All times are GMT -4. The time now is 08:41. |