VTK/Closed Surface Clipping: Difference between revisions
(Created page with 'The main goal of this project is to make it possible to clip a surface, and then create a "cap" polygon (or polygons) that fill in the area that is enclosed by all the new edges …') |
|||
Line 1: | Line 1: | ||
The main goal of this project is to make it possible to clip a surface, and then create a "cap" polygon (or polygons) that fill in the area that is enclosed by all the new edges that were created by the clipping. In other words, the goal is to close the surface after the clipping has been performed. For this purpose, a new filter called vtkClipClosedSurface has been created. | The main goal of this project is to make it possible to clip a surface, and then create a "cap" polygon (or polygons) that fill in the area that is enclosed by all the new edges that were created by the clipping. In other words, the goal is to close the surface after the clipping has been performed. For this purpose, a new filter called vtkClipClosedSurface has been created. | ||
__NOTOC__ | |||
== Features == | == Features == |
Revision as of 20:57, 28 March 2010
The main goal of this project is to make it possible to clip a surface, and then create a "cap" polygon (or polygons) that fill in the area that is enclosed by all the new edges that were created by the clipping. In other words, the goal is to close the surface after the clipping has been performed. For this purpose, a new filter called vtkClipClosedSurface has been created.
Features
The vtkClipClosedSurface filter has the following features:
- A vtkPlaneCollection is used to set the clip region (arbitrary implicit functions are not allowed).
- If given a closed surface as input, it will produce a closed surface as output.
- If given an open surface as input, it will create a closed surface if a clipping plane is given that clips away all open edges.
- The input surface can be concave, or can be composed of multiple closed, non-intersecting surfaces.
Caveats
The newly-created clip surfaces have the following limitations:
- The triangles in these surfaces are not suitable for FEM applications.
- Although the edges of the clip surface are visually matched with the original surface, polygons that appear to be adjacent are not guaranteed to share an edge.
Options
- GenerateFaces - On by default. If turned off, the output will have no polygons.
- GenerateOutline - Off by default. If turned on, contours will be generated where the planes intersect the surface.
- GenerateScalars - Off by default. Generate color scalars for the output, see below for more.
The GenerateScalars option creates color cell scalars so that the cut surfaces are displayed with a different color than the rest of the surface. Cell scalars are used instead of point scalars because the use of point scalars would require point duplication where the cut surfaces meet the rest of the surface. The same scalars are used for the polygons and the lines that are generated, the lines cannot be colored differently from polys. If you need the lines to be a different color, then you should use two instances of vtkClipClosedSurface: one to generates faces, and another to generates outlines.
If GenerateScalars is on, then three colors can be set:
- ClipColor for the clip surfaces
- BaseColor for the rest of the surface
- ActivePlaneColor to color one clip surface in a different color
The purpose of ActivePlaneColor is to color one cut plane differently, e.g. the plane that the user is interacting with. The ActivePlaneId can be set to specify which of the cut planes is the active plane.
The BaseColor will be ignored if the input already has 3-component color scalars. If this is the case, the original scalars will be used instead of BaseColor. This is useful if you want to chain two vtkClipClosedSurface filters together, or if you want to use vtkClipClosedSurface on the output of vtkOutlineSource or vtkVolumeOutlineSource.
Note that many VTK filters that create new cells (e.g. vtkStripper) will erase the cell scalars. So if you use GenerateScalars, you should avoid using vtkStripper.
Algorithm
This filter uses many of the functions that are built into vtkCell and its subclasses, but it also has several internal functions for polygon manipulation. The tolerance for merging points etc. is set at d*1e-5 where "d" is the maximum dimension of the input bounds. An overall description of what is done for each of the clipping planes is as follows:
- Clip scalars are generated for all points.
- The data is clipped and contoured, using the clip scalars.
- The contours are used to generate the cut faces
- The process is repeated for the next cut plane
Generation of the cut faces from the cut contours is a multi-step process:
- The contour lines are joined tail-to-top to form polygons (it is assumed that the input data is closed).
- If the polygons self-intersect, they are split at the intersection points.
- Any polygon points that aren't at a corner of the polygon are removed.
- The sense of the polygons is set according to the cut plane normal.
- If any polygons are within other polygons, cuts are made between the outer and inner polygons.
- The ear-cut triangulation method of vtkPolygon is used to triangulate the polygons.