How to correctly use the coincidenttopology related methods on a mapper ?

Hi,

I have a polydata mapped as as surface, and a second one relying on the same points (but with only a few cells) that I want properly displayed above the first one.

I read that the coincident topology related methods of one or both mappers should help me do that.
But I can’t find the right way to use them.
Could anyone help me ?
Should I set them only on one of the two mappers or on both ?
Which method should I use and how ?
Or is there a documentation about that that I missed ?

Thank you !

The vtkMapper class has static methods for setting application-wide offsets for polygons, lines and points. ( SetResolveCoincidentTopologyPolygonOffsetParameters, etc.) The vtkMapper classes also have methods for setting actor-specific offsets for polygons, lines and points ( SetRelativeCoincidentTopologyPolygonOffsetParameters, etc.). The net offset is the sum of both, for the type of primitive. The offsets are specified by factor and unit, but the value for factor is not used anymore. Positive values shift the primitive away from the camera, negative values shift the primitive to towards the camera.

The defaults for the static offset-units are 0, -4, -8 for polygons, lines and points respectively, meaning that polygons are not shifted, lines are brought forward by some amount and points are brought forward by double that amount. The relative offset-values are all 0 by default.

If you have two actors that render overlaying polygons you can specify a negative relative polygon-offset unit-value for the actor that you want to appear in front, or a positive value for the one that should be pushed back, or a bit of both. You’ll have to experiment a bit with which values are most appropriate for your situation.

I wrote a script to test/demonstrate our use of the coincident topology parameters, which may be of use to you.

Note that the coincident topology behavior changed since 8.1.1 (or maybe 8.2 I’m not sure).
The factor is no longer used for polygons and lines. The 9.0 versions scale the net unit (the sum of common and relative unit values) for an actor by the actor’s length. This caused problems for us which were the reason for me to develop this script. As of 9.1 this scaling by actor length has been reverted (thanks @sankhesh!).

coincident-topology-demo.py (14.6 KB)

1 Like

Hi,
thanks a lot for this script and sorry for taking so long to thank you :slight_smile:

I did not have time to look at it in details yet but I will do it very soon.

Hopefuly what you did with VTK can also be done with vtk.js…