vtkImprintFilter leaving holes and non-manifold edges

I am trying to use vtkImprintFilter to imprint flat text on a box. Most of the time it works well, but occasionally it will leave holes and non-manifold in its output. This seems to happen most often when an edge of the text line up closely with an edge on the target. See the following example:

OutputType is MergedImprint (the orange part is a back-facing cell from the other side of the box)

When looking at just the ImprintedCells for the same example, the cells that are missing in the MergedImprint are still there

OutputType is ImprintedCells

The following image is the same as above but, with the “ImprintedCells” scalars visible

Zooming into the point indicated by the red circle we can see that it successfully imprinted the near coincident line.

OutputType is ImprintedCells

The following image is the same shot as above, but of the MergedImprinted rather than the ImprintedCells. Notice the cell that is missing (the orange part is a back-facing cell from the other side of the box).

My current hypothesis is that because the cell that is marked with the F-1 point is not labeled as a transition cell (in green) and the original cell from the original target is not the same (as it was split during the imprint), that when merging the ImprintedCells into the original target neither side can account for that area.

If someone (possibly @will.schroeder since I think you are the main author and maintainer of this filter) could take a look, I would greatly appreciate it.

Extra info:

  • The box is being generated by creating a vtkRectilinearGrid of the size I want and running that through a vtkDataSetSurfaceFilter and a vtkTriangleFilter to get the box polydata.
  • The text is being generated via vtkVectorText and running that through a vtkTriangleFilter
  • Turning BoundaryEdgeInsertion on or off does not seem to make a difference

I am using the following code to run the imprint

imprint = vtk.vtkImprintFilter()
imprint.SetTargetData(boxPolyData)
imprint.SetImprintData(textPolyData)
imprint.SetOutputTypeToMergedImprint()
imprint.BoundaryEdgeInsertionOn()
imprint.SetTolerance(1.0e-6)
imprint.SetMergeTolerance(1e-6)
imprint.SetMergeToleranceTypeToAbsolute()
imprint.Update()
2 Likes

Conner, I’ll take a look later today/tomorrow morning and see if I can make progress. Imprint is unfortunately a geometric modeling operator and occasionally fiddling with the tolerances is necessary - I don’t like this but there is a reason that robust geometric modeling engines take lots of time to create…

Also, there may be a race condition that was recently reported, so it’s time to get back into this beast.

Yes I am the one who reported the race condition after stumbling across it while trying to look into this :slight_smile:. I tried adjusting the tolerances some, but was unable to get something stable.

Hi. I didn’t know about this filter

I was able to imprint text in the past by using the text source, then linear extrusion, then boolean difference or union (from vtkbool) to the targetModel

Hope it helps