// selection public override void Select(ViewportRect rect, TransformMatrix matrix, Viewport3D viewport3d) { int nDotNo = GetDataNo(); if (nDotNo == 0) { return; } double xMin = rect.XMin(); double xMax = rect.XMax(); double yMin = rect.YMin(); double yMax = rect.YMax(); for (int i = 0; i < nDotNo; i++) { ScatterPlotItem plotItem = Get(i); Point pt = matrix.VertexToViewportPt(new Point3D(plotItem.x, plotItem.y, plotItem.z), viewport3d); if ((pt.X > xMin) && (pt.X < xMax) && (pt.Y > yMin) && (pt.Y < yMax)) { m_vertices[i].selected = true; } else { m_vertices[i].selected = false; } } }
public Plot3D() { _wireframes = new ScreenSpaceLines3D { Color = Colors.SteelBlue }; _axis = new ScreenSpaceLines3D { Color = Colors.Black, Thickness = 0.5 }; _model3d = new Model3D(); _transformMatrix = new TransformMatrix(); _selectRect = new ViewportRect(); InitializeComponent(); var tg = TrackBall.Transform as Transform3DGroup; if (tg != null && tg.Children.Count == 2) { _scale = (ScaleTransform3D)tg.Children[0]; _rotate = (AxisAngleRotation3D)((RotateTransform3D)tg.Children[1]).Rotation; TrackBall.Viewport3D.Camera.Transform = tg; } MainViewport.Children.Add(_wireframes); MainViewport.Children.Add(_axis); TrackBall.IsManipulationEnabled = true; TrackBall.ManipulationDelta += TouchDelta; TrackBall.ManipulationStarted += TouchStarted; TrackBall.PreviewMouseWheel += MouseWheelRotated; }
// selection public override void Select(ViewportRect rect, TransformMatrix matrix, Viewport3D viewport3D) { var nDotNo = GetDataNo(); if (nDotNo == 0) { return; } var xMin = rect.XMin(); var xMax = rect.XMax(); var yMin = rect.YMin(); var yMax = rect.YMax(); for (var i = 0; i < nDotNo; i++) { var plotItem = Get(i); if (plotItem == null) { continue; } var pt = matrix.VertexToViewportPt(new Point3D(plotItem.x, plotItem.y, plotItem.z), viewport3D); if ((pt.X > xMin) && (pt.X < xMax) && (pt.Y > yMin) && (pt.Y < yMax)) { MVertices[i].selected = true; } else { MVertices[i].selected = false; } } }
public override void Select(ViewportRect rect, TransformMatrix matrix, Viewport3D viewport3d) { var nDotNo = GetDataNo(); if (nDotNo != 0) { var xMin = rect.MinX(); var xMax = rect.MaxX(); var yMin = rect.MinY(); var yMax = rect.MaxY(); for (var i = 0; i < nDotNo; i++) { var pt = matrix.VertexToViewportPt(new Point3D(_vertices[i].X, _vertices[i].Y, _vertices[i].Z), viewport3d); _vertices[i].IsSelected = (pt.X > xMin) && (pt.X < xMax) && (pt.Y > yMin) && (pt.Y < yMax); } } }
// selection public override void Select(ViewportRect rect, TransformMatrix matrix, Viewport3D viewport3d) { int nDotNo = GetDataNo(); if (nDotNo == 0) return; double xMin = rect.XMin(); double xMax = rect.XMax(); double yMin = rect.YMin(); double yMax = rect.YMax(); for (int i = 0; i < nDotNo; i++) { ScatterPlotItem plotItem = Get(i); Point pt = matrix.VertexToViewportPt(new Point3D(plotItem.x, plotItem.y, plotItem.z), viewport3d); if ((pt.X > xMin) && (pt.X < xMax) && (pt.Y > yMin) && (pt.Y < yMax)) { m_vertices[i].selected = true; } else { m_vertices[i].selected = false; } } }
// select public virtual void Select(ViewportRect rect, TransformMatrix matrix, Viewport3D viewport3d) { }