private void OnChildrenChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { foreach (BoneVM child in e.NewItems) { Visual.Children.Add(child.Visual); LinesVisual3D linkVisual = new LinesVisual3D(); linkVisual.Points = new Point3DCollection(new[] { new Point3D(0, 0, 0), child.Offset.ToPoint3D() }); childLinkVisualMap.Add(child, linkVisual); Visual.Children.Add(linkVisual); UpdateLinkVisual(child); } } else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) { foreach (BoneVM child in e.OldItems) { Model.Children.Remove(child.Model); Visual.Children.Remove(child.Visual); Visual.Children.Remove(childLinkVisualMap[child]); } } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsEndSite))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name))); }
private void CreateFrame() { _up = new Vector3D(0, 0, 1); _horDirection = new Vector3D(1, 0, 0); //_model3D = // Text3D.CreateTextLabel3D( // "000", // Brushes.Black, true, 0.2, // new Point3D(0, 0, 0), Location.Center, // _horDirection, _up); //this.Content = _model3D; uPline = new LinesVisual3D(); uPline.Points.Add(new Point3D(0, 0, 0)); uPline.Points.Add(new Point3D(0, 0, 1)); uPline.Thickness = 2; uPline.Color = Colors.Blue; lookline = new LinesVisual3D(); lookline.Points.Add(new Point3D(0, 0, 0)); lookline.Points.Add(new Point3D(0, 0, 0) + _horDirection); lookline.Thickness = 2; lookline.Color = Colors.Blue; this.Children.Add(uPline); this.Children.Add(lookline); }
public void AddPath(dynamic reference, Point3D[] Points, int thickness = 5) { if (Points.Length < 2) { return; } LinesVisual3D l = null; if (HasPath(reference)) { RemoveModel(reference); } l = new LinesVisual3D(); Paths.Add(reference, l); ModelViewer.Children.Add(l); l.Thickness = thickness; l.Color = Colors.Black; l.Children.Clear(); for (int i = 0; i < Points.Length; i++) { l.Points.Add(Points[i]); if (i != 0 && i != Points.Length - 1) { l.Points.Add(Points[i]); } } ModelView.UpdateLayout(); }
public LinesVisual3D GetXParallels(bool onlyVisible) { LinesVisual3D XLines = new LinesVisual3D(); for (int i = 0; i < Nz; i++) { for (int j = i; j <= i + Ny * Nz - Nz; j += Nz) { for (int k = j; k < j + Nx * Ny * Nz - Ny * Nz; k += Ny * Nz) { if (onlyVisible) { if (visibleIndeces.Contains(k) && visibleIndeces.Contains(k + Ny * Nz)) { XLines.Points.Add(nodesPoints[k]); XLines.Points.Add(nodesPoints[k + Ny * Nz]); } } else { XLines.Points.Add(nodesPoints[k]); XLines.Points.Add(nodesPoints[k + Ny * Nz]); } } } } return(XLines); }
public LinesVisual3D GetYParallels() { LinesVisual3D YLines = new LinesVisual3D(); for (int i = 0; i < Nx * Ny * Nz; i += Ny * Nz) { for (int j = i; j < i + Nz; j++) { for (int k = j; k < j + Ny * Nz - Nz; k += Nz) { if (visibleIndeces.Contains(k) && visibleIndeces.Contains(k + Nz)) { outerYParallels.Points.Add(nodesPoints[k]); outerYParallels.Points.Add(nodesPoints[k + Nz]); } else { innerYParallels.Points.Add(nodesPoints[k]); innerYParallels.Points.Add(nodesPoints[k + Nz]); } } } } return(YLines); }
private void addLines() { LinesVisual3D yLine = new LinesVisual3D(); LinesVisual3D xLine = new LinesVisual3D(); LinesVisual3D zLine = new LinesVisual3D(); yLine.Color = Colors.Red; xLine.Color = Colors.Gold; zLine.Color = Colors.Black; Point3D center = new Point3D(0, 0, 0); Point3D yPoint = new Point3D(0, 200, 0); Point3D xPoint = new Point3D(200, 0, 0); Point3D zPoint = new Point3D(0, 0, 200); yLine.Points.Add(center); yLine.Points.Add(yPoint); xLine.Points.Add(center); xLine.Points.Add(xPoint); zLine.Points.Add(center); zLine.Points.Add(zPoint); viewPort3d.Children.Add(xLine); viewPort3d.Children.Add(yLine); viewPort3d.Children.Add(zLine); }
public LinesVisual3D GetZParallels(bool onlyVisible) { LinesVisual3D ZLines = new LinesVisual3D(); for (int i = 0; i < Nx * Ny; i++) { for (int j = i * Nz; j < Nz * (i + 1) - 1; j++) { if (onlyVisible) { if (visibleIndeces.Contains(j) && visibleIndeces.Contains(j + 1)) { ZLines.Points.Add(nodesPoints[j]); ZLines.Points.Add(nodesPoints[j + 1]); } } else { ZLines.Points.Add(nodesPoints[j]); ZLines.Points.Add(nodesPoints[j + 1]); } } } return(ZLines); }
/// <summary> /// Creates a rather ugly visual representatino of the polyline. /// Fixed in size with respect to the model. /// </summary> /// <param name="highlighted">The destination visual component to replace the content of.</param> internal void SetToVisual(MeshVisual3D highlighted) { if (_geomPoints == null) { return; } var lines = new LinesVisual3D { Color = Colors.Yellow }; var axesMeshBuilder = new MeshBuilder(); List <Point3D> path = new List <Point3D>(); foreach (var item in _geomPoints) { axesMeshBuilder.AddSphere(item.Point, 0.1); path.Add(item.Point); } if (_geomPoints.Count > 1) { double lineThickness = 0.05; axesMeshBuilder.AddTube(path, lineThickness, 9, false); } highlighted.Content = new GeometryModel3D(axesMeshBuilder.ToMesh(), Materials.Yellow); }
private void SetDraw(object sender, RoutedEventArgs e) { if (checkDraw.IsChecked.GetValueOrDefault()) { tmpArrete = new LinesVisual3D(); tmpArrete.Color = colorLines; tmpArrete.Thickness = 0.01; tmpPoints = new PointsVisual3D(); tmpPoints.Color = colorPoints; tmpPoints.Size = 0.05; bufArrete = new Point3DCollection(); bufPoint = new Point3DCollection(); listePoints.Add(tmpPoints); listeLignes.Add(tmpArrete); ViewPort.Children.Add(listeLignes.Last()); ViewPort.Children.Add(listePoints.Last()); nbTraits.Content = "Nombre de traits : " + listeLignes.Count; timer.Tick += new EventHandler(drawPoints); timer.Start(); } }
private void DrawMeridians(List <List <NurbsPoint> > controlNet, decimal[] circleKnotVector) { var knotU = this.CurveKnotVector; var knotV = circleKnotVector; controlNet = controlNet.Transpose(); var stepV = 1M / (controlNet.Count * 10); for (var v = 0M; v.LessThanOrEqualTo(1M); v += stepV) { var curvePoints = new List <Point3D>(); var stepU = 1M / (controlNet.First().Count * 10); for (var u = 0M; u.LessThanOrEqualTo(1M); u += stepU) { var point = SpaceLogic.DeBoorSurface(controlNet, u, knotU, v, knotV).ToPoint3D(); curvePoints.Add(point); curvePoints.Add(point); } curvePoints.RemoveAt(curvePoints.Count - 1); curvePoints.RemoveAt(0); var pts = new Point3DCollection(curvePoints); var curve = new LinesVisual3D { Color = Colors.Blue, Points = pts, Thickness = 1 }; this.HelixView.Children.Add(curve); } }
public CSysVisual3D() { // set a random depth offset to avoid flickering (depth fighting) var rand = new Random(); XVisual = new LinesVisual3D(); XVisual.DepthOffset = 0.0001 * rand.NextDouble(); XVisual.Points.Add(new Point3D()); XVisual.Points.Add(new Point3D(1, 0, 0)); Children.Add(XVisual); YVisual = new LinesVisual3D(); YVisual.DepthOffset = 0.0001 * rand.NextDouble(); YVisual.Points.Add(new Point3D()); YVisual.Points.Add(new Point3D(0, 1, 0)); Children.Add(YVisual); ZVisual = new LinesVisual3D(); ZVisual.DepthOffset = 0.0001 * rand.NextDouble(); ZVisual.Points.Add(new Point3D()); ZVisual.Points.Add(new Point3D(0, 0, 1)); Children.Add(ZVisual); Thickness = 4; XColor = Colors.Red; YColor = Colors.Green; ZColor = Colors.Blue; Length = 1; }
/// <summary> /// Shows the vertex paths with solid. /// </summary> /// <param name="segments">The segments.</param> /// <param name="solids">The solids.</param> public static void ShowVertexPathsWithSolid(IList <double[]> segments, IList <TessellatedSolid> solids) { var window = new Window3DPlot(); var models = new List <Visual3D>(); foreach (var tessellatedSolid in solids) { var model = MakeModelVisual3D(tessellatedSolid); models.Add(model); window.view1.Children.Add(model); } foreach (var point in segments) { var lineCollection = new List <Point3D> { new Point3D(point[0], point[1], point[2]), new Point3D(point[3], point[4], point[5]) }; var color = new System.Windows.Media.Color(); color.R = 255; //G & B default to 0 to form red var lines = new LinesVisual3D { Points = new Point3DCollection(lineCollection) }; window.view1.Children.Add(lines); } window.view1.FitView(window.view1.Camera.LookDirection, window.view1.Camera.UpDirection); window.ShowDialog(); }
/// <summary> /// Shows vertex paths. Assumes paths are closed. /// </summary> /// <param name="vertexPaths">The vertex paths.</param> public static void ShowVertexPaths(IList <List <List <Vertex> > > vertexPaths) { var window = new Window3DPlot(); foreach (var crossSection in vertexPaths) { foreach (var path in crossSection) { var contour = path.Select(point => new Point3D(point.X, point.Y, point.Z)).ToList(); //No create a line collection by doubling up the points var lineCollection = new List <Point3D>(); foreach (var t in contour) { lineCollection.Add(t); lineCollection.Add(t); } lineCollection.RemoveAt(0); lineCollection.Add(lineCollection.First()); var lines = new LinesVisual3D { Points = new Point3DCollection(lineCollection) }; window.view1.Children.Add(lines); } } window.view1.FitView(window.view1.Camera.LookDirection, window.view1.Camera.UpDirection); window.ShowDialog(); }
public static void ShowAndHang(VoxelizedSolid solid, IEnumerable <Polygon> polygons) { var window = new Window3DPlot(); var models = new List <Visual3D>(); Visual3D model = MakeModelVisual3D(solid); models.Add(model); window.view1.Children.Add(model); foreach (var polygon in polygons.SelectMany(poly => poly.AllPolygons)) { //Now create a line collection by doubling up the points var lineCollection = new List <Point3D>(); foreach (var line in polygon.Edges) { lineCollection.Add(new Point3D(line.FromPoint.X, line.FromPoint.Y, 0)); lineCollection.Add(new Point3D(line.ToPoint.X, line.ToPoint.Y, 0)); } var lines = new LinesVisual3D { Points = new Point3DCollection(lineCollection), Thickness = 5, Color = Colors.Red }; window.view1.Children.Add(lines); } window.view1.FitView(window.view1.Camera.LookDirection, window.view1.Camera.UpDirection); window.ShowDialog(); }
/// <summary> /// 描画用の線を取得する /// </summary> /// <param name="track"></param> /// <returns></returns> private LinesVisual3D GetLines(List<Vector> track) { var lines = new LinesVisual3D(); for(var i = 0;i < track.Count - 1;i++) { var position1 = track[i]; var point1 = new Point3D() { X = position1.X, Y = position1.Y, Z = position1.Z, }; lines.Points.Add(point1); var position2 = track[i + 1]; var point2 = new Point3D() { X = position2.X, Y = position2.Y, Z = position2.Z, }; lines.Points.Add(point2); } lines.Transform = GetTransform(Vector.Zero, Vector.Forward, Vector.One); return lines; }
private void showWireframe_Checked(object sender, RoutedEventArgs e) { foreach (List <int> pts in this.faces) { if (pts != null) { int index = 0; for (index = 0; index < pts.Count - 1; index++) { LinesVisual3D line = new LinesVisual3D(); line.Color = Colors.Gold; line.Thickness = 1; line.Points.Add(this.points[pts[index]]); line.Points.Add(this.points[pts[index + 1]]); viewport.Children.Add(line); } LinesVisual3D line2 = new LinesVisual3D(); line2.Color = Colors.Gold; line2.Thickness = 1; line2.Points.Add(this.points[pts[index++]]); line2.Points.Add(this.points[pts[0]]); viewport.Children.Add(line2); } } }
public void Load(string fileName) { var probing = DataContext as ProbingViewModel; probing.HeightMap.HasHeightMap = false; probing.HeightMap.Map = HeightMap.Load(fileName); probing.HeightMap.GridSize = probing.HeightMap.Map.GridX; probing.HeightMap.MinX = probing.HeightMap.Map.Min.X; probing.HeightMap.MinY = probing.HeightMap.Map.Min.Y; probing.HeightMap.MaxX = probing.HeightMap.Map.Max.X; probing.HeightMap.MaxY = probing.HeightMap.Map.Max.Y; LinesVisual3D boundary = new LinesVisual3D(); PointsVisual3D mapPoints = new PointsVisual3D(); MeshGeometryVisual3D mesh = new MeshGeometryVisual3D(); // TODO: fix HeightMap object... probing.HeightMap.Map.GetModel(mesh); probing.HeightMap.Map.GetPreviewModel(boundary, mapPoints); probing.HeightMap.MeshGeometry = mesh.MeshGeometry; probing.HeightMap.BoundaryPoints = boundary.Points; probing.HeightMap.MapPoints = mapPoints.Points; probing.HeightMap.HasHeightMap = true; }
/// <summary> /// Adds a point to the current trace with a specified color. /// </summary> /// <param name="point">The (X,Y,Z) location.</param> /// <param name="color">The color.</param> /// <param name="thickness">The line thickness (optional).</param> /// <seealso cref="AddPoint(double, double, double, Color, double)"/> public void AddPoint(Point3D point, Color color, double thickness = -1) { if (trace == null) { NewTrace(point, color, (thickness > 0) ? thickness : 1); return; } if ((point - point0).LengthSquared < minDistanceSquared) { return; // less than min distance from last point } if (path.Color != color || (thickness > 0 && path.Thickness != thickness)) { if (thickness <= 0) { thickness = path.Thickness; } path = new LinesVisual3D(); path.Color = color; path.Thickness = thickness; trace.Add(path); parentViewport.Children.Add(path); } // If line segments AB and BC have the same direction (small cross product) then remove point B. bool sameDir = false; var delta = new Vector3D(point.X - point0.X, point.Y - point0.Y, point.Z - point0.Z); delta.Normalize(); // use unit vectors (magnitude 1) for the cross product calculations if (path.Points.Count > 0) { double xp2 = Vector3D.CrossProduct(delta, delta0).LengthSquared; sameDir = (xp2 < 0.0005); // approx 0.001 seems to be a reasonable threshold from logging xp2 values //if (!sameDir) Title = string.Format("xp2={0:F6}", xp2); } if (sameDir) // extend the current line segment { path.Points[path.Points.Count - 1] = point; point0 = point; delta0 += delta; } else // add a new line segment { path.Points.Add(point0); path.Points.Add(point); point0 = point; delta0 = delta; } if (marker != null) { marker.Origin = point; coords.Position = new Point3D(point.X - labelOffset, point.Y - labelOffset, point.Z + labelOffset); coords.Text = string.Format(coordinateFormat, point.X, point.Y, point.Z); } }
public void RemoveRailPoints(LinesVisual3D rail) { foreach (LinesVisual3D r in rail.Children) { RemoveRailPoints(r); } rail.Points.Clear(); }
public VertexManipulator() { m_lines = new LinesVisual3D { Color = Colors.White, Thickness = 2 }; m_previewLines = new LinesVisual3D { Color = Colors.PaleGreen, Thickness = 2 }; }
protected override Visual3D CreateVisual(SceneActor renderItem) { LinesVisual3D wireframeVisual = new LinesVisual3D(); wireframeVisual.Points = renderItem.Geometry.Positions; wireframeVisual.Thickness = 2; wireframeVisual.Color = Color.FromArgb(255, 0, 180, 20); return(wireframeVisual); }
/// <summary> /// Creates the grid. /// </summary> private void CreateGrid() { var majorLinePoints = new Point3DCollection(); var minorLinePoints = new Point3DCollection(); this.lengthDirection = this.LengthDirection; this.lengthDirection.Normalize(); this.widthDirection = Vector3D.CrossProduct(this.Normal, this.lengthDirection); this.widthDirection.Normalize(); double minX = -this.Width / 2; double minY = -this.Length / 2; double maxX = this.Width / 2; double maxY = this.Length / 2; double z = this.MajorDistance * 1e-4; double x = minX; double eps = this.MinorDistance / 10; while (x <= maxX + eps) { var pc = IsMultipleOf(x, this.MajorDistance) ? majorLinePoints : minorLinePoints; AddLine(pc, this.GetPoint(x, minY, z), this.GetPoint(x, maxY, z)); x += this.MinorDistance; } double y = minY; while (y <= maxY + eps) { var pc = IsMultipleOf(y, this.MajorDistance) ? majorLinePoints : minorLinePoints; AddLine(pc, this.GetPoint(minX, y, 0), this.GetPoint(maxY, y, 0)); y += this.MinorDistance; } var majorLines = new LinesVisual3D { Color = this.MajorLineColor, Thickness = this.MajorLineThickness, Points = majorLinePoints, IsRendering = true }; var minorLines = new LinesVisual3D { Color = this.MinorLineColor, Thickness = this.MinorLineThickness, Points = minorLinePoints, IsRendering = true }; this.Children.Add(majorLines); this.Children.Add(minorLines); }
private void AddLine() { var line = new LinesVisual3D() { Color = this.visualizationObject.Configuration.Color }; this.lines.Add(line); this.Children.Add(line); }
public override ModelVisual3D To3DViz() { LinesVisual3D line = new LinesVisual3D(); line.Points.Add(from.ToPoint3D()); line.Points.Add(to.ToPoint3D()); line.Thickness = PropertyServer.LineThickness; return(line); }
void UnselectPath(dynamic reference) { if (!HasPath(reference)) { return; } LinesVisual3D l = Paths[reference]; l.Color = Colors.Black; }
/// <summary> /// Shows the vertex paths with solid. /// </summary> /// <param name="vertexPaths">The vertex paths.</param> /// <param name="solids">The solids.</param> public static void ShowVertexPathsWithSolid(IEnumerable <IEnumerable <IEnumerable <Vector3> > > vertexPaths, IEnumerable <TessellatedSolid> solids, bool closeLoops = true) { var window = new Window3DPlot(); var models = new List <Visual3D>(); foreach (var tessellatedSolid in solids) { var model = MakeModelVisual3D(tessellatedSolid); models.Add(model); window.view1.Children.Add(model); } var random = new Random(); foreach (var crossSection in vertexPaths) { foreach (var path in crossSection) { var contour = path.Select(point => new Point3D(point.X, point.Y, point.Z)).ToList(); //Now create a line collection by doubling up the points var lineCollection = new List <Point3D>(); foreach (var t in contour) { lineCollection.Add(t); lineCollection.Add(t); } lineCollection.RemoveAt(0); if (closeLoops) { lineCollection.Add(lineCollection.First()); } else { lineCollection.RemoveAt(lineCollection.Count - 1); } var colFamily = Constants.ColorDictionary[(TVGL.ColorFamily)random.Next(12)]; var colorKeyList = colFamily.Keys.ToList(); var tvglcolor = colFamily[colorKeyList[random.Next(colorKeyList.Count)]]; var color = new System.Windows.Media.Color(); color.R = tvglcolor.R; color.G = tvglcolor.G; color.B = tvglcolor.B; var lines = new LinesVisual3D { Points = new Point3DCollection(lineCollection), Color = color, Thickness = 3.0 }; window.view1.Children.Add(lines); } } window.view1.FitView(window.view1.Camera.LookDirection, window.view1.Camera.UpDirection); window.ShowDialog(); }
private void OnCompleted() { bool ok; var probing = DataContext as ProbingViewModel; if ((ok = probing.IsSuccess)) { probing.GotoMachinePosition(probing.StartPosition, AxisFlags.Z); probing.GotoMachinePosition(probing.StartPosition, AxisFlags.X | AxisFlags.Y); if (probing.HeightMap.SetToolOffset) { if (probing.CoordinateMode == ProbingViewModel.CoordMode.G10) { probing.Grbl.ExecuteCommand(string.Format("G10L2P{0}Z{1}", probing.CoordinateSystem, (probing.Positions[0].Z - probing.Grbl.ToolOffset.Z).ToInvariantString())); } else if ((ok == probing.GotoMachinePosition(probing.Positions[0], AxisFlags.Z))) { probing.Grbl.ExecuteCommand("G92Z0"); probing.GotoMachinePosition(probing.StartPosition, AxisFlags.Z); if (!probing.Grbl.IsParserStateLive) { probing.Grbl.ExecuteCommand("$G"); } } } double Z0 = probing.Positions[0].Z, z_min = 0d, z_max = 0d, z_delta; foreach (var pos in probing.Positions) { z_delta = pos.Z - Z0; z_min = Math.Min(z_min, z_delta); z_max = Math.Max(z_max, z_delta); probing.HeightMap.Map.AddPoint(toIndex(pos.X - probing.StartPosition.X), toIndex(pos.Y - probing.StartPosition.Y), Math.Round(z_delta, probing.Grbl.Precision)); } LinesVisual3D boundary = new LinesVisual3D(); PointsVisual3D mapPoints = new PointsVisual3D(); MeshGeometryVisual3D mesh = new MeshGeometryVisual3D(); // TODO: fix HeightMap object... probing.HeightMap.Map.GetModel(mesh); probing.HeightMap.Map.GetPreviewModel(boundary, mapPoints); probing.HeightMap.MeshGeometry = mesh.MeshGeometry; probing.HeightMap.BoundaryPoints = boundary.Points; probing.HeightMap.MapPoints = mapPoints.Points; probing.HeightMap.HasHeightMap = true; probing.Program.End(ok ? string.Format("Probing completed: Z min: {0}, Z max: {1}", z_min.ToInvariantString(probing.Grbl.Format), z_max.ToInvariantString(probing.Grbl.Format)) : "Probing failed"); } }
protected virtual void OnScaleFactorPropertyChanged(DependencyPropertyChangedEventArgs e) { var oldValue = (int)e.OldValue; var newValue = (int)e.NewValue; if (oldValue != newValue) { if (newValue > 0) { if (_lines != null) { RemoveVisualChildren(_lines, _xaxis, _yaxis, _zaxis); } _lines = new LinesVisual3D { Thickness = 0.5, Color = Colors.Black, Points = new Point3DCollection(new[] { new Point3D(-newValue, +newValue, +newValue), new Point3D(+newValue, +newValue, +newValue), new Point3D(-newValue, +newValue, -newValue), new Point3D(+newValue, +newValue, -newValue), new Point3D(-newValue, -newValue, +newValue), new Point3D(+newValue, -newValue, +newValue), new Point3D(-newValue, -newValue, -newValue), new Point3D(+newValue, -newValue, -newValue), new Point3D(+newValue, -newValue, +newValue), new Point3D(+newValue, +newValue, +newValue), new Point3D(+newValue, -newValue, -newValue), new Point3D(+newValue, +newValue, -newValue), new Point3D(-newValue, -newValue, +newValue), new Point3D(-newValue, +newValue, +newValue), new Point3D(-newValue, -newValue, -newValue), new Point3D(-newValue, +newValue, -newValue), new Point3D(+newValue, +newValue, -newValue), new Point3D(+newValue, +newValue, +newValue), new Point3D(+newValue, -newValue, -newValue), new Point3D(+newValue, -newValue, +newValue), new Point3D(-newValue, +newValue, -newValue), new Point3D(-newValue, +newValue, +newValue), new Point3D(-newValue, -newValue, -newValue), new Point3D(-newValue, -newValue, +newValue), }) }; _xaxis = MakeArrowVisual(newValue, 0, 0, Brushes.Red); _yaxis = MakeArrowVisual(0, newValue, 0, Brushes.Green); _zaxis = MakeArrowVisual(0, 0, newValue, Brushes.Blue); AddVisualChildren(_lines, _xaxis, _yaxis, _zaxis); } } }
public void GetModel(LinesVisual3D line, LinesVisual3D rapid, LinesVisual3D arc) { var sw = System.Diagnostics.Stopwatch.StartNew(); Point3DCollection linePoints = new Point3DCollection(); Point3DCollection rapidPoints = new Point3DCollection(); Point3DCollection arcPoints = new Point3DCollection(); foreach (Command c in Toolpath) { var l = c as Line; if (l != null) { if (!l.StartValid) { continue; } if (l.Rapid) { rapidPoints.Add(l.Start.ToPoint3D()); rapidPoints.Add(l.End.ToPoint3D()); } else { linePoints.Add(l.Start.ToPoint3D()); linePoints.Add(l.End.ToPoint3D()); } continue; } var a = c as Arc; if (a != null) { foreach (Motion sub in a.Split(Settings.Default.ViewportArcSplit)) { arcPoints.Add(sub.Start.ToPoint3D()); arcPoints.Add(sub.End.ToPoint3D()); } } } line.Points = linePoints; rapid.Points = rapidPoints; arc.Points = arcPoints; sw.Stop(); Console.WriteLine("Generating the toolpath model took {0} ms", sw.ElapsedMilliseconds); }
/// <summary> /// Initializes a new instance of the <see cref="CameraIntrinsicsVisual3D"/> class. /// </summary> public CameraIntrinsicsVisual3D() { // Create frustum lines for (int i = 0; i < 8; i++) { var linesVisual3D = new LinesVisual3D() { Color = this.color, }; for (int p = 0; p < 2; p++) { linesVisual3D.Points.Add(default);