https://public.kitware.com/Wiki/api.php?action=feedcontributions&user=Hua.yang&feedformat=atomKitwarePublic - User contributions [en]2022-09-28T06:21:26ZUser contributionsMediaWiki 1.37.1https://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25067VTK/Polyhedron Support2010-07-13T17:32:27Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
*Support of the new polyhedron cell type including:<br />
** A new cell class called vtkPolyhedron that implements common APIs of vtkCell3D.<br />
** Extended vtkUnstructuredGrid for storing and accessing this new cell type.<br />
** Modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
*Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
[[Image:PolyhedronClipping.png|center|thumb|800px|Fig.1 Clipping a polyhedron mesh.]]<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
*The original cells field consists of three sub-fields: <br />
** ''connectivity'': an array storing the point Ids of the unique points of all cells.<br />
** ''offsets'': an array indicating the end position (1-indexed) of each cell in the connectivity array.<br />
** ''types'': an array storing the types of each cell. <br />
<br />
*The new sub-fields are:<br />
** ''faces'': an array storing the face streams of all the cells and<br />
** ''faceoffsets'': an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
[[Image:MVCInterpolation.png|center|thumb|400px|Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh.]]<br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25066VTK/Polyhedron Support2010-07-13T17:31:59Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including:<br />
** A new cell class called vtkPolyhedron that implements common APIs of vtkCell3D.<br />
** Extended vtkUnstructuredGrid for storing and accessing this new cell type.<br />
** Modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
[[Image:PolyhedronClipping.png|center|thumb|800px|Fig.1 Clipping a polyhedron mesh.]]<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
*The original cells field consists of three sub-fields: <br />
** ''connectivity'': an array storing the point Ids of the unique points of all cells.<br />
** ''offsets'': an array indicating the end position (1-indexed) of each cell in the connectivity array.<br />
** ''types'': an array storing the types of each cell. <br />
<br />
*The new sub-fields are:<br />
** ''faces'': an array storing the face streams of all the cells and<br />
** ''faceoffsets'': an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
[[Image:MVCInterpolation.png|center|thumb|400px|Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh.]]<br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=File:MVCInterpolation.png&diff=25065File:MVCInterpolation.png2010-07-13T17:30:08Z<p>Hua.yang: </p>
<hr />
<div></div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25064VTK/Polyhedron Support2010-07-13T17:28:01Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
[[Image:PolyhedronClipping.png|center|thumb|800px|Fig.1 Clipping a polyhedron mesh.]]<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
*The original cells field consists of three sub-fields: <br />
** ''connectivity'': an array storing the point Ids of the unique points of all cells.<br />
** ''offsets'': an array indicating the end position (1-indexed) of each cell in the connectivity array.<br />
** ''types'': an array storing the types of each cell. <br />
<br />
*The new sub-fields are:<br />
** ''faces'': an array storing the face streams of all the cells and<br />
** ''faceoffsets'': an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
[[Image:MVCInterpolation.png|center|thumb|400px|Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh.]]<br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=File:PolyhedronClipping.png&diff=25063File:PolyhedronClipping.png2010-07-13T17:26:25Z<p>Hua.yang: </p>
<hr />
<div></div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25062VTK/Polyhedron Support2010-07-13T17:25:13Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
[[Image:PolyhedronClipping.png|center|thumb|800px|Fig.1 Clipping a polyhedron mesh.]]<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
*The original cells field consists of three sub-fields: <br />
** ''connectivity'': an array storing the point Ids of the unique points of all cells.<br />
** ''offsets'': an array indicating the end position (1-indexed) of each cell in the connectivity array.<br />
** ''types'': an array storing the types of each cell. <br />
<br />
*The new sub-fields are:<br />
** ''faces'': an array storing the face streams of all the cells and<br />
** ''faceoffsets'': an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25061VTK/Polyhedron Support2010-07-13T17:21:06Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
*The original cells field consists of three sub-fields: <br />
** ''connectivity'': an array storing the point Ids of the unique points of all cells.<br />
** ''offsets'': an array indicating the end position (1-indexed) of each cell in the connectivity array.<br />
** ''types'': an array storing the types of each cell. <br />
<br />
*The new sub-fields are:<br />
** ''faces'': an array storing the face streams of all the cells and<br />
** ''faceoffsets'': an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25060VTK/Polyhedron Support2010-07-13T17:19:38Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: <br />
** 'connectivity': an array storing the point Ids of the unique points of all cells.<br />
** 'offsets': an array indicating the end position (1-indexed) of each cell in the connectivity array.<br />
** 'types': an array storing the types of each cell. <br />
<br />
The new sub-fields are:<br />
** 'faces': an array storing the face streams of all the cells and<br />
** 'faceoffsets': an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25059VTK/Polyhedron Support2010-07-13T17:16:33Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format:<br />
[numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element <br />
[(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. <br />
<br />
For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <math>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25058VTK/Polyhedron Support2010-07-13T17:15:10Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices <math>v_i</math> (i=1,…,n) and a interpolation point <nath>x</math>, the MVC interpolation weights of the vertices <math>w_i</math> satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i}=1</math><br />
**Linear reproduction: <math>\sum W_{i} V_i= X</math><br />
**Positivity: <math>W_{i} >=0 </math><br />
**Smoothness: <math>W_{i} </math> at least C1 continuous.<br />
<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25057VTK/Polyhedron Support2010-07-13T17:12:51Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
**Affine invariance: <math>\sum W_{i_x}=1</math><br />
**Linear reproduction: <math>\sum W_{i_x} V_i= X</math><br />
**Positivity: <math>W_{i_x} >=0 </math><br />
**Smoothness: <math>W_{i_x} </math> at least C1 continuous.<br />
<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25056VTK/Polyhedron Support2010-07-13T17:10:51Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
*Affine invariance: <br />
*Linear reproduction: <br />
*Positivity: <br />
*Smoothness: at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
'''References'''<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25055VTK/Polyhedron Support2010-07-13T17:09:58Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
*Affine invariance: <br />
*Linear reproduction: <br />
*Positivity: <br />
*Smoothness: at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25054VTK/Polyhedron Support2010-07-13T17:09:26Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
*Affine invariance: <br />
*Linear reproduction: <br />
*Positivity: <br />
*Smoothness: at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
*Will Schroeder: will(dot)schroeder(at)kitware(dot)com<br />
*Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25053VTK/Polyhedron Support2010-07-13T17:08:44Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
*Affine invariance: <br />
*Linear reproduction: <br />
*Positivity: <br />
*Smoothness: at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
'''Contacts'''<br />
<br />
WILL SCHROEDER: will(dot)schroeder(at)kitware(dot)com<br />
<br />
Hua Yang: hua(dot)yang(at)kitware(dot)com</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25052VTK/Polyhedron Support2010-07-13T17:05:51Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
'''3D Mean Value Coordinates Interpolation'''<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
*Affine invariance: <br />
*Linear reproduction: <br />
*Positivity: <br />
*Smoothness: at least C1 continuous.<br />
<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25051VTK/Polyhedron Support2010-07-13T17:04:28Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25050VTK/Polyhedron Support2010-07-13T17:02:51Z<p>Hua.yang: </p>
<hr />
<div>''''Overview''''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
''''Polyhedron Cell Support''''<br />
<br />
'''A new 3D cell class vtkPolyhedron'''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
'''Polyhedron cells as face streams in vtkUnstructuredGrid'''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25049VTK/Polyhedron Support2010-07-13T16:59:26Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
<br />
''Polyhedron cells as face streams in vtkUnstructuredGrid''<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1)<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
<br />
''IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer''<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25048VTK/Polyhedron Support2010-07-13T16:58:15Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
Polyhedron cells as face streams in vtkUnstructuredGrid<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1);<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25047VTK/Polyhedron Support2010-07-13T16:57:39Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
''A new 3D cell class vtkPolyhedron''<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
*InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
*Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
*IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
*Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
*Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
Polyhedron cells as face streams in vtkUnstructuredGrid<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1);<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25046VTK/Polyhedron Support2010-07-13T16:57:04Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
#A new 3D cell class vtkPolyhedron<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
**InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
**Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
**IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
**Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
**Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
Polyhedron cells as face streams in vtkUnstructuredGrid<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1);<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25045VTK/Polyhedron Support2010-07-13T16:55:58Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
#A new 3D cell class vtkPolyhedron<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
##InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
##Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
##IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
##Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
##Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
Polyhedron cells as face streams in vtkUnstructuredGrid<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1);<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25044VTK/Polyhedron Support2010-07-13T16:55:00Z<p>Hua.yang: </p>
<hr />
<div>'''Overview'''<br />
This work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
#Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
#Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
<br />
'''Polyhedron Cell Support'''<br />
A new 3D cell class vtkPolyhedron<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
Polyhedron cells as face streams in vtkUnstructuredGrid<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1);<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yanghttps://public.kitware.com/Wiki/index.php?title=VTK/Polyhedron_Support&diff=25043VTK/Polyhedron Support2010-07-13T16:53:32Z<p>Hua.yang: </p>
<hr />
<div><br />
VTK Polyhedron Cell Support<br />
<br />
Overview: this work extends VTK to support polyhedron cells. This new cell type can be applied to computational fluid dynamics (CFD) and other similar applications. The work consists of two parts: <br />
<br />
• Support of the new polyhedron cell type including: (1) a new cell class called vtkPolyhedron that implements common APIs of vtkCell3D, (2) extended vtkUnstructuredGrid for storing and accessing this new cell type, and (3) modified vtkXMLUnstructuredGridReader/Writer for I/O of polyhedron meshes.<br />
<br />
• Implementation of mean value coordinates (MVC) interpolation method as a filter called vtkMeanValueCoordinateInterpolator. This filter is used in vtkPolyhedron as well as in vtkProbePolyhedron for smoothly interpolating/extrapolating point attributes (scalars, vectors, etc.) at a given point interior, exterior or on the surface of polyhedron cells.<br />
Polyhedron Cell Support<br />
A new 3D cell class vtkPolyhedron<br />
<br />
vtkPolyhedron represents a 3D polyhedron cell defined by a set of polygon faces. Both convex and concave polyhedrons are supported. However the polyhedrons need to be watertight, non-self-intersecting and manifold (each edge is used exactly twice), and the face polygons needs to be planar. vtkPolyhedron is implemented as a subclass of vtkCell3D. All common API functions of vtkCell3D are implemented. A few critical functions are described briefly as follows.<br />
<br />
InterpolateFunctions, EvaluateLocation and EvaluatePosition: these three functions use vtkMeanValueCoordinateInterpolator to compute the interpolation weights of vertices of a polyhedron cell at any given point position. Note that the point can be interior, exterior or on the surface of the polyhedron cell. <br />
<br />
Triangulate: this function uses vtkOrderedTriangulator to tetrahedralize a polyhedron cell. <br />
<br />
IsInside: this function determines whether a point is inside the polyhedron by shooting rays in multiple random directions then counting the number of intersections with cell faces.<br />
<br />
Contour: this function computes the intersection between a contouring function and a polyhedron and outputs a polygonal contour. When the result contour is non-planar, it will be triangulated then outputs as a triangular mesh.<br />
<br />
Clip: this function clips the input polyhedron and outputs a new polyhedron. A clipping result is shown in Fig. 1.<br />
<br />
<br />
Fig.1 Clipping a polyhedron mesh.<br />
Polyhedron cells as face streams in vtkUnstructuredGrid<br />
<br />
Similar to other 3D cells of VTK such as vtkTetra and vtkHexahedron, vtkPolyhedrons--defined as VTK_POLYHEDRON type in vtkCellTypes.h--are stored as cell elements in vtkUnstructuredGrid. However, previous 3D cells are regular ones whose geometries are fully determined by a set of vertex points with predefined implicit ordering. Unfortunately, such an implicit ordering does not exist in polyhedron cells, the connectivities between polyhedron vertices need to be explicitly defined. The extended vtkUnstructuredGrid stores polyhedron cells as face streams of the following format: [numberOfCellFaces, (numberOfPointsOfFace0, pointId0, pointId1, … ), (numberOfPointsOfFace1, pointId0, pointId1, …), … ]. <br />
<br />
To insert a polyhedron cell into an unstructured grid, the user can use InsertNextCell with a new set of parameter (see below). Where cellType is the type of cell (VTK_POLYHEDRON), nPoints is the number of unique points in the cell, PointIds is the list of the unique cell point Ids, nFaces is the number of faces in the cell, and faces is the face stream defined above but without the numberOfCellFaces element [(numberOfPointsOfFace0, pointId0, pointId1, … ),(numberOfPointsOfFace1, pointId0, pointId1, …),… ]. For instance, a cube has 8 unique points but each point Id will be repeated three times (in three adjacent faces) in the face stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nPoints, vtkIdType *pointIds, vtkIdType nFaces, vtkIdType*faceStream)<br />
<br />
The user can also insert polyhedron cells using InsertNextCell with the old parameter types. But note that the parameters need to be provided in a different format than regular cells. Here faceStream is the face stream without the numberOfCellFaces element, and faceStream1 is the complete face-stream.<br />
<br />
vtkIdType InsertNextCell(int cellType, vtkIdType nFaces, vtkIdType *faceStream) <br />
vtkIdType InsertNextCell(int cellType, vtkIdList *faceStream1);<br />
<br />
To get a polyhedron cell from vtkUnstructuredGrid, the user can use<br />
<br />
void GetFaceStream(vtkIdType cellId, vtkIdType& nFaces, vtkIdType* &faceStream)<br />
void GetFaceStream(vtkIdType cellId, vtkIdList *faceStream1)<br />
IO of polyhedron cells through vtkXMLUnstructuredGridReader/Writer<br />
<br />
Meshes containing polyhedron cells can be read from and write into a XML (.vtm) file using vtkXMLUnstructuredGridReader/Writer. To represent the vertex connectivity of polyhedron cells, we added two additional XML sub-fields to the cells field. <br />
<br />
The original cells field consists of three sub-fields: (1) connectivity—an array storing the point Ids of the unique points of all cells, (2) offsets—an array indicating the end position (1-indexed) of each cell in the connectivity array, and (3) types—an array storing the types of each cell. <br />
<br />
The new sub-fields are (1) faces—an array storing the face streams of all the cells and (2) faceoffsets —an array indicating the end position (1-indexed) of each cell in the faces array. Each cell in the faces array is represented using the face stream described earlier (with numberOfCellFaces).<br />
<br />
These new sub-fields are optional. When a mesh does not contain any polyhedron cell, the new sub-fields will not be included in the XML (.vtm) file.<br />
<br />
3D Mean Value Coordinates Interpolation<br />
<br />
3D mean value coordinates (MVC) interpolation is an elegant yet efficient method for smoothly interpolating closed manifold polyhedrons. Given an input polyhedron with vertices vi (i=1,…,n) and a interpolation point x, the MVC interpolation weights of the vertices wi satisfy the following four preferred properties. (Strictly speaking, positivity property is only valid for convex polyhedrons, the other three properties are valid for both convex and concave polyhedrons). The interpolation/extrapolation point x can be interior, exterior or on the boundary of the input polyhedrons.<br />
<br />
• Affine invariance: <br />
• Linear reproduction: <br />
• Positivity: <br />
• Smoothness: at least C1 continuous.<br />
vtkMeanValueCoordinatesInterpolator filter implements two specific MVC algorithms. The first one is specialized/optimized for tetrahedral meshes [1]. The second one is for general polyhedron meshes [2]. The filter will detect whether the input mesh is tetrahedralized then automatically choose the right algorithm. Details about the two algorithms can be found in the referenced papers. A result of interpolating/extrapolating a hemisphere polyhedron mesh onto a planar mesh is presented in Fig. 2.<br />
<br />
<br />
Fig. 2. MVC interpolation. Vertex colors are defined on the hemisphere (input polyhedron mesh) and are interpolated/extrapolated onto a planar mesh passing through the bottom of the hemisphere. The left and right images respectively show the interpolation result viewed from both sides of the planar mesh. <br />
<br />
References:<br />
[1] Tao Ju, Scott Schaefer, and Joe Warrent, "Mean Value Coordinates for Closed Triangular Meshes", ACM SIGGRAPH 2005. <br />
<br />
[2] Torsten Langer, Alexander Belyaev, and Hans-Peter Seidel, "Spherical Barycentric Coordinates", Eurographics Symposium on Geometry Processing (2006).<br />
<br />
<br />
'''Goals:'''<br />
# Add support for arbitrary polyhedral cell (manifold, watertight, may be concave)<br />
# Develop smooth interpolation functions for polyhedron<br />
# Create filters, examples and testing infrastructure supporting this technology<br />
# Application goal: support CFD solvers (finite volume methods for computational fluid dynamics and similar)<br />
<br />
<br />
'''Summary of Implementation Plan:'''<br />
* Identify interpolation functions<br />
** Mean Value Coordinates <br />
** Triangle meshes ([http://www.cs.wustl.edu/~taoju/research/meanvalue.pdf paper] by Tao Ju et al.)<br />
** Arbitrary polyhedron ([https://domino.mpi-inf.mpg.de/intranet/ag4/ag4publ.nsf/AuthorEditorIndividualView/9144c5ff262d3f9cc12571be00348ddf/$FILE/paper.pdf?OpenElement paper] by Torsten Langer et al.)<br />
* Polyhedron cell support<br />
** vtkPolyhedron - more complex cell in that it requires explicit face representation<br />
** vtkUnstructuredGrid - modified to support polyhedron cell, new InsertNextCell() and related methods (e.g., GetFace()).<br />
** vtkGenericCell (and vtkUnstructuredGrid::GetCell() methods) expanded to include vtkPolyhedron<br />
** vtkCellTypes.h has new #define VTK_POLYHEDRON<br />
* Implement cool related interpolation functions & filters ''(note items in green are complete)''<br />
** <span style="color:green">vtkMeanValueCoordinatesInterpolator</span><br />
** <span style="color:green">vtkProbePolyhedron - probe the region (interior, surface, exterior) around a polyhedral mesh for data values.</span><br />
** <span style="color:green">vtkDeformPointSet - use MVC to deform any vtkPointSet using control mesh</span><br />
** <span style="color:green">vtkExtractPolyhedralMesh - for debugging, convert 3D cells to vtkPolyhedron</span><br />
** Would like to implement some VTK widgets to manipulate meshes<br />
*** vtkPancakeWidget (local surface deformation)<br />
*** vtkControlMeshWidget (for global deformation of geometry)<br />
<br />
<br />
'''Implementation Issues:''' <br />
* VTK File formats and IO<br />
** XML formats<br />
** Legacy formats<br />
* Critical filters /functionality<br />
** <span style="color:green">Geometry Filter - should work once vtkCell::GetCellNeighbors() is implemented</span><br />
** Contouring - some work required<br />
** Clipping - serious work required<br />
** Search (vtkDataSet::FindCell() and FindPoint()) - should work once evaluation functions are implemented<br />
* Impact on previous code<br />
** Previous vtkClipDataSet can now produce polyhedron as output, is this desirable?<br />
<br />
<br />
'''Auxiliary Tasks'''<br />
* vtkPolygon basis functions: replace silly 1/r^2 with the MVC 2D equivalent<br />
<br />
<br />
'''Schedule'''<br />
* Working on core functionality which should be done by mid 2010. Completion of all work depends on funding, schedule and customer support. <br />
** Basics- polygon2d, data API and integration, Mesh2Polyhedra filter, Evaluate/Location/Position functions() in vtkPolyhedron, GetCellNeighbors(), GetFace(), GetFaceIds() (Early March)<br />
** Core- geometry filter, IO (mid-March)<br />
** Algorithms- (clipping, contouring) (early to mid April)<br />
** Final tuning (mid to late April)<br />
<br />
<br />
'''Contacts:'''<br />
* Will Schroeder (will.schroeder at kitware.com)<br />
* Hua Yang (hua.yang at kitware.com)</div>Hua.yang