| 1393 | } |
| 1394 | |
| 1395 | void vtkSplineWidget::InitializeHandles(vtkPoints* points) |
| 1396 | { |
| 1397 | if (!points) |
| 1398 | { |
| 1399 | return; |
| 1400 | } |
| 1401 | |
| 1402 | int npts = points->GetNumberOfPoints(); |
| 1403 | if (npts < 2) |
| 1404 | { |
| 1405 | return; |
| 1406 | } |
| 1407 | |
| 1408 | double p0[3]; |
| 1409 | double p1[3]; |
| 1410 | |
| 1411 | points->GetPoint(0, p0); |
| 1412 | points->GetPoint(npts - 1, p1); |
| 1413 | |
| 1414 | if (vtkMath::Distance2BetweenPoints(p0, p1) == 0.0) |
| 1415 | { |
| 1416 | --npts; |
| 1417 | this->Closed = 1; |
| 1418 | this->ParametricSpline->ClosedOn(); |
| 1419 | } |
| 1420 | |
| 1421 | this->SetNumberOfHandles(npts); |
| 1422 | int i; |
| 1423 | for (i = 0; i < npts; ++i) |
| 1424 | { |
| 1425 | this->SetHandlePosition(i, points->GetPoint(i)); |
| 1426 | } |
| 1427 | |
| 1428 | if (this->Interactor && this->Enabled) |
| 1429 | { |
| 1430 | this->Interactor->Render(); |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | int vtkSplineWidget::IsClosed() |
| 1435 | { |