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

Method InitializeHandles

Interaction/Widgets/vtkPolyLineRepresentation.cxx:343–375  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

341
342//------------------------------------------------------------------------------
343void vtkPolyLineRepresentation::InitializeHandles(vtkPoints* points)
344{
345 if (!points)
346 {
347 vtkErrorMacro(<< "ERROR: Invalid or nullptr points\n");
348 return;
349 }
350
351 int npts = points->GetNumberOfPoints();
352 if (npts < 2)
353 {
354 return;
355 }
356
357 double p0[3];
358 double p1[3];
359
360 points->GetPoint(0, p0);
361 points->GetPoint(npts - 1, p1);
362
363 if (vtkMath::Distance2BetweenPoints(p0, p1) == 0.0)
364 {
365 --npts;
366 this->Closed = 1;
367 this->PolyLineSource->ClosedOn();
368 }
369
370 this->SetNumberOfHandles(npts);
371 for (int i = 0; i < npts; ++i)
372 {
373 this->SetHandlePosition(i, points->GetPoint(i));
374 }
375}
376
377//------------------------------------------------------------------------------
378void vtkPolyLineRepresentation::PrintSelf(ostream& os, vtkIndent indent)

Callers 1

InsertHandleOnLineMethod · 0.95

Calls 4

SetNumberOfHandlesMethod · 0.95
GetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45
SetHandlePositionMethod · 0.45

Tested by

no test coverage detected