private void UnselectPointClick(vtkObject sender, vtkObjectEventArgs e) { if (ModelLoaded == true && SelectionMode == true) { int[] clickPos = Inter.GetEventPosition(); vtkPointPicker PointPicker = vtkPointPicker.New(); PointPicker.SetTolerance(0.05); PointPicker.Pick(clickPos[0], clickPos[1], 0, Viewport); double[] PickPosition = PointPicker.GetPickPosition(); vtkPoints temp = vtkPoints.New(); for (int j = 0; j < SelectionPoints.GetNumberOfPoints(); j++) { if (Math.Abs(SelectionPoints.GetPoint(j)[0] - PickPosition[0]) < 1e-6 && Math.Abs(SelectionPoints.GetPoint(j)[1] - PickPosition[1]) < 1e-6 && Math.Abs(SelectionPoints.GetPoint(j)[2] - PickPosition[2]) < 1e-6) { } else { temp.InsertNextPoint(SelectionPoints.GetPoint(j)[0], SelectionPoints.GetPoint(j)[1], SelectionPoints.GetPoint(j)[2]); } } SelectionPoints.ShallowCopy(temp); SelectionPolyData.SetPoints(SelectionPoints); SelectionGlyph = vtkGlyph3D.New(); SelectionGlyph.SetInput(SelectionPolyData); SelectionGlyph.SetSourceConnection(SelectionSphere.GetOutputPort()); SelectionMapper.SetInputConnection(SelectionGlyph.GetOutputPort()); SelectionActor.SetMapper(SelectionMapper); // Refresh Viewport Refresh(); } }