void SpanningTree() { var points = RandomPoints(400); var vertices = points .Select(p => new Vertex() { Location = p }) .ToList(); var triangulation = Triangulation.CreateDelaunay <Vertex, Face>(vertices); var edges = triangulation.Cells.SelectMany(f => f.GetEdges()) .Distinct() .Where(e => e.Length < 0.2f); var edgeList = edges.ToList(); var graph = edgeList.ToUndirectedGraph <Vertex, Edge>(); var tree = graph.MinimumSpanningTreePrim(GetWeight).ToList(); foreach (var edge in edgeList) { edge.Value = 0.3f; } foreach (var edge in tree) { edge.Value = 1.0f; } SetMeshFromEdges(edgeList); PaintEdges(edgeList); }
/// <summary> /// Triangulate cell with the provided vertices. /// </summary> /// <param name="vertices">The vertices of the cell.</param> /// <returns>The triangulation.</returns> private IEnumerable <DefaultTriangulationCell <MIVertex> > Triangulate(List <Vector3D> vertices) { IEnumerable <DefaultTriangulationCell <MIVertex> > triangles = null; // Convert vertices to objects that work with MIConvexHull library MIVertex[] miVertices = new MIVertex[vertices.Count]; for (int i = 0; i < vertices.Count; i++) { miVertices[i] = new MIVertex(vertices[i].X, vertices[i].Y, vertices[i].Z); } if (vertices.Count == 4) { // MIConvexHull library cannot create a triangulation from a single tetrahedron triangles = new List <DefaultTriangulationCell <MIVertex> >() { new DefaultTriangulationCell <MIVertex>() { Vertices = miVertices } }; } else { // More vertices are OK so let the library to triangulate them var triangulation = Triangulation.CreateDelaunay(miVertices); triangles = triangulation.Cells; } return(triangles); }
public static Vector2 GetSpawnPoint() { var vertices = new Vertex2[4 + spaceships.Count + shots.Count]; var index = 0; var spaceHalfSize = Game.Size / 2; vertices[index++] = new Vertex2(-spaceHalfSize.x, -spaceHalfSize.y); vertices[index++] = new Vertex2(spaceHalfSize.x, -spaceHalfSize.y); vertices[index++] = new Vertex2(-spaceHalfSize.x, spaceHalfSize.y); vertices[index++] = new Vertex2(spaceHalfSize.x, spaceHalfSize.y); foreach (var obj in spaceships) { vertices[index++] = new Vertex2(obj.Position.x, obj.Position.y); } foreach (var obj in shots) { vertices[index++] = new Vertex2(obj.Position.x, obj.Position.y); } var triangulation = Triangulation.CreateDelaunay <Vertex2, Cell2>(vertices); Cell2 maxTriangle = triangulation.Cells.First(); float maxArea = 0; foreach (var triangle in triangulation.Cells) { var area = triangle.Area; if (area > maxArea) { maxArea = area; maxTriangle = triangle; } } return(maxTriangle.Centroid); }
/// <summary> /// returns a list of points of tetrahedrons in a given point cloud /// </summary> /// <param name="pointCloud">input point cloud</param> /// <returns>list of tetrahedrons</returns> public static List <List <Point> > calculateDelaunayTrianglePoints(PointCloud pointCloud) { List <List <Point> > retList = new List <List <Point> >(); try { //create vertex list HashSet <Vertex> vertices = new HashSet <Vertex>(); foreach (Point p in pointCloud.pointcloud_hs) { vertices.Add(new Vertex(p.point.X, p.point.Y, p.point.Z)); } //calculate tetrahedrons var tetrahedrons = Triangulation.CreateDelaunay <Vertex, Tetrahedron>(vertices).Cells; foreach (var c in tetrahedrons) { List <Point> pL = new List <Point>(); for (int i = 0; i < 4; i++) { Point p = new Point(new ANX.Framework.Vector3((float)c.Vertices[i].Position[0], (float)c.Vertices[i].Position[1], (float)c.Vertices[i].Position[2])); pL.Add(p); } retList.Add(pL); } } catch (Exception) { throw; } return(retList); }
static TimeSpan TestNDDelau(int dim, int numVert, double size) { var vertices = CreateRandomVertices(dim, numVert, size); return(RunComputation(() => { var r = Triangulation.CreateDelaunay(vertices); Console.WriteLine(r.Cells.Count()); return r; })); }
/// <summary> /// Ring:划分Delaunay三角网,结果保存于tsData /// </summary> /// <param name="depth">深度</param> /// <param name="interpolateFunc">插值函数</param> public void MeshRing( double depth, Func <IList <Point>, double, double, double, double> interpolateFunc) { try { triangulations = Triangulation.CreateDelaunay(this.allVerticesList); this.TsData.VerticesList = new List <Point3D>(this.allVerticesList.Count); this.TsData.TriLinksList = new List <TriLink>(this.triangulations.Cells.Count()); // 以Dict记录三角形的编号 int num = 1; foreach (var cell in this.triangulations.Cells) { for (int i = 0; i < 3; ++i) { var v = cell.Vertices[i]; if (!this.vertexnumDictionary.ContainsKey(v)) { this.vertexnumDictionary.Add(v, num++); } } // 根据编号写ts的TriLinksList this.TsData.TriLinksList.Add(new TriLink { VertexA = this.vertexnumDictionary[cell.Vertices[0]], VertexB = this.vertexnumDictionary[cell.Vertices[1]], VertexC = this.vertexnumDictionary[cell.Vertices[2]] }); } // 写ts的VerticesList, 并插值Z foreach (var kv in this.vertexnumDictionary.OrderBy(n => n.Value)) { var vPos = kv.Key.Position; var x = vPos[0]; var y = vPos[1]; var z = interpolateFunc(this.edgeVerticesList, depth, x, y); this.TsData.VerticesList.Add(new Point3D(x, y, z)); } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } }
IEnumerable <Edge> DelaunayEdges() { var points = go.Select(l => l.transform.position).ToList(); var vertices = points.Select(p => new Vertex() { Location = p }).ToList(); var delaunay = Triangulation.CreateDelaunay <Vertex, Face>(vertices); var edges = delaunay.Cells .SelectMany(c => c.GetEdges()) .Distinct(); return(edges); }
private void FindDelaunayClick(object sender, RoutedEventArgs e) { try { var now = DateTime.Now; Del_tetras = Triangulation.CreateDelaunay(vertices).Cells.ToList(); var interval = DateTime.Now - now; UpdateTimer(interval); btnDisplay.IsEnabled = btnDisplay.IsDefault = true; CVXvertices = null; CVXfaces = null; Voro_edges = null; Voro_nodes = null; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Information); } }
IEnumerable <Edge> DelaunayEdges(float maxLength) { var points = GetPoints(1_000); var vertices = points.Select(p => new Vertex() { Location = p }).ToList(); var delaunay = Triangulation.CreateDelaunay <Vertex, Face>(vertices); var edges = delaunay.Cells .SelectMany(c => c.GetEdges()) .Distinct() .Where(e => e.Length < maxLength); return(edges); }
/// <summary> /// creates a set of tetrahedrons from a given point cloud /// </summary> /// <param name="pPointCloud">the point cloud</param> /// <returns>a list of tetrahedrons</returns> static List <Tetrahedron> createDelaunayTetrahedrons(PointCloud pPointCloud) { //vars List <Tetrahedron> retVal = new List <Tetrahedron>(); try { //create vertex list HashSet <Vertex> vertices = new HashSet <Vertex>(); foreach (Point p in pPointCloud.pointcloud_hs) { vertices.Add(new Vertex(p.point.X, p.point.Y, p.point.Z)); } retVal = Triangulation.CreateDelaunay <Vertex, Tetrahedron>(vertices).Cells.ToList(); } catch (Exception) { throw; } return(retVal); }
void BunnyEdges() { var points = RandomPoints(400); var vertices = points .Select(p => new Vertex() { Location = p }) .ToList(); var triangulation = Triangulation.CreateDelaunay <Vertex, Face>(vertices); var edges = triangulation.Cells.SelectMany(f => f.GetEdges()); edges = edges.Where(e => e.Length < 0.2f); var edgeList = edges.ToList(); SetMeshFromEdges(edgeList); PaintEdges(edgeList); }
IEnumerator DepthFirstSearchAnimated() { var points = RandomPoints(400); var vertices = points .Select(p => new Vertex() { Location = p }) .ToList(); var triangulation = Triangulation.CreateDelaunay <Vertex, Face>(vertices); var edges = triangulation.Cells.SelectMany(f => f.GetEdges()) .Distinct() .Where(e => e.Length < 0.2f); var edgeList = edges.ToList(); SetMeshFromEdges(edgeList); var graph = edgeList.ToUndirectedGraph <Vertex, Edge>(); var sequence = new List <Edge>(); var s = new UndirectedDepthFirstSearchAlgorithm <Vertex, Edge>(graph); s.ExamineEdge += (o, e) => sequence.Add(e.Edge); s.Compute(graph.Vertices.First()); foreach (var edge in edgeList) { edge.Value = 0.3f; } foreach (var edge in sequence) { edge.Value = 1; PaintEdges(edgeList); yield return(new WaitForSeconds(0.05f)); } }
/// <summary> /// Creates a triangulation of random data. /// For larger data sets it might be a good idea to separate the triangulation calculation /// from creating the visual so that the triangulation can be computed on a separate threat. /// </summary> /// <param name="count">Number of vertices to generate</param> /// <param name="radius">Radius of the vertices</param> /// <param name="uniform"></param> /// <returns>Triangulation</returns> public static RandomTriangulation Create(int count, double radius, bool uniform) { Random rnd = new Random(); List <Vertex> vertices; if (!uniform) { // generate some random points Func <double> nextRandom = () => 2 * radius * rnd.NextDouble() - radius; vertices = Enumerable.Range(0, count) .Select(_ => new Vertex(nextRandom(), nextRandom(), nextRandom())) .ToList(); } else { vertices = new List <Vertex>(); int d = Math.Max((int)Math.Ceiling(Math.Sqrt(count)) / 2, 3); double cs = 2 * radius / (d - 1); for (int i = 0; i < d; i++) { for (int j = 0; j < d; j++) { for (int k = 0; k < d; k++) { vertices.Add(new Vertex(cs * i - cs * (d - 1) / 2, cs * j - cs * (d - 1) / 2, cs * k - cs * (d - 1) / 2)); } } } } // calculate the triangulation var config = !uniform ? new TriangulationComputationConfig() : new TriangulationComputationConfig { PointTranslationType = PointTranslationType.TranslateInternal, PlaneDistanceTolerance = 0.000001, // the translation radius should be lower than PlaneDistanceTolerance / 2 PointTranslationGenerator = TriangulationComputationConfig.RandomShiftByRadius(0.0000001, 0) }; var tetrahedrons = Triangulation.CreateDelaunay <Vertex, Tetrahedron>(vertices, config).Cells; // create a model for each tetrahedron, pick a random color Model3DGroup model = new Model3DGroup(); foreach (var t in tetrahedrons) { var color = Color.FromArgb((byte)255, (byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256)); model.Children.Add(t.CreateModel(color, radius)); } //var redMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Red), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //var greenMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Green), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //var blueMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Blue), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //CylinderMesh c = new CylinderMesh() { Length = 10, Radius = 0.5 }; //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = greenMaterial }); //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = redMaterial, Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 90)) }); //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = blueMaterial, Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 90)) }); var triangulation = new RandomTriangulation(); triangulation.tetrahedrons = tetrahedrons; // assign the Visual3DModel property of the ModelVisual3D class triangulation.Visual3DModel = model; return(triangulation); }
/// <summary> /// Creates a triangulation of random data. /// For larger data sets it might be a good idea to separate the triangulation calculation /// from creating the visual so that the triangulation can be computed on a separate threat. /// </summary> /// <param name="count">Number of vertices to generate</param> /// <param name="radius">Radius of the vertices</param> /// <param name="uniform"></param> /// <returns>Triangulation</returns> public static RandomTriangulation Create(int count, double radius, bool uniform, string[] textValue) { Random rnd = new Random(); List <Vertex> vertices = new List <Vertex>(); if (!uniform) { // generate some random points //Func<double> nextRandom = () => 2 * radius * rnd.NextDouble() - radius; //vertices = Enumerable.Range(0, count) // .Select(_ => new Vertex(nextRandom(), nextRandom(), nextRandom())) // .ToList(); for (int i = 0; i < textValue.Length; i += 3) { vertices.Add(new Vertex(Convert.ToDouble(textValue[i]), Convert.ToDouble(textValue[i + 1]), Convert.ToDouble(textValue[i + 2]))); } } else { vertices = new List <Vertex>(); int d = Math.Max((int)Math.Ceiling(Math.Sqrt(count)) / 2, 3); double cs = 2 * radius / (d - 1); for (int i = 0; i < d; i++) { for (int j = 0; j < d; j++) { for (int k = 0; k < d; k++) { vertices.Add(new Vertex(cs * i - cs * (d - 1) / 2, cs * j - cs * (d - 1) / 2, cs * k - cs * (d - 1) / 2)); } } } } var tetrahedrons = Triangulation.CreateDelaunay <Vertex, Tetrahedron>(vertices).Cells; // create a model for each tetrahedron, pick a random color Model3DGroup model = new Model3DGroup(); foreach (var t in tetrahedrons) { var color = Color.FromArgb((byte)255, (byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256)); model.Children.Add(t.CreateModel(color, radius)); } //var redMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Red), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //var greenMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Green), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //var blueMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Blue), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //CylinderMesh c = new CylinderMesh() { Length = 10, Radius = 0.5 }; //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = greenMaterial }); //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = redMaterial, Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 90)) }); //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = blueMaterial, Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 90)) }); var triangulation = new RandomTriangulation(); triangulation.tetrahedrons = tetrahedrons; int OBJIndex = 1, OBJTextureIndex = 1; Dictionary <string, OBJNormalVertex> OBJNormalVertexList = new Dictionary <string, OBJNormalVertex>(); Dictionary <string, string> OBJTextureKeyList = new Dictionary <string, string>(); Dictionary <string, int> OBJTextureList = new Dictionary <string, int>(); foreach (var Element in vertices) { string textVertex = string.Format("v {0} {1} {2}", Element.Position[0], Element.Position[1], Element.Position[2]); string textTexture = string.Format("vt {0} {1}", (Element.Position[0] + 50) / 100, (Element.Position[1] + 50) / 100); OBJTextureKeyList.Add(textVertex, textTexture); OBJNormalVertexList.Add(textVertex, new OBJNormalVertex(OBJIndex++, 0, new double[] { 0, 0, 0 }, "")); if (OBJTextureList.ContainsKey(textTexture) == false) { OBJTextureList.Add(textTexture, OBJTextureIndex++); } } foreach (var Element in tetrahedrons) { for (int i = 0; i < 3; i++) { string textVertex = string.Format("v {0} {1} {2}", Element.Vertices[i].Position[0], Element.Vertices[i].Position[1], Element.Vertices[i].Position[2]); OBJNormalVertexList[textVertex].count++; OBJNormalVertexList[textVertex].NormalVertex[0] += Element.Normal[0]; OBJNormalVertexList[textVertex].NormalVertex[1] += Element.Normal[1]; OBJNormalVertexList[textVertex].NormalVertex[2] += Element.Normal[2]; } } foreach (var Element in OBJNormalVertexList) { Element.Value.ArrangeNormalVertex(); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\DEVMF\Desktop\File\VS\MIConvexHull-master\MIConvexHull-master\Examples\7DelaunayWPF\output.txt")) { foreach (var Element in OBJNormalVertexList) { file.WriteLine(Element.Key); } file.WriteLine(); foreach (var Element in OBJNormalVertexList) { file.WriteLine(Element.Value.NormalVertexQuery); } file.WriteLine(); foreach (var Element in OBJTextureList) { file.WriteLine(Element.Key); } file.WriteLine(); foreach (var Element in tetrahedrons) { string query1 = string.Format("v {0} {1} {2}", Element.Vertices[0].Position[0], Element.Vertices[0].Position[1], Element.Vertices[0].Position[2]); string query2 = string.Format("v {0} {1} {2}", Element.Vertices[1].Position[0], Element.Vertices[1].Position[1], Element.Vertices[1].Position[2]); string query3 = string.Format("v {0} {1} {2}", Element.Vertices[2].Position[0], Element.Vertices[2].Position[1], Element.Vertices[2].Position[2]); string face1 = string.Format("{0}/{1}/{2}", OBJNormalVertexList[query1].index, OBJTextureList[OBJTextureKeyList[query1]], OBJNormalVertexList[query1].index); string face2 = string.Format("{0}/{1}/{2}", OBJNormalVertexList[query2].index, OBJTextureList[OBJTextureKeyList[query2]], OBJNormalVertexList[query2].index); string face3 = string.Format("{0}/{1}/{2}", OBJNormalVertexList[query3].index, OBJTextureList[OBJTextureKeyList[query3]], OBJNormalVertexList[query3].index); string face = string.Format("f {0} {1} {2}", face1, face2, face3); file.WriteLine(face); } } //foreach (var Element in OBJVertexAndVormalVertex) // if (Element.Value.isNegative) // OBJVertexTexture.Add(Element.Value.vertexTexture, VTindex++); // assign the Visual3DModel property of the ModelVisual3D class triangulation.Visual3DModel = model; return(triangulation); }
/// <summary> /// Triangulate cell with the provided vertices. /// </summary> /// <param name="vertices">The vertices of the cell.</param> /// <returns>The triangulation.</returns> private IEnumerable <DefaultTriangulationCell <MIVertex> > Triangulate(List <Vector2D> vertices) { if (vertices.Count == 3) { // Convert vertices to objects that work with MIConvexHull library MIVertex[] miVertices = new MIVertex[vertices.Count]; for (int i = 0; i < vertices.Count; i++) { miVertices[i] = new MIVertex(vertices[i].X, vertices[i].Y); } // MIConvexHull library cannot create a triangulation from a single triangle return(new List <DefaultTriangulationCell <MIVertex> >() { new DefaultTriangulationCell <MIVertex>() { Vertices = miVertices } }); } else if (vertices.Count == 4) { // There are problems with 4 vertices in MIConvexHull algorithms. There are multiple issues on their github Vector2D average = new Vector2D(); for (int i = 0; i < vertices.Count; i++) { average.X += vertices[i].X; average.Y += vertices[i].Y; } average.X /= vertices.Count; average.Y /= vertices.Count; // Convert vertices to objects that work with MIConvexHull library List <MIVertex> miVertices = new List <MIVertex>(vertices.Count); for (int i = 0; i < vertices.Count; i++) { miVertices.Add(new MIVertex(vertices[i].X, vertices[i].Y)); } miVertices.Sort(Comparer <MIVertex> .Create((item1, item2) => { var position1 = item1.Position; var position2 = item2.Position; double a1 = ((Math.Atan2(position1[0] - average.X, position1[1] - average.Y) * 180 / Math.PI) + 360) % 360; double a2 = ((Math.Atan2(position2[0] - average.X, position2[1] - average.Y) * 180 / Math.PI) + 360) % 360; return((int)(a1 - a2)); })); var triangles = new List <DefaultTriangulationCell <MIVertex> >(); for (int i = 1; i < miVertices.Count - 1; i++) { MIVertex[] tempVertices = { miVertices[0], miVertices[i], miVertices[i + 1] }; triangles.Add(new DefaultTriangulationCell <MIVertex>() { Vertices = tempVertices }); } return(triangles); } else { // Convert vertices to objects that work with MIConvexHull library MIVertex[] miVertices = new MIVertex[vertices.Count]; for (int i = 0; i < vertices.Count; i++) { miVertices[i] = new MIVertex(vertices[i].X, vertices[i].Y); } // More vertices are OK so let the library to triangulate them var triangulation = Triangulation.CreateDelaunay(miVertices); return(triangulation.Cells); } }
/// <summary> /// Creates a triangulation of random data. /// For larger data sets it might be a good idea to separate the triangulation calculation /// from creating the visual so that the triangulation can be computed on a separate threat. /// </summary> /// <param name="count">Number of vertices to generate</param> /// <param name="radius">Radius of the vertices</param> /// <returns>Triangulation</returns> public static RandomTriangulation Create(int count, double radius) { Random rnd = new Random(); // generate some random points Func <double> nextRandom = () => 2 * radius * rnd.NextDouble() - radius; var vertices = Enumerable.Range(0, count) .Select(_ => new Vertex(nextRandom(), nextRandom(), nextRandom())) .ToList(); //var vertices = new List<Vertex>(); //int d = 4; //double cs = 10.0; //for (int i = 0; i < d; i++) //{ // for (int j = 0; j < d; j++) // { // for (int k = 0; k < d; k++) // { // //vertices.Add(new Vertex(10 * i - 20 + rnd.NextDouble(), 10 * j - 20 - rnd.NextDouble(), 10 * k - 20 + rnd.NextDouble())); // vertices.Add(new Vertex(-10 * i, 10 * j, 10 * k)); // } // } //} // calculate the triangulation var tetrahedrons = Triangulation.CreateDelaunay <Vertex, Tetrahedron>(vertices).Cells; // create a model for each tetrahedron, pick a random color Model3DGroup model = new Model3DGroup(); foreach (var t in tetrahedrons) { var color = Color.FromArgb((byte)255, (byte)rnd.Next(256), (byte)rnd.Next(256), (byte)rnd.Next(256)); model.Children.Add(t.CreateModel(color, radius)); } //var redMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Red), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //var greenMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Green), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //var blueMaterial = new MaterialGroup //{ // Children = new MaterialCollection // { // new DiffuseMaterial(Brushes.Blue), // // give it some shine // new SpecularMaterial(Brushes.LightYellow, 2.0) // } //}; //CylinderMesh c = new CylinderMesh() { Length = 10, Radius = 0.5 }; //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = greenMaterial }); //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = redMaterial, Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 90)) }); //model.Children.Add(new GeometryModel3D { Geometry = c.Geometry, Material = blueMaterial, Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 90)) }); var triangulation = new RandomTriangulation(); triangulation.tetrahedrons = tetrahedrons; // assign the Visual3DModel property of the ModelVisual3D class triangulation.Visual3DModel = model; return(triangulation); }
static TimeSpan TestNDDelau(int dim, int numVert, double size) { var vertices = CreateRandomVertices(dim, numVert, size); return(RunComputation(() => Triangulation.CreateDelaunay(vertices))); }