MCPcopy Create free account
hub / github.com/Kitware/VTK / InsertHandleOnLine

Method InsertHandleOnLine

Interaction/Widgets/vtkCameraPathRepresentation.cxx:352–384  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

350
351//------------------------------------------------------------------------------
352int vtkCameraPathRepresentation::InsertHandleOnLine(double* pos)
353{
354 if (this->NumberOfHandles < 2 || pos == nullptr)
355 {
356 return -1;
357 }
358
359 vtkIdType id = this->LinePicker->GetCellId();
360 if (id == -1)
361 {
362 return -1;
363 }
364
365 vtkIdType subid = this->LinePicker->GetSubId();
366
367 int istart = vtkMath::Floor(
368 subid * (this->NumberOfHandles + this->Closed - 1.0) / static_cast<double>(this->Resolution));
369
370 istart++;
371
372 // insert new camera
373 vtkNew<vtkCamera> cam;
374 cam->SetPosition(pos);
375
376 // calculate the new focal point
377 vtkVector3d focusPoint1(this->CameraHandles[istart - 1]->GetDirection());
378 vtkVector3d focusPoint2(this->CameraHandles[istart % this->NumberOfHandles]->GetDirection());
379 focusPoint1 = (focusPoint1 + focusPoint2) / vtkVector3d(2.0);
380 cam->SetFocalPoint(focusPoint1.GetData());
381
382 this->AddCameraAt(cam, istart);
383 return istart;
384}
385
386//------------------------------------------------------------------------------
387void vtkCameraPathRepresentation::EraseHandle(const int& index)

Callers

nothing calls this directly

Calls 7

AddCameraAtMethod · 0.95
vtkVector3dClass · 0.50
GetCellIdMethod · 0.45
SetPositionMethod · 0.45
GetDirectionMethod · 0.45
SetFocalPointMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected