Ejemplo n.º 1
0
 private void SetVisibilitiesForTriUsingDiameter(double p)
 {
     for (int i = 0; i < retMesh.Faces.Count; i++)
     {
         ConcaveGenerator.DelaunayConcave.Triangle t = retMesh.Faces[i];
         Point2d p0 = retMesh.Points[t.P0Index];
         Point2d p1 = retMesh.Points[t.P1Index];
         Point2d p2 = retMesh.Points[t.P2Index];
         if (ConcaveGenerator.DelaunayConcave.DelaunayTriangulation.Diameter(p0.X, p0.Y, p1.X, p1.Y, p2.X, p2.Y) >= p)
         {
             for (int j = 0; j < CA_Main.Children.Count; j++)
             {
                 Line edge = CA_Main.Children[j] as Line;
                 if (edge != null && (int)edge.Tag == i)
                 {
                     edge.Visibility = Visibility.Hidden;
                 }
             }
         }
         else
         {
             for (int j = 0; j < CA_Main.Children.Count; j++)
             {
                 Line edge = CA_Main.Children[j] as Line;
                 if (edge != null && (int)edge.Tag == i)
                 {
                     edge.Visibility = Visibility.Visible;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void BTN_Cal_Click(object sender, RoutedEventArgs e)
 {
     if (CB_List.SelectedIndex == 0)
     {
         this.retMesh = DelaunayConcave.GetMesh(pointList);
         for (int i = 0; i < retMesh.Faces.Count; i++)
         {
             ConcaveGenerator.DelaunayConcave.Triangle t = retMesh.Faces[i];
             DrawLine_Delauney(retMesh.Points[t.P0Index], retMesh.Points[t.P1Index], "A0");
             DrawLine_Delauney(retMesh.Points[t.P0Index], retMesh.Points[t.P2Index], "A0");
             DrawLine_Delauney(retMesh.Points[t.P1Index], retMesh.Points[t.P2Index], "A0");
         }
         retMesh.InitEdgesInfo();
         retMesh.ExecuteEdgeDecimation(R);
         List <ConcaveGenerator.DelaunayConcave.EdgeInfo> edges = retMesh.GetBoundaryEdges();
         for (int i = 0; i < edges.Count; i++)
         {
             DrawLine(retMesh.Points[edges[i].P0Index], retMesh.Points[edges[i].P1Index], null);
         }
     }
     if (CB_List.SelectedIndex == 1)
     {
         BallConcave cc = new BallConcave(this.pointList);
         if (cc.GetRecomandedR() > R)
         {
             ShowMessage("R值不合法,可点检查参数!");
             return;
         }
         cc.main = this;
         List <Point2d> ret = cc.GetConcave_Ball(R);
         DrawPolyline(ret);
     }
     if (CB_List.SelectedIndex == 2)
     {
         BallConcave cc = new BallConcave(this.pointList);
         if (cc.GetRecomandedR() > R)
         {
             ShowMessage("R值不合法,可点检查参数!");
             return;
         }
         cc.main = this;
         List <Point2d> ret = cc.GetConcave_Edge(R);
         DrawPolyline(ret);
     }
 }