Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattatz/unity-triangulation2D
Ruppert's Delaunay Refinement Algorithm in Unity
https://github.com/mattatz/unity-triangulation2D
Last synced: 3 months ago
JSON representation
Ruppert's Delaunay Refinement Algorithm in Unity
- Host: GitHub
- URL: https://github.com/mattatz/unity-triangulation2D
- Owner: mattatz
- License: mit
- Created: 2016-06-24T09:42:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-10T09:59:16.000Z (about 8 years ago)
- Last Synced: 2024-07-12T12:36:37.658Z (4 months ago)
- Language: C#
- Size: 2.94 MB
- Stars: 557
- Watchers: 36
- Forks: 82
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-unity-open-source-on-github - unity-triangulation2D - Ruppert's Delaunay Refinement Algorithm (Builder)
README
unity-triangulation2D
=====================Delaunay Triangulation and Ruppert's Delaunay Refinement Algorithm in Unity.
Input contour points for [planar straight-line graph](https://en.wikipedia.org/wiki/Planar_straight-line_graph)
Delaunay Triangulation
Mesh Refinement with minimum angle α(22.5)
## Usage
```cs
// input points for a polygon2D contor
List points = new List();// 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().sharedMesh = mesh;
```## Demo
## Sources
- Jim Ruppert. A Delaunay Refinement Algorithm for Quality 2-Dimensional Mesh Generation - http://www.cis.upenn.edu/~cis610/ruppert.pdf
- Ruppert's algorithm - https://en.wikipedia.org/wiki/Ruppert%27s_algorithm
- Ruppert's Delaunay Refinement Algorithm - https://www.cs.cmu.edu/~quake/tripaper/triangle3.html
- Chapter 7.pdf - http://www.ti.inf.ethz.ch/ew/Lehre/CG13/lecture/Chapter%207.pdf