[vtkusers] Computing distance using distance widget with previously set points

Hector Dejea hectordejea at gmail.com
Mon Jul 7 05:35:08 EDT 2014


Dear all,

I am trying to implement a distance widget with a previously set
representation (I want to give the points programatically and not by
clicking on the screen). I tried the following code and the distance
computed is correct, but the widget shows a line joining two points that
are not the ones I typed in the code.

In the attached image, the blue lines joins the correct points, the green
one corresponds to the widget.

Thanks,
Hector

    vtkSmartPointer<vtkDistanceWidget> distanceWidget =
    vtkSmartPointer<vtkDistanceWidget>::New();
    distanceWidget->SetInteractor(renderWindowInteractor);
    distanceWidget->CreateDefaultRepresentation();
    vtkDistanceRepresentation * distRep =
distanceWidget->GetDistanceRepresentation();
    distRep->SetPoint1WorldPosition(PointInit);
    distRep->SetPoint2WorldPosition(PointEnd);
    distanceWidget->SetWidgetStateToManipulate();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140707/6ca362dd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2014-07-07 11:34:10.png
Type: image/png
Size: 38177 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140707/6ca362dd/attachment.png>


More information about the vtkusers mailing list