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

Method InsertHandleOnLine

Interaction/Widgets/vtkSplineWidget.cxx:1334–1371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1332}
1333
1334void vtkSplineWidget::InsertHandleOnLine(double* pos)
1335{
1336 if (this->NumberOfHandles < 2)
1337 {
1338 return;
1339 }
1340
1341 vtkIdType id = this->LinePicker->GetCellId();
1342 if (id == -1)
1343 {
1344 return;
1345 }
1346
1347 vtkIdType subid = this->LinePicker->GetSubId();
1348
1349 vtkPoints* newpoints = vtkPoints::New(VTK_DOUBLE);
1350 newpoints->SetNumberOfPoints(this->NumberOfHandles + 1);
1351
1352 int istart = vtkMath::Floor(
1353 subid * (this->NumberOfHandles + this->Closed - 1.0) / static_cast<double>(this->Resolution));
1354 int istop = istart + 1;
1355 int count = 0;
1356 int i;
1357 for (i = 0; i <= istart; ++i)
1358 {
1359 newpoints->SetPoint(count++, this->HandleGeometry[i]->GetCenter());
1360 }
1361
1362 newpoints->SetPoint(count++, pos);
1363
1364 for (i = istop; i < this->NumberOfHandles; ++i)
1365 {
1366 newpoints->SetPoint(count++, this->HandleGeometry[i]->GetCenter());
1367 }
1368
1369 this->InitializeHandles(newpoints);
1370 newpoints->Delete();
1371}
1372
1373void vtkSplineWidget::EraseHandle(const int& index)
1374{

Callers 2

OnRightButtonUpMethod · 0.95
EndWidgetInteractionMethod · 0.45

Calls 7

InitializeHandlesMethod · 0.95
DeleteMethod · 0.65
NewFunction · 0.50
GetCellIdMethod · 0.45
SetNumberOfPointsMethod · 0.45
SetPointMethod · 0.45
GetCenterMethod · 0.45

Tested by

no test coverage detected