unity-triangulation2D, 统一算法中Ruppert求精算法的Delaunay

分享于 

2分钟阅读

GitHub

  繁體 雙語
Ruppert's Delaunay Refinement Algorithm in Unity
  • 源代码名称:unity-triangulation2D
  • 源代码网址:http://www.github.com/mattatz/unity-triangulation2D
  • unity-triangulation2D源代码文档
  • unity-triangulation2D源代码下载
  • Git URL:
    git://www.github.com/mattatz/unity-triangulation2D.git
    Git Clone代码到本地:
    git clone http://www.github.com/mattatz/unity-triangulation2D
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/mattatz/unity-triangulation2D
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    unity-triangulation2D

    基于ruppert的细化算法apriori三角化及它的。

    平面直线图的输入轮廓点

    Delaunay三角剖分

    最小角度 α ( 22 5 ) 网格细化

    用法

    
    
    
    
    // input points for a polygon2D contor
    
    
    List<Vector2> points = new List<Vector2>();
    
    
    
    // Add Vector2 to points
    
    
    points.Add(new Vector2(-2.5f, -2.5f));
    
    
    points.Add(new Vector2(2.5f, -2.5f));
    
    
    points.Add(new Vector2(4.5f, 2.5f));
    
    
    points.Add(new Vector2(0.5f, 4.5f));
    
    
    points.Add(new Vector2(-3.5f, 2.5f));
    
    
    
    // construct Polygon2D 
    
    
    Polygon2D polygon = Polygon2D.Contour(points.ToArray());
    
    
    
    // construct Triangulation2D with Polygon2D and threshold angle (18f ~ 27f recommended)
    
    
    Triangulation2D triangulation = new Triangulation2D(polygon, 22.5f);
    
    
    
    // build a mesh from triangles in a Triangulation2D instance
    
    
    Mesh mesh = triangulation.Build();
    
    
    // GetComponent<MeshFilter>().sharedMesh = mesh;
    
    
    
    

    演示


    REF  算法  DEL  Unity  三角剖分  rup  
    相关文章