------------------------------------------------------------------------------
| 341 | |
| 342 | //------------------------------------------------------------------------------ |
| 343 | void 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 | //------------------------------------------------------------------------------ |
| 378 | void vtkPolyLineRepresentation::PrintSelf(ostream& os, vtkIndent indent) |
no test coverage detected