[vtkusers] Clipping accuracy

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Sun Feb 9 15:57:09 EST 2003


Hi Jonas,
  Yes you are right, vtk uses linear interpolation. As you suggest the edge
could be refined, a method with a user specified resolution and a limit on
the number of iterations could do it. The hard part is deciding where to
implement this. vtkCell->Clip is abstract so going any lower requires
changing each cell type; maybe it is better done in vtkClipPolyData. For
completeness it would be nice if other clip/cut filters supported this too.
The existing vtkClipPolyData class could have methods added, eg:
SetEdgeRefinementOn()...  If enabled, the call to cell->Clip would be
iterated until the desired resolution or iteration limit is reached. If not
enabled the current behaviour occurs: a one-shot call to cell->Clip.
So, you feel like tweaking vtkClipPolyData? let me know if you do, I am
interested.

For some hacks:
1 - use vtkLinearSubdivisionFilter (or perhaps one of its peers) to split
your original polygons into smaller pieces, then the resolution of the edge
is improved. 2 or 3 iterations is usually enough, before it gets very slow.
This is ugly because ALL polygons are subdivided, but only a few intersect
the edge.

2 - clip your polydata as usual, use SetGenerateClippedOutput( 1 ). Pass
both GetOutput and GetClippedOutput to vtkAppendPolyData. Then feed back
through vtkClipPolyData again. Repeat if necessary. I have not tried this
but did suggest it some time back to someone. It sounds plausible. The
polygons around the edge will get smaller, and closer to the actual edge.
This is basically a high level 'outer loop' way of doing edge refinement.

If you are capable working in C++ (as opposed to tcl, python etc) I suggest
tweaking the vtkClipPolyData code. It probably wont take much longer than
the other approaches, and at the end you could have a very useful
contribution for vtk.

  regards
    Dave Pont



|--------+---------------------------------->
|        |          Jonas Chapuis           |
|        |          <Jonas.Chapuis at MEMcenter|
|        |          .unibe.ch>              |
|        |          Sent by:                |
|        |          vtkusers-admin at public.ki|
|        |          tware.com               |
|        |                                  |
|        |                                  |
|        |          06/02/2003 04:27        |
|        |                                  |
|--------+---------------------------------->
  >------------------------------------------------------------------------------------------------------------|
  |                                                                                                            |
  |      To:     vtkusers at public.kitware.com                                                                   |
  |      cc:                                                                                                   |
  |      Subject:     [vtkusers] Clipping accuracy                                                             |
  >------------------------------------------------------------------------------------------------------------|




Hello all,

I'm trying to clip PolyData with a boolean implicit function. This
function is a combination of two orthogonal planes. The result of the
clipping is not accurate - this is especialy visible when cliping long
triangles for instance.

I strongly suspect the cause of this problem is the way VTK determines
the exact position of the intersection points on the edges of the
polygons. It is linearly interpolated from the scalar values calculated
for the two endpoints of the edge, and thus inexact in the case of an
non-linear implicit function like mine.

Is there any workaround for this problem ? Would it be somehow posible
to tell the Clip function of the cell how to determine the intersection
point, not by interpolating, but by probing on the edges where the
implicit function equals the clip isovalue (0 by default) ?

Thanks, regards,

jonas

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers







More information about the vtkusers mailing list