vtkDistanceWidget Individual Colors for Each End

I’m trying to use the vtkDistanceWidget as more of a vector widget to signify direction. To show the user which direction is from and to, I’m trying to set the color of each cross hair to something different. However, they seem to share the same property and I can’t figure out a way to make them different. Is there anyway to do this? Or a way to switch the axis to an arrow or something that would help make it a direction instead of just a measurement?


Hello Robby,

vtkDistanceWidget has a method called GetDistanceRepresentation(), which returns a pointer to a vtkDistanceRepresentation object. vtkDistanceRepresentation has two methods called GetPoint1Representation() and GetPoint2Representation(). Both return pointers to vtkHandleRepresentation objects. A vtkHandleRepresentation allows to control the appearance of the handles. I didn’t find a simple way to change their colors that does not involve subclassing or hacking, but I suggest you to study the vtkHandleRepresentation's API (https://vtk.org/doc/nightly/html/classvtkHandleRepresentation.html). Maybe you’ll find some other solution to visually distinguish both handles.