├── .gitignore ├── Assets ├── TriangleDotNet.meta └── TriangleDotNet │ ├── Editor.meta │ ├── Editor │ ├── RunGitShell.cs │ └── RunGitShell.cs.meta │ ├── Materials.meta │ ├── Materials │ ├── Wall.mat │ ├── Wall.mat.meta │ ├── unity-icon.mat │ └── unity-icon.mat.meta │ ├── Scenes.meta │ ├── Scenes │ ├── DelaunayDemo.unity │ └── DelaunayDemo.unity.meta │ ├── TestScripts.meta │ ├── TestScripts │ ├── DelaunayDemo.cs │ ├── DelaunayDemo.cs.meta │ ├── InputGeometryExtensions.cs │ ├── InputGeometryExtensions.cs.meta │ ├── LightMover.cs │ ├── LightMover.cs.meta │ ├── ReloadScene.cs │ ├── ReloadScene.cs.meta │ ├── UPolygon.cs │ └── UPolygon.cs.meta │ ├── Triangle.meta │ ├── Triangle │ ├── Algorithm.meta │ ├── Algorithm │ │ ├── Dwyer.cs │ │ ├── Dwyer.cs.meta │ │ ├── ITriangulator.cs │ │ ├── ITriangulator.cs.meta │ │ ├── Incremental.cs │ │ ├── Incremental.cs.meta │ │ ├── SweepLine.cs │ │ └── SweepLine.cs.meta │ ├── BadTriQueue.cs │ ├── BadTriQueue.cs.meta │ ├── Behavior.cs │ ├── Behavior.cs.meta │ ├── Carver.cs │ ├── Carver.cs.meta │ ├── Data.meta │ ├── Data │ │ ├── BadSubseg.cs │ │ ├── BadSubseg.cs.meta │ │ ├── BadTriangle.cs │ │ ├── BadTriangle.cs.meta │ │ ├── Osub.cs │ │ ├── Osub.cs.meta │ │ ├── Otri.cs │ │ ├── Otri.cs.meta │ │ ├── Segment.cs │ │ ├── Segment.cs.meta │ │ ├── Triangle.cs │ │ ├── Triangle.cs.meta │ │ ├── Vertex.cs │ │ └── Vertex.cs.meta │ ├── Enums.cs │ ├── Enums.cs.meta │ ├── Geometry.meta │ ├── Geometry │ │ ├── BoundingBox.cs │ │ ├── BoundingBox.cs.meta │ │ ├── Edge.cs │ │ ├── Edge.cs.meta │ │ ├── EdgeEnumerator.cs │ │ ├── EdgeEnumerator.cs.meta │ │ ├── ISegment.cs │ │ ├── ISegment.cs.meta │ │ ├── ITriangle.cs │ │ ├── ITriangle.cs.meta │ │ ├── InputGeometry.cs │ │ ├── InputGeometry.cs.meta │ │ ├── Point.cs │ │ ├── Point.cs.meta │ │ ├── RegionPointer.cs │ │ └── RegionPointer.cs.meta │ ├── IO.meta │ ├── IO │ │ ├── DataReader.cs │ │ ├── DataReader.cs.meta │ │ ├── DebugWriter.cs │ │ ├── DebugWriter.cs.meta │ │ ├── FileReader.cs │ │ ├── FileReader.cs.meta │ │ ├── FileWriter.cs │ │ ├── FileWriter.cs.meta │ │ ├── IGeometryFormat.cs │ │ ├── IGeometryFormat.cs.meta │ │ ├── IMeshFormat.cs │ │ ├── IMeshFormat.cs.meta │ │ ├── InputTriangle.cs │ │ ├── InputTriangle.cs.meta │ │ ├── TriangleFormat.cs │ │ └── TriangleFormat.cs.meta │ ├── Log.meta │ ├── Log │ │ ├── ILog.cs │ │ ├── ILog.cs.meta │ │ ├── ILogItem.cs │ │ ├── ILogItem.cs.meta │ │ ├── SimpleLog.cs │ │ ├── SimpleLog.cs.meta │ │ ├── SimpleLogItem.cs │ │ └── SimpleLogItem.cs.meta │ ├── Mesh.cs │ ├── Mesh.cs.meta │ ├── NewLocation.cs │ ├── NewLocation.cs.meta │ ├── Primitives.cs │ ├── Primitives.cs.meta │ ├── Properties.meta │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── AssemblyInfo.cs.meta │ ├── Quality.cs │ ├── Quality.cs.meta │ ├── Sampler.cs │ ├── Sampler.cs.meta │ ├── Smoothing.meta │ ├── Smoothing │ │ ├── ISmoother.cs │ │ ├── ISmoother.cs.meta │ │ ├── SimpleSmoother.cs │ │ └── SimpleSmoother.cs.meta │ ├── Tools.meta │ ├── Tools │ │ ├── AdjacencyMatrix.cs │ │ ├── AdjacencyMatrix.cs.meta │ │ ├── BoundedVoronoi.cs │ │ ├── BoundedVoronoi.cs.meta │ │ ├── CuthillMcKee.cs │ │ ├── CuthillMcKee.cs.meta │ │ ├── IVoronoi.cs │ │ ├── IVoronoi.cs.meta │ │ ├── QuadTree.cs │ │ ├── QuadTree.cs.meta │ │ ├── QualityMeasure.cs │ │ ├── QualityMeasure.cs.meta │ │ ├── RegionIterator.cs │ │ ├── RegionIterator.cs.meta │ │ ├── Statistic.cs │ │ ├── Statistic.cs.meta │ │ ├── Voronoi.cs │ │ ├── Voronoi.cs.meta │ │ ├── VoronoiRegion.cs │ │ └── VoronoiRegion.cs.meta │ ├── Triangle.csproj │ ├── Triangle.csproj.meta │ ├── TriangleLocator.cs │ └── TriangleLocator.cs.meta │ ├── UnityVS.meta │ └── UnityVS │ ├── Editor.meta │ └── Editor │ ├── SyntaxTree.VisualStudio.Unity.Bridge.dll │ ├── SyntaxTree.VisualStudio.Unity.Bridge.dll.meta │ ├── SyntaxTree.VisualStudio.Unity.Messaging.dll │ ├── SyntaxTree.VisualStudio.Unity.Messaging.dll.meta │ ├── UnityVS.VersionSpecific.dll │ └── UnityVS.VersionSpecific.dll.meta └── ProjectSettings ├── AudioManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset └── TimeManager.asset /.gitignore: -------------------------------------------------------------------------------- 1 | #unity specific stuff 2 | 3 | [Ll]ibrary/ 4 | [Tt]emp/ 5 | [Oo]bj/ 6 | [Bb]uild/ 7 | 8 | # Autogenerated VS/MD solution and project files 9 | /*.csproj 10 | /*.unityproj 11 | /*.sln 12 | /*.suo 13 | /*.user 14 | /*.userprefs 15 | /*.pidb 16 | /*.booproj 17 | 18 | #Unity3D Generated File On Crash Reports 19 | sysinfo.txt 20 | 21 | # ========================= 22 | # Operating System Files 23 | # ========================= 24 | 25 | # OSX 26 | # ========================= 27 | 28 | .DS_Store 29 | .AppleDouble 30 | .LSOverride 31 | 32 | # Thumbnails 33 | ._* 34 | 35 | # Files that might appear on external disk 36 | .Spotlight-V100 37 | .Trashes 38 | 39 | # Directories potentially created on remote AFP share 40 | .AppleDB 41 | .AppleDesktop 42 | Network Trash Folder 43 | Temporary Items 44 | .apdisk 45 | 46 | # Windows 47 | # ========================= 48 | 49 | # Windows image file caches 50 | Thumbs.db 51 | ehthumbs.db 52 | 53 | # Folder config file 54 | Desktop.ini 55 | 56 | # Recycle Bin used on file shares 57 | $RECYCLE.BIN/ 58 | 59 | # Windows Installer files 60 | *.cab 61 | *.msi 62 | *.msm 63 | *.msp 64 | 65 | # Windows shortcuts 66 | *.lnk 67 | 68 | #visual studio specific stuff 69 | 70 | Morpher/[Rr]elease/ 71 | Morpher/[Dd]ebug/ 72 | 73 | # Visual Studo 2015 cache/options directory 74 | Morpher/.vs/ 75 | 76 | *_i.c 77 | *_p.c 78 | *_i.h 79 | *.ilk 80 | *.obj 81 | *.pch 82 | *.pdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *.log 93 | *.vspscc 94 | *.vssscc 95 | .builds 96 | *.pidb 97 | *.svclog 98 | *.scc 99 | 100 | # Chutzpah Test files 101 | Morpher/_Chutzpah* 102 | 103 | # Visual C++ cache files 104 | Morpher/ipch/ 105 | *.aps 106 | *.ncb 107 | *.opensdf 108 | *.sdf 109 | *.cachefile 110 | 111 | # Visual Studio profiler 112 | *.psess 113 | *.vsp 114 | *.vspx 115 | 116 | # ReSharper is a .NET coding add-in 117 | _ReSharper*/ 118 | *.[Rr]e[Ss]harper 119 | *.DotSettings.user 120 | 121 | 122 | # Backup & report files from converting an old project file 123 | # to a newer Visual Studio version. Backup files are not needed, 124 | # because we have git ;-) 125 | Morpher/_UpgradeReport_Files/ 126 | Morpher/Backup*/ 127 | Morpher/UpgradeLog*.XML 128 | Morpher/UpgradeLog*.htm 129 | 130 | # Visual Studio 6 build log 131 | *.plg 132 | 133 | # Visual Studio 6 workspace options file 134 | *.opt -------------------------------------------------------------------------------- /Assets/TriangleDotNet.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc3dddd0d4f513241928edfc53e4a1f3 3 | folderAsset: yes 4 | timeCreated: 1430057871 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56a5038be2b41214d9009c34b5af4969 3 | folderAsset: yes 4 | timeCreated: 1429810145 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Editor/RunGitShell.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Collections; 4 | 5 | public class RunGitShell 6 | { 7 | private const string shell = "PowerShell"; 8 | private const string args = "-ExecutionPolicy RemoteSigned"; 9 | 10 | [MenuItem("Utilities/Version Control/Open Git Shell %&g")] 11 | public static void OpenShell() 12 | { 13 | System.Diagnostics.Process.Start(shell, args); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Editor/RunGitShell.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d084008d6fa0d5a4badcc5e908633e30 3 | timeCreated: 1428494376 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b91a2922a67edeb4092309c2b90fb548 3 | folderAsset: yes 4 | timeCreated: 1429871221 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Materials/Wall.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/Assets/TriangleDotNet/Materials/Wall.mat -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Materials/Wall.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae1c20238ba847e41afb6a03ff85adcb 3 | timeCreated: 1429871229 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Materials/unity-icon.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/Assets/TriangleDotNet/Materials/unity-icon.mat -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Materials/unity-icon.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54a6f2cd435eb5f42b34106fd627feb2 3 | timeCreated: 1430005318 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac1e4140fb0bda84aabcf02691624151 3 | folderAsset: yes 4 | timeCreated: 1429810232 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Scenes/DelaunayDemo.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/Assets/TriangleDotNet/Scenes/DelaunayDemo.unity -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Scenes/DelaunayDemo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f2e7c23dcf1cfe47bf457cfb2a3c1e0 3 | timeCreated: 1429810232 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e86edeea3c0b50a409f385c146291f60 3 | folderAsset: yes 4 | timeCreated: 1429808114 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/DelaunayDemo.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using TriangleNet.Geometry; 5 | 6 | public class DelaunayDemo : MonoBehaviour 7 | { 8 | TriangleNet.Mesh meshRepresentation; 9 | InputGeometry geometry; 10 | 11 | public float distance = 5; 12 | public float verticalDistance = 2; 13 | public float boxDistance = 1f; 14 | public float circleDistance = 0.7f; 15 | 16 | public UPolygon logoOutline; 17 | public UPolygon[] holes; 18 | 19 | public float boxWidth = 1f; 20 | public float zOffset = 0.5f; 21 | 22 | Mesh mesh; 23 | 24 | // Use this for initialization 25 | void Start () 26 | { 27 | geometry = new InputGeometry(); 28 | 29 | //it is necessary to put a border around all the points in order to get triangulation to work correctly when holes are used 30 | List border = new List(); 31 | border.Add(new Point(distance, verticalDistance)); 32 | border.Add(new Point(distance, -verticalDistance)); 33 | border.Add(new Point(-distance, -verticalDistance)); 34 | border.Add(new Point(-distance, verticalDistance)); 35 | geometry.AddRing(border); 36 | 37 | List outlinePoints = new List(logoOutline.points.Length); 38 | foreach (Vector2 coordinates in logoOutline.points) 39 | { 40 | outlinePoints.Add(new Point(coordinates)); 41 | } 42 | 43 | geometry.AddRingAsHole(outlinePoints, 0); 44 | 45 | 46 | foreach(UPolygon hole in holes) 47 | { 48 | List holePoints = new List(hole.points.Length); 49 | 50 | foreach (Vector2 coordinates in hole.points) 51 | holePoints.Add(new Point(coordinates)); 52 | 53 | geometry.AddRing(holePoints, 0); 54 | } 55 | 56 | 57 | List points = new List(); 58 | for (float offsetX = -distance; offsetX < distance; offsetX += boxDistance) 59 | { 60 | for (float offsetY = -verticalDistance; offsetY < verticalDistance; offsetY += boxDistance) 61 | { 62 | Vector2 offset = new Vector2(offsetX, offsetY) + Vector2.one * boxDistance * 0.5f; 63 | 64 | float radians = Random.RandomRange(0, 2 * Mathf.PI); 65 | float length = Random.RandomRange(0, circleDistance); 66 | 67 | Vector2 pos = new Vector2(Mathf.Cos(radians), Mathf.Sin(radians)) * length; 68 | pos += offset; 69 | 70 | bool insideOutline = logoOutline.PointInPolygon(pos); 71 | 72 | bool stillAlloved = false; 73 | for (int i = 0; i < holes.Length; i++ ) 74 | { 75 | if (holes[i].PointInPolygon(pos)) 76 | stillAlloved = true; 77 | } 78 | 79 | if (!insideOutline || stillAlloved) 80 | geometry.AddPoint((float)pos.x, (float)pos.y, 0); 81 | } 82 | } 83 | 84 | meshRepresentation = new TriangleNet.Mesh(); 85 | meshRepresentation.Triangulate(geometry); 86 | 87 | //generate mesh based on triangulation 88 | 89 | Dictionary zOffsets = new Dictionary(); 90 | 91 | foreach(KeyValuePair pair in meshRepresentation.vertices) 92 | { 93 | zOffsets.Add(pair.Key, Random.RandomRange(-zOffset, zOffset)); 94 | } 95 | 96 | int triangleIndex = 0; 97 | List vertices = new List(meshRepresentation.triangles.Count * 3); 98 | List triangleIndices = new List(meshRepresentation.triangles.Count * 3); 99 | 100 | foreach(KeyValuePair pair in meshRepresentation.triangles) 101 | { 102 | TriangleNet.Data.Triangle triangle = pair.Value; 103 | 104 | TriangleNet.Data.Vertex vertex0 = triangle.GetVertex(0); 105 | TriangleNet.Data.Vertex vertex1 = triangle.GetVertex(1); 106 | TriangleNet.Data.Vertex vertex2 = triangle.GetVertex(2); 107 | 108 | Vector3 p0 = new Vector3( vertex0.x, vertex0.y, zOffsets[vertex0.id]); 109 | Vector3 p1 = new Vector3( vertex1.x, vertex1.y, zOffsets[vertex1.id]); 110 | Vector3 p2 = new Vector3( vertex2.x, vertex2.y, zOffsets[vertex2.id]); 111 | 112 | vertices.Add(p0); 113 | vertices.Add(p1); 114 | vertices.Add(p2); 115 | 116 | triangleIndices.Add(triangleIndex + 2); 117 | triangleIndices.Add(triangleIndex + 1); 118 | triangleIndices.Add(triangleIndex); 119 | 120 | triangleIndex += 3; 121 | } 122 | 123 | mesh = new Mesh(); 124 | mesh.vertices = vertices.ToArray(); 125 | mesh.triangles = triangleIndices.ToArray(); 126 | mesh.RecalculateNormals(); 127 | GetComponent().mesh = mesh; 128 | } 129 | 130 | void OnDrawGizmos() 131 | { 132 | if (holes.Length <= 0) 133 | return; 134 | 135 | Gizmos.color = Color.black; 136 | logoOutline.GizmoDraw(); 137 | 138 | Gizmos.color = Color.white; 139 | foreach(UPolygon hole in holes) 140 | { 141 | hole.GizmoDraw(); 142 | } 143 | 144 | if (meshRepresentation == null) 145 | return; 146 | 147 | Gizmos.color = Color.cyan; 148 | 149 | foreach(KeyValuePair pair in meshRepresentation.triangles) 150 | { 151 | TriangleNet.Data.Triangle triangle = pair.Value; 152 | 153 | TriangleNet.Data.Vertex vertex0 = triangle.GetVertex(0); 154 | TriangleNet.Data.Vertex vertex1 = triangle.GetVertex(1); 155 | TriangleNet.Data.Vertex vertex2 = triangle.GetVertex(2); 156 | 157 | Vector2 p0 = new Vector2((float) vertex0.x, (float) vertex0.y); 158 | Vector2 p1 = new Vector2((float)vertex1.x, (float)vertex1.y); 159 | Vector2 p2 = new Vector2((float)vertex2.x, (float)vertex2.y); 160 | 161 | Gizmos.DrawLine(p0, p1); 162 | Gizmos.DrawLine(p1, p2); 163 | Gizmos.DrawLine(p2, p0); 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/DelaunayDemo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c9aebca305fb9247b849050359da521 3 | timeCreated: 1429808128 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/InputGeometryExtensions.cs: -------------------------------------------------------------------------------- 1 | using TriangleNet.Geometry; 2 | using TriangleNet.Data; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | 6 | public static class InputGeometryExtensions 7 | { 8 | /// 9 | /// Add a polygon ring to the geometry. 10 | /// 11 | /// List of points which make up the polygon. 12 | /// Common boundary mark for all segments of the polygon. 13 | public static void AddRing(this InputGeometry geometry, 14 | IEnumerable points, int mark = 0) 15 | { 16 | // Save the current number of points. 17 | int N = geometry.Count; 18 | 19 | int m = 0; 20 | foreach (var pt in points) 21 | { 22 | geometry.AddPoint(pt.X, pt.Y, pt.Boundary, pt.Attributes); 23 | m++; 24 | } 25 | 26 | for (int i = 0; i < m; i++) 27 | { 28 | geometry.AddSegment(N + i, N + ((i + 1) % m), mark); 29 | } 30 | } 31 | 32 | /// 33 | /// Add a polygon ring to the geometry and make it a hole. 34 | /// 35 | /// 36 | /// WARNING: This works for convex polygons, but not for non-convex regions in general. 37 | /// 38 | /// List of points which make up the hole. 39 | /// Common boundary mark for all segments of the hole. 40 | public static void AddRingAsHole(this InputGeometry geometry, 41 | IEnumerable points, int mark = 0) 42 | { 43 | // Save the current number of points. 44 | int N = geometry.Count; 45 | 46 | // Hole coordinates 47 | float x = 0.0f; 48 | float y = 0.0f; 49 | 50 | int m = 0; 51 | foreach (var pt in points) 52 | { 53 | x += pt.X; 54 | y += pt.Y; 55 | 56 | geometry.AddPoint(pt.X, pt.Y, pt.Boundary, pt.Attributes); 57 | m++; 58 | } 59 | 60 | for (int i = 0; i < m; i++) 61 | { 62 | geometry.AddSegment(N + i, N + ((i + 1) % m), mark); 63 | } 64 | 65 | geometry.AddHole(x / m, y / m); 66 | } 67 | } -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/InputGeometryExtensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58c3575dd4bea124093b071e50629de8 3 | timeCreated: 1429827957 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/LightMover.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class LightMover : MonoBehaviour 6 | { 7 | 8 | 9 | void Update() 10 | { 11 | Vector3 worldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); 12 | worldPos.z = transform.position.z; 13 | 14 | transform.position = worldPos; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/LightMover.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 454a4bedcbe1b444aa0e6f4398d94427 3 | timeCreated: 1429873286 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/ReloadScene.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class ReloadScene : MonoBehaviour 6 | { 7 | // Update is called once per frame 8 | void Update () 9 | { 10 | if(Input.GetButtonDown("Fire1")) 11 | { 12 | Application.LoadLevel(Application.loadedLevel); 13 | } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/ReloadScene.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d72bda1d0e312641bbd8235b728060f 3 | timeCreated: 1429873386 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/UPolygon.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | [System.Serializable] 6 | public class UPolygon 7 | { 8 | public Vector2[] points; 9 | 10 | public bool PointInPolygon(Vector2 point) 11 | { 12 | int i,j; 13 | bool c = false; 14 | 15 | for(i = 0, j = points.Length - 1; i < points.Length; j = i++) 16 | { 17 | if( ( ( (points[i].y) >= point.y ) != (points[j].y >= point.y) ) && (point.x <= (points[j].x - points[i].x) * (point.y - points[i].y) / (points[j].y - points[i].y) + points[i].x)) 18 | c = !c; 19 | } 20 | 21 | return c; 22 | } 23 | 24 | public void GizmoDraw() 25 | { 26 | if (points.Length <= 1) 27 | return; 28 | 29 | for(int i = 0 ; i < points.Length - 1 ; i++) 30 | { 31 | Gizmos.DrawLine(points[i], points[i + 1]); 32 | } 33 | 34 | Gizmos.DrawLine(points[points.Length - 1], points[0]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/TestScripts/UPolygon.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 459ee49853e912645a704dcb6024b25a 3 | timeCreated: 1430005421 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6486b48397a5b748a997125e870c70f 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b64b14954b85a047b3605cf33008eca 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm/Dwyer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8670cab657e9f9941a19d25aaeec9895 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm/ITriangulator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Algorithm 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// TODO: Update summary. 16 | /// 17 | public interface ITriangulator 18 | { 19 | int Triangulate(Mesh mesh); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm/ITriangulator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 011baedd1f4122e4ab39fb759ba7f0f8 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm/Incremental.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Algorithm 9 | { 10 | using TriangleNet.Data; 11 | using TriangleNet.Log; 12 | using TriangleNet.Geometry; 13 | 14 | /// 15 | /// Builds a delaunay triangulation using the incremental algorithm. 16 | /// 17 | class Incremental 18 | { 19 | Mesh mesh; 20 | 21 | /// 22 | /// Form an "infinite" bounding triangle to insert vertices into. 23 | /// 24 | /// 25 | /// The vertices at "infinity" are assigned finite coordinates, which are 26 | /// used by the point location routines, but (mostly) ignored by the 27 | /// Delaunay edge flip routines. 28 | /// 29 | void GetBoundingBox() 30 | { 31 | Otri inftri = default(Otri); // Handle for the triangular bounding box. 32 | BoundingBox box = mesh.bounds; 33 | 34 | // Find the width (or height, whichever is larger) of the triangulation. 35 | float width = box.Width; 36 | if (box.Height > width) 37 | { 38 | width = box.Height; 39 | } 40 | if (width == 0.0f) 41 | { 42 | width = 1.0f; 43 | } 44 | // Create the vertices of the bounding box. 45 | mesh.infvertex1 = new Vertex(box.Xmin - 50.0f * width, box.Ymin - 40.0f * width); 46 | mesh.infvertex2 = new Vertex(box.Xmax + 50.0f * width, box.Ymin - 40.0f * width); 47 | mesh.infvertex3 = new Vertex(0.5f * (box.Xmin + box.Xmax), box.Ymax + 60.0f * width); 48 | 49 | // Create the bounding box. 50 | mesh.MakeTriangle(ref inftri); 51 | inftri.SetOrg(mesh.infvertex1); 52 | inftri.SetDest(mesh.infvertex2); 53 | inftri.SetApex(mesh.infvertex3); 54 | // Link dummytri to the bounding box so we can always find an 55 | // edge to begin searching (point location) from. 56 | Mesh.dummytri.neighbors[0] = inftri; 57 | } 58 | 59 | /// 60 | /// Remove the "infinite" bounding triangle, setting boundary markers as appropriate. 61 | /// 62 | /// Returns the number of edges on the convex hull of the triangulation. 63 | /// 64 | /// The triangular bounding box has three boundary triangles (one for each 65 | /// side of the bounding box), and a bunch of triangles fanning out from 66 | /// the three bounding box vertices (one triangle for each edge of the 67 | /// convex hull of the inner mesh). This routine removes these triangles. 68 | /// 69 | int RemoveBox() 70 | { 71 | Otri deadtriangle = default(Otri); 72 | Otri searchedge = default(Otri); 73 | Otri checkedge = default(Otri); 74 | Otri nextedge = default(Otri), finaledge = default(Otri), dissolveedge = default(Otri); 75 | Vertex markorg; 76 | int hullsize; 77 | 78 | bool noPoly = !mesh.behavior.Poly; 79 | 80 | // Find a boundary triangle. 81 | nextedge.triangle = Mesh.dummytri; 82 | nextedge.orient = 0; 83 | nextedge.SymSelf(); 84 | // Mark a place to stop. 85 | nextedge.Lprev(ref finaledge); 86 | nextedge.LnextSelf(); 87 | nextedge.SymSelf(); 88 | // Find a triangle (on the boundary of the vertex set) that isn't 89 | // a bounding box triangle. 90 | nextedge.Lprev(ref searchedge); 91 | searchedge.SymSelf(); 92 | // Check whether nextedge is another boundary triangle 93 | // adjacent to the first one. 94 | nextedge.Lnext(ref checkedge); 95 | checkedge.SymSelf(); 96 | if (checkedge.triangle == Mesh.dummytri) 97 | { 98 | // Go on to the next triangle. There are only three boundary 99 | // triangles, and this next triangle cannot be the third one, 100 | // so it's safe to stop here. 101 | searchedge.LprevSelf(); 102 | searchedge.SymSelf(); 103 | } 104 | // Find a new boundary edge to search from, as the current search 105 | // edge lies on a bounding box triangle and will be deleted. 106 | Mesh.dummytri.neighbors[0] = searchedge; 107 | hullsize = -2; 108 | while (!nextedge.Equal(finaledge)) 109 | { 110 | hullsize++; 111 | nextedge.Lprev(ref dissolveedge); 112 | dissolveedge.SymSelf(); 113 | // If not using a PSLG, the vertices should be marked now. 114 | // (If using a PSLG, markhull() will do the job.) 115 | if (noPoly) 116 | { 117 | // Be careful! One must check for the case where all the input 118 | // vertices are collinear, and thus all the triangles are part of 119 | // the bounding box. Otherwise, the setvertexmark() call below 120 | // will cause a bad pointer reference. 121 | if (dissolveedge.triangle != Mesh.dummytri) 122 | { 123 | markorg = dissolveedge.Org(); 124 | if (markorg.mark == 0) 125 | { 126 | markorg.mark = 1; 127 | } 128 | } 129 | } 130 | // Disconnect the bounding box triangle from the mesh triangle. 131 | dissolveedge.Dissolve(); 132 | nextedge.Lnext(ref deadtriangle); 133 | deadtriangle.Sym(ref nextedge); 134 | // Get rid of the bounding box triangle. 135 | mesh.TriangleDealloc(deadtriangle.triangle); 136 | // Do we need to turn the corner? 137 | if (nextedge.triangle == Mesh.dummytri) 138 | { 139 | // Turn the corner. 140 | dissolveedge.Copy(ref nextedge); 141 | } 142 | } 143 | mesh.TriangleDealloc(finaledge.triangle); 144 | 145 | return hullsize; 146 | } 147 | 148 | /// 149 | /// Form a Delaunay triangulation by incrementally inserting vertices. 150 | /// 151 | /// Returns the number of edges on the convex hull of the 152 | /// triangulation. 153 | public int Triangulate(Mesh mesh) 154 | { 155 | this.mesh = mesh; 156 | 157 | Otri starttri = new Otri(); 158 | 159 | // Create a triangular bounding box. 160 | GetBoundingBox(); 161 | 162 | foreach (var v in mesh.vertices.Values) 163 | { 164 | starttri.triangle = Mesh.dummytri; 165 | Osub tmp = default(Osub); 166 | if (mesh.InsertVertex(v, ref starttri, ref tmp, false, false) == InsertVertexResult.Duplicate) 167 | { 168 | if (Behavior.Verbose) 169 | { 170 | SimpleLog.Instance.Warning("A duplicate vertex appeared and was ignored.", 171 | "Incremental.IncrementalDelaunay()"); 172 | } 173 | v.type = VertexType.UndeadVertex; 174 | mesh.undeads++; 175 | } 176 | } 177 | // Remove the bounding box. 178 | return RemoveBox(); 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm/Incremental.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18f85d3d378f5d34d84950731ff423eb 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Algorithm/SweepLine.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 848b909b743bb0546ae734e94095d7a5 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/BadTriQueue.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet 9 | { 10 | using System.Collections.Generic; 11 | using TriangleNet.Data; 12 | 13 | /// 14 | /// A (priority) queue for bad triangles. 15 | /// 16 | /// 17 | // The queue is actually a set of 4096 queues. I use multiple queues to 18 | // give priority to smaller angles. I originally implemented a heap, but 19 | // the queues are faster by a larger margin than I'd suspected. 20 | /// 21 | class BadTriQueue 22 | { 23 | static readonly float SQRT2 = 1.4142135623730950488016887242096980785696718753769480732f; 24 | 25 | public int Count { get { return this.count; } } 26 | 27 | // Variables that maintain the bad triangle queues. The queues are 28 | // ordered from 4095 (highest priority) to 0 (lowest priority). 29 | BadTriangle[] queuefront; 30 | BadTriangle[] queuetail; 31 | int[] nextnonemptyq; 32 | int firstnonemptyq; 33 | 34 | int count; 35 | 36 | public BadTriQueue() 37 | { 38 | //badtriangles = new List(); 39 | 40 | queuefront = new BadTriangle[4096]; 41 | queuetail = new BadTriangle[4096]; 42 | nextnonemptyq = new int[4096]; 43 | 44 | firstnonemptyq = -1; 45 | 46 | count = 0; 47 | } 48 | 49 | /// 50 | /// Add a bad triangle data structure to the end of a queue. 51 | /// 52 | /// The bad triangle to enqueue. 53 | public void Enqueue(BadTriangle badtri) 54 | { 55 | float length, multiplier; 56 | int exponent, expincrement; 57 | int queuenumber; 58 | int posexponent; 59 | int i; 60 | 61 | this.count++; 62 | 63 | // Determine the appropriate queue to put the bad triangle into. 64 | // Recall that the key is the square of its shortest edge length. 65 | if (badtri.key >= 1.0) 66 | { 67 | length = badtri.key; 68 | posexponent = 1; 69 | } 70 | else 71 | { 72 | // 'badtri.key' is 2.0 to a negative exponent, so we'll record that 73 | // fact and use the reciprocal of 'badtri.key', which is > 1.0. 74 | length = 1.0f / badtri.key; 75 | posexponent = 0; 76 | } 77 | // 'length' is approximately 2.0 to what exponent? The following code 78 | // determines the answer in time logarithmic in the exponent. 79 | exponent = 0; 80 | while (length > 2.0f) 81 | { 82 | // Find an approximation by repeated squaring of two. 83 | expincrement = 1; 84 | multiplier = 0.5f; 85 | while (length * multiplier * multiplier > 1.0) 86 | { 87 | expincrement *= 2; 88 | multiplier *= multiplier; 89 | } 90 | // Reduce the value of 'length', then iterate if necessary. 91 | exponent += expincrement; 92 | length *= multiplier; 93 | } 94 | // 'length' is approximately squareroot(2.0) to what exponent? 95 | exponent = 2 * exponent + (length > SQRT2 ? 1 : 0); 96 | // 'exponent' is now in the range 0...2047 for IEEE float precision. 97 | // Choose a queue in the range 0...4095. The shortest edges have the 98 | // highest priority (queue 4095). 99 | if (posexponent > 0) 100 | { 101 | queuenumber = 2047 - exponent; 102 | } 103 | else 104 | { 105 | queuenumber = 2048 + exponent; 106 | } 107 | 108 | // Are we inserting into an empty queue? 109 | if (queuefront[queuenumber] == null) 110 | { 111 | // Yes, we are inserting into an empty queue. 112 | // Will this become the highest-priority queue? 113 | if (queuenumber > firstnonemptyq) 114 | { 115 | // Yes, this is the highest-priority queue. 116 | nextnonemptyq[queuenumber] = firstnonemptyq; 117 | firstnonemptyq = queuenumber; 118 | } 119 | else 120 | { 121 | // No, this is not the highest-priority queue. 122 | // Find the queue with next higher priority. 123 | i = queuenumber + 1; 124 | while (queuefront[i] == null) 125 | { 126 | i++; 127 | } 128 | // Mark the newly nonempty queue as following a higher-priority queue. 129 | nextnonemptyq[queuenumber] = nextnonemptyq[i]; 130 | nextnonemptyq[i] = queuenumber; 131 | } 132 | // Put the bad triangle at the beginning of the (empty) queue. 133 | queuefront[queuenumber] = badtri; 134 | } 135 | else 136 | { 137 | // Add the bad triangle to the end of an already nonempty queue. 138 | queuetail[queuenumber].nexttriang = badtri; 139 | } 140 | // Maintain a pointer to the last triangle of the queue. 141 | queuetail[queuenumber] = badtri; 142 | // Newly enqueued bad triangle has no successor in the queue. 143 | badtri.nexttriang = null; 144 | } 145 | 146 | /// 147 | /// Add a bad triangle to the end of a queue. 148 | /// 149 | /// 150 | /// 151 | /// 152 | /// 153 | /// 154 | public void Enqueue(ref Otri enqtri, float minedge, Vertex enqapex, Vertex enqorg, Vertex enqdest) 155 | { 156 | // Allocate space for the bad triangle. 157 | BadTriangle newbad = new BadTriangle(); 158 | 159 | newbad.poortri = enqtri; 160 | newbad.key = minedge; 161 | newbad.triangapex = enqapex; 162 | newbad.triangorg = enqorg; 163 | newbad.triangdest = enqdest; 164 | 165 | Enqueue(newbad); 166 | } 167 | 168 | /// 169 | /// Remove a triangle from the front of the queue. 170 | /// 171 | /// 172 | public BadTriangle Dequeue() 173 | { 174 | // If no queues are nonempty, return NULL. 175 | if (firstnonemptyq < 0) 176 | { 177 | return null; 178 | } 179 | 180 | this.count--; 181 | 182 | // Find the first triangle of the highest-priority queue. 183 | BadTriangle result = queuefront[firstnonemptyq]; 184 | // Remove the triangle from the queue. 185 | queuefront[firstnonemptyq] = result.nexttriang; 186 | // If this queue is now empty, note the new highest-priority 187 | // nonempty queue. 188 | if (result == queuetail[firstnonemptyq]) 189 | { 190 | firstnonemptyq = nextnonemptyq[firstnonemptyq]; 191 | } 192 | 193 | return result; 194 | } 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/BadTriQueue.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5914901f3d7eca4db4958293ebdce5e 3 | timeCreated: 1429807110 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Behavior.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet 9 | { 10 | using System; 11 | using TriangleNet.Log; 12 | 13 | /// 14 | /// Controls the behavior of the meshing software. 15 | /// 16 | public class Behavior 17 | { 18 | #region Class members 19 | 20 | bool poly = false; 21 | bool quality = false; 22 | bool varArea = false; 23 | bool usertest = false; 24 | bool convex = false; 25 | bool jettison = false; 26 | bool boundaryMarkers = true; 27 | bool noHoles = false; 28 | bool conformDel = false; 29 | TriangulationAlgorithm algorithm = TriangulationAlgorithm.Dwyer; 30 | 31 | int noBisect = 0; 32 | int steiner = -1; 33 | 34 | float minAngle = 0.0f; 35 | float maxAngle = 0.0f; 36 | float maxArea = -1.0f; 37 | 38 | internal bool fixedArea = false; 39 | internal bool useSegments = true; 40 | internal bool useRegions = false; 41 | internal float goodAngle = 0.0f; 42 | internal float maxGoodAngle = 0.0f; 43 | internal float offconstant = 0.0f; 44 | 45 | #endregion 46 | 47 | /// 48 | /// Creates an instance of the Behavior class. 49 | /// 50 | public Behavior(bool quality = false, float minAngle = 20.0f) 51 | { 52 | if (quality) 53 | { 54 | this.quality = true; 55 | this.minAngle = minAngle; 56 | 57 | Update(); 58 | } 59 | } 60 | 61 | /// 62 | /// Update quality options dependencies. 63 | /// 64 | private void Update() 65 | { 66 | this.quality = true; 67 | 68 | if (this.minAngle < 0 || this.minAngle > 60) 69 | { 70 | this.minAngle = 0; 71 | this.quality = false; 72 | 73 | SimpleLog.Instance.Warning("Invalid quality option (minimum angle).", "Mesh.Behavior"); 74 | } 75 | 76 | if ((this.maxAngle != 0.0) && this.maxAngle < 90 || this.maxAngle > 180) 77 | { 78 | this.maxAngle = 0; 79 | this.quality = false; 80 | 81 | SimpleLog.Instance.Warning("Invalid quality option (maximum angle).", "Mesh.Behavior"); 82 | } 83 | 84 | this.useSegments = this.Poly || this.Quality || this.Convex; 85 | this.goodAngle = UnityEngine.Mathf.Cos(this.MinAngle * UnityEngine.Mathf.PI / 180.0f); 86 | this.maxGoodAngle = UnityEngine.Mathf.Cos(this.MaxAngle * UnityEngine.Mathf.PI / 180.0f); 87 | 88 | if (this.goodAngle == 1.0) 89 | { 90 | this.offconstant = 0.0f; 91 | } 92 | else 93 | { 94 | this.offconstant = 0.475f * UnityEngine.Mathf.Sqrt((1.0f + this.goodAngle) / (1.0f - this.goodAngle)); 95 | } 96 | 97 | this.goodAngle *= this.goodAngle; 98 | } 99 | 100 | #region Static properties 101 | 102 | /// 103 | /// No exact arithmetic. 104 | /// 105 | public static bool NoExact { get; set; } 106 | 107 | /// 108 | /// Log detailed information. 109 | /// 110 | public static bool Verbose { get; set; } 111 | 112 | #endregion 113 | 114 | #region Public properties 115 | 116 | /// 117 | /// Quality mesh generation. 118 | /// 119 | public bool Quality 120 | { 121 | get { return quality; } 122 | set 123 | { 124 | quality = value; 125 | if (quality) 126 | { 127 | Update(); 128 | } 129 | } 130 | } 131 | 132 | /// 133 | /// Minimum angle constraint. 134 | /// 135 | public float MinAngle 136 | { 137 | get { return minAngle; } 138 | set { minAngle = value; Update(); } 139 | } 140 | 141 | /// 142 | /// Maximum angle constraint. 143 | /// 144 | public float MaxAngle 145 | { 146 | get { return maxAngle; } 147 | set { maxAngle = value; Update(); } 148 | } 149 | 150 | /// 151 | /// Maximum area constraint. 152 | /// 153 | public float MaxArea 154 | { 155 | get { return maxArea; } 156 | set 157 | { 158 | maxArea = value; 159 | fixedArea = value > 0; 160 | } 161 | } 162 | 163 | /// 164 | /// Apply a maximum triangle area constraint. 165 | /// 166 | public bool VarArea 167 | { 168 | get { return varArea; } 169 | set { varArea = value; } 170 | } 171 | 172 | /// 173 | /// Input is a Planar Straight Line Graph. 174 | /// 175 | public bool Poly 176 | { 177 | get { return poly; } 178 | set { poly = value; } 179 | } 180 | 181 | /// 182 | /// Apply a user-defined triangle constraint. 183 | /// 184 | public bool Usertest 185 | { 186 | get { return usertest; } 187 | set { usertest = value; } 188 | } 189 | 190 | /// 191 | /// Enclose the convex hull with segments. 192 | /// 193 | public bool Convex 194 | { 195 | get { return convex; } 196 | set { convex = value; } 197 | } 198 | 199 | /// 200 | /// Conforming Delaunay (all triangles are truly Delaunay). 201 | /// 202 | public bool ConformingDelaunay 203 | { 204 | get { return conformDel; } 205 | set { conformDel = value; } 206 | } 207 | 208 | /// 209 | /// Algorithm to use for triangulation. 210 | /// 211 | public TriangulationAlgorithm Algorithm 212 | { 213 | get { return algorithm; } 214 | set { algorithm = value; } 215 | } 216 | 217 | /// 218 | /// Suppresses boundary segment splitting. 219 | /// 220 | /// 221 | /// 0 = split segments 222 | /// 1 = no new vertices on the boundary 223 | /// 2 = prevent all segment splitting, including internal boundaries 224 | /// 225 | public int NoBisect 226 | { 227 | get { return noBisect; } 228 | set 229 | { 230 | noBisect = value; 231 | if (noBisect < 0 || noBisect > 2) 232 | { 233 | noBisect = 0; 234 | } 235 | } 236 | } 237 | 238 | /// 239 | /// Use maximum number of Steiner points. 240 | /// 241 | public int SteinerPoints 242 | { 243 | get { return steiner; } 244 | set { steiner = value; } 245 | } 246 | 247 | /// 248 | /// Compute boundary information. 249 | /// 250 | public bool UseBoundaryMarkers 251 | { 252 | get { return boundaryMarkers; } 253 | set { boundaryMarkers = value; } 254 | } 255 | 256 | /// 257 | /// Ignores holes in polygons. 258 | /// 259 | public bool NoHoles 260 | { 261 | get { return noHoles; } 262 | set { noHoles = value; } 263 | } 264 | 265 | /// 266 | /// Jettison unused vertices from output. 267 | /// 268 | public bool Jettison 269 | { 270 | get { return jettison; } 271 | set { jettison = value; } 272 | } 273 | 274 | #endregion 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Behavior.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85d795f80219dac4faf7efcd2b2a69f5 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Carver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b190e09983a25d4f8212412fa2a3d8c 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b88fa8bd815b75a44b35d2e974192e55 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/BadSubseg.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Data 9 | { 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | /// 16 | /// A queue used to store encroached subsegments. 17 | /// 18 | /// 19 | /// Each subsegment's vertices are stored so that we can check whether a 20 | /// subsegment is still the same. 21 | /// 22 | class BadSubseg 23 | { 24 | private static int hashSeed = 0; 25 | internal int Hash; 26 | 27 | public Osub encsubseg; // An encroached subsegment. 28 | public Vertex subsegorg, subsegdest; // Its two vertices. 29 | 30 | public BadSubseg() 31 | { 32 | this.Hash = hashSeed++; 33 | } 34 | 35 | public override int GetHashCode() 36 | { 37 | return this.Hash; 38 | } 39 | 40 | public override string ToString() 41 | { 42 | return String.Format("B-SID {0}", encsubseg.seg.hash); 43 | } 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/BadSubseg.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75181a848b5bfbf4182303d71d960b05 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/BadTriangle.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Data 9 | { 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | /// 16 | /// A queue used to store bad triangles. 17 | /// 18 | /// 19 | /// The key is the square of the cosine of the smallest angle of the triangle. 20 | /// Each triangle's vertices are stored so that one can check whether a 21 | /// triangle is still the same. 22 | /// 23 | class BadTriangle 24 | { 25 | public static int OTID = 0; 26 | public int ID = 0; 27 | 28 | public Otri poortri; // A skinny or too-large triangle. 29 | public float key; // cos^2 of smallest (apical) angle. 30 | public Vertex triangorg, triangdest, triangapex; // Its three vertices. 31 | public BadTriangle nexttriang; // Pointer to next bad triangle. 32 | 33 | public BadTriangle() 34 | { 35 | ID = OTID++; 36 | } 37 | public override string ToString() 38 | { 39 | return String.Format("B-TID {0}", poortri.triangle.hash); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/BadTriangle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c2c831e3868a8e41a665549ec35b27e 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Osub.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Data 9 | { 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | /// 16 | /// An oriented subsegment. 17 | /// 18 | /// 19 | /// Iincludes a pointer to a subsegment and an orientation. The orientation 20 | /// denotes a side of the edge. Hence, there are two possible orientations. 21 | /// By convention, the edge is always directed so that the "side" denoted 22 | /// is the right side of the edge. 23 | /// 24 | struct Osub 25 | { 26 | public Segment seg; 27 | public int orient; // Ranges from 0 to 1. 28 | 29 | public override string ToString() 30 | { 31 | if (seg == null) 32 | { 33 | return "O-TID [null]"; 34 | } 35 | return String.Format("O-SID {0}", seg.hash); 36 | } 37 | 38 | #region Osub primitives 39 | 40 | /// 41 | /// Reverse the orientation of a subsegment. [sym(ab) -> ba] 42 | /// 43 | /// ssym() toggles the orientation of a subsegment. 44 | /// 45 | public void Sym(ref Osub o2) 46 | { 47 | o2.seg = seg; 48 | o2.orient = 1 - orient; 49 | } 50 | 51 | /// 52 | /// Reverse the orientation of a subsegment. [sym(ab) -> ba] 53 | /// 54 | public void SymSelf() 55 | { 56 | orient = 1 - orient; 57 | } 58 | 59 | /// 60 | /// Find adjoining subsegment with the same origin. [pivot(ab) -> a*] 61 | /// 62 | /// spivot() finds the other subsegment (from the same segment) 63 | /// that shares the same origin. 64 | /// 65 | public void Pivot(ref Osub o2) 66 | { 67 | o2 = seg.subsegs[orient]; 68 | //sdecode(sptr, o2); 69 | } 70 | 71 | /// 72 | /// Find adjoining subsegment with the same origin. [pivot(ab) -> a*] 73 | /// 74 | public void PivotSelf() 75 | { 76 | this = seg.subsegs[orient]; 77 | //sdecode(sptr, osub); 78 | } 79 | 80 | /// 81 | /// Find next subsegment in sequence. [next(ab) -> b*] 82 | /// 83 | /// snext() finds the next subsegment (from the same segment) in 84 | /// sequence; one whose origin is the input subsegment's destination. 85 | /// 86 | public void Next(ref Osub o2) 87 | { 88 | o2 = seg.subsegs[1 - orient]; 89 | //sdecode(sptr, o2); 90 | } 91 | 92 | /// 93 | /// Find next subsegment in sequence. [next(ab) -> b*] 94 | /// 95 | public void NextSelf() 96 | { 97 | this = seg.subsegs[1 - orient]; 98 | //sdecode(sptr, osub); 99 | } 100 | 101 | /// 102 | /// Get the origin of a subsegment 103 | /// 104 | public Vertex Org() 105 | { 106 | return seg.vertices[orient]; 107 | } 108 | 109 | /// 110 | /// Get the destination of a subsegment 111 | /// 112 | public Vertex Dest() 113 | { 114 | return seg.vertices[1 - orient]; 115 | } 116 | 117 | /// 118 | /// Set the origin or destination of a subsegment. 119 | /// 120 | public void SetOrg(Vertex ptr) 121 | { 122 | seg.vertices[orient] = ptr; 123 | } 124 | 125 | /// 126 | /// Set destination of a subsegment. 127 | /// 128 | public void SetDest(Vertex ptr) 129 | { 130 | seg.vertices[1 - orient] = ptr; 131 | } 132 | 133 | /// 134 | /// Get the origin of the segment that includes the subsegment. 135 | /// 136 | public Vertex SegOrg() 137 | { 138 | return seg.vertices[2 + orient]; 139 | } 140 | 141 | /// 142 | /// Get the destination of the segment that includes the subsegment. 143 | /// 144 | public Vertex SegDest() 145 | { 146 | return seg.vertices[3 - orient]; 147 | } 148 | 149 | /// 150 | /// Set the origin of the segment that includes the subsegment. 151 | /// 152 | public void SetSegOrg(Vertex ptr) 153 | { 154 | seg.vertices[2 + orient] = ptr; 155 | } 156 | 157 | /// 158 | /// Set the destination of the segment that includes the subsegment. 159 | /// 160 | public void SetSegDest(Vertex ptr) 161 | { 162 | seg.vertices[3 - orient] = ptr; 163 | } 164 | 165 | /// 166 | /// Read a boundary marker. 167 | /// 168 | /// Boundary markers are used to hold user-defined tags for 169 | /// setting boundary conditions in finite element solvers. 170 | public int Mark() 171 | { 172 | return seg.boundary; 173 | } 174 | 175 | /// 176 | /// Set a boundary marker. 177 | /// 178 | public void SetMark(int value) 179 | { 180 | seg.boundary = value; 181 | } 182 | 183 | /// 184 | /// Bond two subsegments together. [bond(abc, ba)] 185 | /// 186 | public void Bond(ref Osub o2) 187 | { 188 | seg.subsegs[orient] = o2; 189 | o2.seg.subsegs[o2.orient] = this; 190 | } 191 | 192 | /// 193 | /// Dissolve a subsegment bond (from one side). 194 | /// 195 | /// Note that the other subsegment will still think it's 196 | /// connected to this subsegment. 197 | public void Dissolve() 198 | { 199 | seg.subsegs[orient].seg = Mesh.dummysub; 200 | } 201 | 202 | /// 203 | /// Copy a subsegment. 204 | /// 205 | public void Copy(ref Osub o2) 206 | { 207 | o2.seg = seg; 208 | o2.orient = orient; 209 | } 210 | 211 | /// 212 | /// Test for equality of subsegments. 213 | /// 214 | public bool Equal(Osub o2) 215 | { 216 | return ((seg == o2.seg) && (orient == o2.orient)); 217 | } 218 | 219 | /// 220 | /// Check a subsegment's deallocation. 221 | /// 222 | public static bool IsDead(Segment sub) 223 | { 224 | return sub.subsegs[0].seg == null; 225 | } 226 | 227 | /// 228 | /// Set a subsegment's deallocation. 229 | /// 230 | public static void Kill(Segment sub) 231 | { 232 | sub.subsegs[0].seg = null; 233 | sub.subsegs[1].seg = null; 234 | } 235 | 236 | /// 237 | /// Finds a triangle abutting a subsegment. 238 | /// 239 | public void TriPivot(ref Otri ot) 240 | { 241 | ot = seg.triangles[orient]; 242 | //decode(ptr, otri) 243 | } 244 | 245 | /// 246 | /// Dissolve a bond (from the subsegment side). 247 | /// 248 | public void TriDissolve() 249 | { 250 | seg.triangles[orient].triangle = Mesh.dummytri; 251 | } 252 | 253 | #endregion 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Osub.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 593aaeba4070dd94d83ba3a2e21f47ba 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Otri.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 189667ad97bed124693f317e2cd2d7c9 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Segment.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Data 9 | { 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | using TriangleNet.Geometry; 15 | 16 | /// 17 | /// The subsegment data structure. 18 | /// 19 | /// 20 | /// Each subsegment contains two pointers to adjoining subsegments, plus 21 | /// four pointers to vertices, plus two pointers to adjoining triangles, 22 | /// plus one boundary marker. 23 | /// 24 | public class Segment : ISegment 25 | { 26 | // Hash for dictionary. Will be set by mesh instance. 27 | internal int hash; 28 | 29 | internal Osub[] subsegs; 30 | internal Vertex[] vertices; 31 | internal Otri[] triangles; 32 | internal int boundary; 33 | 34 | public Segment() 35 | { 36 | // Initialize the two adjoining subsegments to be the omnipresent 37 | // subsegment. 38 | subsegs = new Osub[2]; 39 | subsegs[0].seg = Mesh.dummysub; 40 | subsegs[1].seg = Mesh.dummysub; 41 | 42 | // Four NULL vertices. 43 | vertices = new Vertex[4]; 44 | 45 | // Initialize the two adjoining triangles to be "outer space." 46 | triangles = new Otri[2]; 47 | triangles[0].triangle = Mesh.dummytri; 48 | triangles[1].triangle = Mesh.dummytri; 49 | 50 | // Set the boundary marker to zero. 51 | boundary = 0; 52 | } 53 | 54 | #region Public properties 55 | 56 | /// 57 | /// Gets the first endpoints vertex id. 58 | /// 59 | public int P0 60 | { 61 | get { return this.vertices[0].id; } 62 | } 63 | 64 | /// 65 | /// Gets the seconds endpoints vertex id. 66 | /// 67 | public int P1 68 | { 69 | get { return this.vertices[1].id; } 70 | } 71 | 72 | /// 73 | /// Gets the segment boundary mark. 74 | /// 75 | public int Boundary 76 | { 77 | get { return this.boundary; } 78 | } 79 | 80 | #endregion 81 | 82 | /// 83 | /// Gets the segments endpoint. 84 | /// 85 | public Vertex GetVertex(int index) 86 | { 87 | return this.vertices[index]; // TODO: Check range? 88 | } 89 | 90 | /// 91 | /// Gets an adjoining triangle. 92 | /// 93 | public ITriangle GetTriangle(int index) 94 | { 95 | return triangles[index].triangle == Mesh.dummytri ? null : triangles[index].triangle; 96 | } 97 | 98 | public override int GetHashCode() 99 | { 100 | return this.hash; 101 | } 102 | 103 | public override string ToString() 104 | { 105 | return String.Format("SID {0}", hash); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Segment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d8cbfdca8bf9274f9a72779214479c7 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Triangle.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Data 9 | { 10 | using System; 11 | using TriangleNet.Geometry; 12 | 13 | /// 14 | /// The triangle data structure. 15 | /// 16 | /// 17 | /// Each triangle contains three pointers to adjoining triangles, plus three 18 | /// pointers to vertices, plus three pointers to subsegments (declared below; 19 | /// these pointers are usually 'dummysub'). It may or may not also contain 20 | /// user-defined attributes and/or a floating-point "area constraint". 21 | /// 22 | public class Triangle : ITriangle 23 | { 24 | // Hash for dictionary. Will be set by mesh instance. 25 | internal int hash; 26 | 27 | // The ID is only used for mesh output. 28 | internal int id; 29 | 30 | internal Otri[] neighbors; 31 | internal Vertex[] vertices; 32 | internal Osub[] subsegs; 33 | internal int region; 34 | internal float area; 35 | internal bool infected; 36 | 37 | public Triangle() 38 | { 39 | // Initialize the three adjoining triangles to be "outer space". 40 | neighbors = new Otri[3]; 41 | neighbors[0].triangle = Mesh.dummytri; 42 | neighbors[1].triangle = Mesh.dummytri; 43 | neighbors[2].triangle = Mesh.dummytri; 44 | 45 | // Three NULL vertices. 46 | vertices = new Vertex[3]; 47 | 48 | // TODO: if (Behavior.UseSegments) 49 | { 50 | // Initialize the three adjoining subsegments to be the 51 | // omnipresent subsegment. 52 | subsegs = new Osub[3]; 53 | subsegs[0].seg = Mesh.dummysub; 54 | subsegs[1].seg = Mesh.dummysub; 55 | subsegs[2].seg = Mesh.dummysub; 56 | } 57 | 58 | // TODO: 59 | //if (Behavior.VarArea) 60 | //{ 61 | // area = -1.0; 62 | //} 63 | } 64 | 65 | #region Public properties 66 | 67 | /// 68 | /// Gets the triangle id. 69 | /// 70 | public int ID 71 | { 72 | get { return this.id; } 73 | } 74 | 75 | /// 76 | /// Gets the first corners vertex id. 77 | /// 78 | public int P0 79 | { 80 | get { return this.vertices[0] == null ? -1 : this.vertices[0].id; } 81 | } 82 | 83 | /// 84 | /// Gets the seconds corners vertex id. 85 | /// 86 | public int P1 87 | { 88 | get { return this.vertices[1] == null ? -1 : this.vertices[1].id; } 89 | } 90 | 91 | /// 92 | /// Gets the specified corners vertex. 93 | /// 94 | public Vertex GetVertex(int index) 95 | { 96 | return this.vertices[index]; // TODO: Check range? 97 | } 98 | 99 | /// 100 | /// Gets the third corners vertex id. 101 | /// 102 | public int P2 103 | { 104 | get { return this.vertices[2] == null ? -1 : this.vertices[2].id; } 105 | } 106 | 107 | public bool SupportsNeighbors 108 | { 109 | get { return true; } 110 | } 111 | 112 | /// 113 | /// Gets the first neighbors id. 114 | /// 115 | public int N0 116 | { 117 | get { return this.neighbors[0].triangle.id; } 118 | } 119 | 120 | /// 121 | /// Gets the second neighbors id. 122 | /// 123 | public int N1 124 | { 125 | get { return this.neighbors[1].triangle.id; } 126 | } 127 | 128 | /// 129 | /// Gets the third neighbors id. 130 | /// 131 | public int N2 132 | { 133 | get { return this.neighbors[2].triangle.id; } 134 | } 135 | 136 | /// 137 | /// Gets a triangles' neighbor. 138 | /// 139 | /// The neighbor index (0, 1 or 2). 140 | /// The neigbbor opposite of vertex with given index. 141 | public ITriangle GetNeighbor(int index) 142 | { 143 | return neighbors[index].triangle == Mesh.dummytri ? null : neighbors[index].triangle; 144 | } 145 | 146 | /// 147 | /// Gets a triangles segment. 148 | /// 149 | /// The vertex index (0, 1 or 2). 150 | /// The segment opposite of vertex with given index. 151 | public ISegment GetSegment(int index) 152 | { 153 | return subsegs[index].seg == Mesh.dummysub ? null : subsegs[index].seg; 154 | } 155 | 156 | /// 157 | /// Gets the triangle area constraint. 158 | /// 159 | public float Area 160 | { 161 | get { return this.area; } 162 | set { this.area = value; } 163 | } 164 | 165 | /// 166 | /// Region ID the triangle belongs to. 167 | /// 168 | public int Region 169 | { 170 | get { return this.region; } 171 | } 172 | 173 | #endregion 174 | 175 | public override int GetHashCode() 176 | { 177 | return this.hash; 178 | } 179 | 180 | public override string ToString() 181 | { 182 | return String.Format("TID {0}", hash); 183 | } 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Triangle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f2f9011514191643a98018bd28f4658 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Vertex.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Data 9 | { 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | using TriangleNet.Geometry; 15 | 16 | /// 17 | /// The vertex data structure. 18 | /// 19 | public class Vertex : Point 20 | { 21 | // Hash for dictionary. Will be set by mesh instance. 22 | internal int hash; 23 | 24 | internal VertexType type; 25 | internal Otri tri; 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | public Vertex() 31 | : this(0, 0, 0, 0) 32 | { 33 | } 34 | 35 | /// 36 | /// Initializes a new instance of the class. 37 | /// 38 | /// The x coordinate of the vertex. 39 | /// The y coordinate of the vertex. 40 | public Vertex(float x, float y) 41 | : this(x, y, 0, 0) 42 | { 43 | } 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The x coordinate of the vertex. 49 | /// The y coordinate of the vertex. 50 | /// The boundary mark. 51 | public Vertex(float x, float y, int mark) 52 | : this(x, y, mark, 0) 53 | { 54 | } 55 | 56 | /// 57 | /// Initializes a new instance of the class. 58 | /// 59 | /// The x coordinate of the vertex. 60 | /// The y coordinate of the vertex. 61 | /// The boundary mark. 62 | /// The number of point attributes. 63 | public Vertex(float x, float y, int mark, int attribs) 64 | : base(x, y, mark) 65 | { 66 | this.type = VertexType.InputVertex; 67 | 68 | if (attribs > 0) 69 | { 70 | this.attributes = new float[attribs]; 71 | } 72 | } 73 | 74 | #region Public properties 75 | 76 | /// 77 | /// Gets the vertex type. 78 | /// 79 | public VertexType Type 80 | { 81 | get { return this.type; } 82 | } 83 | 84 | /// 85 | /// Gets the specified coordinate of the vertex. 86 | /// 87 | /// Coordinate index. 88 | /// X coordinate, if index is 0, Y coordinate, if index is 1. 89 | public float this[int i] 90 | { 91 | get 92 | { 93 | if (i == 0) 94 | { 95 | return x; 96 | } 97 | 98 | if (i == 1) 99 | { 100 | return y; 101 | } 102 | 103 | throw new ArgumentOutOfRangeException("Index must be 0 or 1."); 104 | } 105 | } 106 | 107 | #endregion 108 | 109 | public override int GetHashCode() 110 | { 111 | return this.hash; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Data/Vertex.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e34f40994e3645a4c99347fa8420ef06 3 | timeCreated: 1429807110 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Enums.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet 9 | { 10 | /// 11 | /// Implemented triangulation algorithms. 12 | /// 13 | public enum TriangulationAlgorithm 14 | { 15 | Dwyer, 16 | Incremental, 17 | SweepLine 18 | }; 19 | 20 | /// 21 | /// Labels that signify the result of point location. 22 | /// 23 | /// The result of a search indicates that the point falls in the 24 | /// interior of a triangle, on an edge, on a vertex, or outside the mesh. 25 | /// 26 | enum LocateResult { InTriangle, OnEdge, OnVertex, Outside }; 27 | 28 | /// 29 | /// Labels that signify the result of vertex insertion. 30 | /// 31 | /// The result indicates that the vertex was inserted with complete 32 | /// success, was inserted but encroaches upon a subsegment, was not inserted 33 | /// because it lies on a segment, or was not inserted because another vertex 34 | /// occupies the same location. 35 | /// 36 | enum InsertVertexResult { Successful, Encroaching, Violating, Duplicate }; 37 | 38 | /// 39 | /// Labels that signify the result of direction finding. 40 | /// 41 | /// The result indicates that a segment connecting the two query 42 | /// points falls within the direction triangle, along the left edge of the 43 | /// direction triangle, or along the right edge of the direction triangle. 44 | /// 45 | enum FindDirectionResult { Within, Leftcollinear, Rightcollinear }; 46 | 47 | /// 48 | /// The type of the mesh vertex. 49 | /// 50 | public enum VertexType { InputVertex, SegmentVertex, FreeVertex, DeadVertex, UndeadVertex }; 51 | 52 | /// 53 | /// Node renumbering algorithms. 54 | /// 55 | public enum NodeNumbering { None, Linear, CuthillMcKee }; 56 | } 57 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Enums.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c2cacde362bf94449dab2e6aa67e0b4 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e6860a3f0c62044fbb413f03de0a07c 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/BoundingBox.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using System; 10 | 11 | /// 12 | /// A simple bounding box class. 13 | /// 14 | public class BoundingBox 15 | { 16 | float xmin, ymin, xmax, ymax; 17 | 18 | /// 19 | /// Initializes a new instance of the class. 20 | /// 21 | public BoundingBox() 22 | { 23 | xmin = float.MaxValue; 24 | ymin = float.MaxValue; 25 | xmax = -float.MaxValue; 26 | ymax = -float.MaxValue; 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the class 31 | /// with predefined bounds. 32 | /// 33 | /// Minimum x value. 34 | /// Minimum y value. 35 | /// Maximum x value. 36 | /// Maximum y value. 37 | public BoundingBox(float xmin, float ymin, float xmax, float ymax) 38 | { 39 | this.xmin = xmin; 40 | this.ymin = ymin; 41 | this.xmax = xmax; 42 | this.ymax = ymax; 43 | } 44 | 45 | /// 46 | /// Gets the minimum x value (left boundary). 47 | /// 48 | public float Xmin 49 | { 50 | get { return xmin; } 51 | } 52 | 53 | /// 54 | /// Gets the minimum y value (bottom boundary). 55 | /// 56 | public float Ymin 57 | { 58 | get { return ymin; } 59 | } 60 | 61 | /// 62 | /// Gets the maximum x value (right boundary). 63 | /// 64 | public float Xmax 65 | { 66 | get { return xmax; } 67 | } 68 | 69 | /// 70 | /// Gets the maximum y value (top boundary). 71 | /// 72 | public float Ymax 73 | { 74 | get { return ymax; } 75 | } 76 | 77 | /// 78 | /// Gets the width of the bounding box. 79 | /// 80 | public float Width 81 | { 82 | get { return xmax - xmin; } 83 | } 84 | 85 | /// 86 | /// Gets the height of the bounding box. 87 | /// 88 | public float Height 89 | { 90 | get { return ymax - ymin; } 91 | } 92 | 93 | /// 94 | /// Update bounds. 95 | /// 96 | /// X coordinate. 97 | /// Y coordinate. 98 | public void Update(float x, float y) 99 | { 100 | xmin = UnityEngine.Mathf.Min(xmin, x); 101 | ymin = UnityEngine.Mathf.Min(ymin, y); 102 | xmax = UnityEngine.Mathf.Max(xmax, x); 103 | ymax = UnityEngine.Mathf.Max(ymax, y); 104 | } 105 | 106 | /// 107 | /// Scale bounds. 108 | /// 109 | /// Add dx to left and right bounds. 110 | /// Add dy to top and bottom bounds. 111 | public void Scale(float dx, float dy) 112 | { 113 | xmin -= dx; 114 | xmax += dx; 115 | ymin -= dy; 116 | ymax += dy; 117 | } 118 | 119 | /// 120 | /// Check if given point is inside bounding box. 121 | /// 122 | /// Point to check. 123 | /// Return true, if bounding box contains given point. 124 | public bool Contains(Point pt) 125 | { 126 | return ((pt.x >= xmin) && (pt.x <= xmax) && (pt.y >= ymin) && (pt.y <= ymax)); 127 | } 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/BoundingBox.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eaeba5ef4a7c72e43af09582bf71d918 3 | timeCreated: 1429807110 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/Edge.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Data; 14 | 15 | /// 16 | /// Represents a straight line segment in 2D space. 17 | /// 18 | public class Edge 19 | { 20 | /// 21 | /// Gets the first endpoints index. 22 | /// 23 | public int P0 24 | { 25 | get; 26 | private set; 27 | } 28 | 29 | /// 30 | /// Gets the second endpoints index. 31 | /// 32 | public int P1 33 | { 34 | get; 35 | private set; 36 | } 37 | 38 | /// 39 | /// Gets the segments boundary mark. 40 | /// 41 | public int Boundary 42 | { 43 | get; 44 | private set; 45 | } 46 | 47 | /// 48 | /// Initializes a new instance of the class. 49 | /// 50 | public Edge(int p0, int p1) 51 | : this(p0, p1, 0) 52 | { } 53 | 54 | /// 55 | /// Initializes a new instance of the class. 56 | /// 57 | public Edge(int p0, int p1, int boundary) 58 | { 59 | this.P0 = p0; 60 | this.P1 = p1; 61 | this.Boundary = boundary; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/Edge.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08fb92725da851e4ea4d00038d13253e 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/EdgeEnumerator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Data; 14 | 15 | /// 16 | /// Enumerates the edges of a triangulation. 17 | /// 18 | public class EdgeEnumerator : IEnumerator 19 | { 20 | IEnumerator triangles; 21 | Otri tri = default(Otri); 22 | Otri neighbor = default(Otri); 23 | Osub sub = default(Osub); 24 | Edge current; 25 | Vertex p1, p2; 26 | 27 | /// 28 | /// Initializes a new instance of the class. 29 | /// 30 | public EdgeEnumerator(Mesh mesh) 31 | { 32 | triangles = mesh.triangles.Values.GetEnumerator(); 33 | triangles.MoveNext(); 34 | 35 | tri.triangle = triangles.Current; 36 | tri.orient = 0; 37 | } 38 | 39 | public Edge Current 40 | { 41 | get { return current; } 42 | } 43 | 44 | public void Dispose() 45 | { 46 | this.triangles.Dispose(); 47 | } 48 | 49 | object System.Collections.IEnumerator.Current 50 | { 51 | get { return current; } 52 | } 53 | 54 | public bool MoveNext() 55 | { 56 | if (tri.triangle == null) 57 | { 58 | return false; 59 | } 60 | 61 | current = null; 62 | 63 | while (current == null) 64 | { 65 | if (tri.orient == 3) 66 | { 67 | if (triangles.MoveNext()) 68 | { 69 | tri.triangle = triangles.Current; 70 | tri.orient = 0; 71 | } 72 | else 73 | { 74 | // Finally no more triangles 75 | return false; 76 | } 77 | } 78 | 79 | tri.Sym(ref neighbor); 80 | 81 | if ((tri.triangle.id < neighbor.triangle.id) || (neighbor.triangle == Mesh.dummytri)) 82 | { 83 | p1 = tri.Org(); 84 | p2 = tri.Dest(); 85 | 86 | tri.SegPivot(ref sub); 87 | 88 | // Boundary mark of dummysub is 0, so we don't need to worry about that. 89 | current = new Edge(p1.id, p2.id, sub.seg.boundary); 90 | } 91 | 92 | tri.orient++; 93 | } 94 | 95 | return true; 96 | } 97 | 98 | public void Reset() 99 | { 100 | this.triangles.Reset(); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/EdgeEnumerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 99cf6694a773e6d4fb7272cb16d4af9d 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/ISegment.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using TriangleNet.Data; 10 | 11 | /// 12 | /// Interface for segment geometry. 13 | /// 14 | public interface ISegment 15 | { 16 | #region Public properties 17 | 18 | /// 19 | /// Gets the first endpoints vertex id. 20 | /// 21 | int P0 { get; } 22 | 23 | /// 24 | /// Gets the seconds endpoints vertex id. 25 | /// 26 | int P1 { get; } 27 | 28 | /// 29 | /// Gets the segment boundary mark. 30 | /// 31 | int Boundary { get; } 32 | 33 | /// 34 | /// Gets the segments endpoint. 35 | /// 36 | /// The vertex index (0 or 1). 37 | Vertex GetVertex(int index); 38 | 39 | /// 40 | /// Gets an adjoining triangle. 41 | /// 42 | /// The triangle index (0 or 1). 43 | ITriangle GetTriangle(int index); 44 | 45 | #endregion 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/ISegment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a57ce67fbd503e4a930168d1ca867dd 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/ITriangle.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using TriangleNet.Data; 10 | 11 | /// 12 | /// Triangle interface. 13 | /// 14 | public interface ITriangle 15 | { 16 | /// 17 | /// The triangle id. 18 | /// 19 | int ID { get; } 20 | 21 | /// 22 | /// First vertex id of the triangle. 23 | /// 24 | int P0 { get; } 25 | /// 26 | /// Second vertex id of the triangle. 27 | /// 28 | int P1 { get; } 29 | /// 30 | /// Third vertex id of the triangle. 31 | /// 32 | int P2 { get; } 33 | 34 | /// 35 | /// Gets a triangles vertex. 36 | /// 37 | /// The vertex index (0, 1 or 2). 38 | /// The vertex of the specified corner index. 39 | Vertex GetVertex(int index); 40 | 41 | /// 42 | /// True if the triangle implementation contains neighbor information. 43 | /// 44 | bool SupportsNeighbors { get; } 45 | 46 | /// 47 | /// First neighbor. 48 | /// 49 | int N0 { get; } 50 | /// 51 | /// Second neighbor. 52 | /// 53 | int N1 { get; } 54 | /// 55 | /// Third neighbor. 56 | /// 57 | int N2 { get; } 58 | 59 | /// 60 | /// Gets a triangles neighbor. 61 | /// 62 | /// The vertex index (0, 1 or 2). 63 | /// The neigbbor opposite of vertex with given index. 64 | ITriangle GetNeighbor(int index); 65 | 66 | /// 67 | /// Gets a triangles segment. 68 | /// 69 | /// The vertex index (0, 1 or 2). 70 | /// The segment opposite of vertex with given index. 71 | ISegment GetSegment(int index); 72 | 73 | /// 74 | /// Triangle area constraint. 75 | /// 76 | float Area { get; set; } 77 | 78 | /// 79 | /// Region ID the triangle belongs to. 80 | /// 81 | int Region { get; } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/ITriangle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e5f119afd71c0c4e829c583961c301f 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/InputGeometry.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using TriangleNet.Data; 12 | 13 | /// 14 | /// The input geometry which will be triangulated. May represent a 15 | /// pointset or a planar straight line graph. 16 | /// 17 | public class InputGeometry 18 | { 19 | internal List points; 20 | internal List segments; 21 | internal List holes; 22 | internal List regions; 23 | 24 | BoundingBox bounds; 25 | 26 | // Used to check consitent use of point attributes. 27 | private int pointAttributes = -1; 28 | 29 | /// 30 | /// Initializes a new instance of the class. 31 | /// 32 | public InputGeometry() 33 | : this(3) 34 | { 35 | } 36 | 37 | /// 38 | /// Initializes a new instance of the class. 39 | /// The point list will be initialized with a given capacity. 40 | /// 41 | /// Point list capacity. 42 | public InputGeometry(int capacity) 43 | { 44 | points = new List(capacity); 45 | segments = new List(); 46 | holes = new List(); 47 | regions = new List(); 48 | 49 | bounds = new BoundingBox(); 50 | 51 | pointAttributes = -1; 52 | } 53 | 54 | /// 55 | /// Gets the bounding box of the input geometry. 56 | /// 57 | public BoundingBox Bounds 58 | { 59 | get { return bounds; } 60 | } 61 | 62 | /// 63 | /// Indicates, whether the geometry should be treated as a PSLG. 64 | /// 65 | public bool HasSegments 66 | { 67 | get { return segments.Count > 0; } 68 | } 69 | 70 | /// 71 | /// Gets the number of points. 72 | /// 73 | public int Count 74 | { 75 | get { return points.Count; } 76 | } 77 | 78 | /// 79 | /// Gets the list of input points. 80 | /// 81 | public IEnumerable Points 82 | { 83 | get { return (IEnumerable) points; } 84 | } 85 | 86 | /// 87 | /// Gets the list of input segments. 88 | /// 89 | public ICollection Segments 90 | { 91 | get { return segments; } 92 | } 93 | 94 | /// 95 | /// Gets the list of input holes. 96 | /// 97 | public ICollection Holes 98 | { 99 | get { return holes; } 100 | } 101 | 102 | /// 103 | /// Gets the list of regions. 104 | /// 105 | public ICollection Regions 106 | { 107 | get { return regions; } 108 | } 109 | 110 | /// 111 | /// Clear input geometry. 112 | /// 113 | public void Clear() 114 | { 115 | points.Clear(); 116 | segments.Clear(); 117 | holes.Clear(); 118 | regions.Clear(); 119 | 120 | pointAttributes = -1; 121 | } 122 | 123 | /// 124 | /// Adds a point to the geometry. 125 | /// 126 | /// X coordinate. 127 | /// Y coordinate. 128 | public void AddPoint(float x, float y) 129 | { 130 | AddPoint(x, y, 0); 131 | } 132 | 133 | /// 134 | /// Adds a point to the geometry. 135 | /// 136 | /// X coordinate. 137 | /// Y coordinate. 138 | /// Boundary marker. 139 | public void AddPoint(float x, float y, int boundary) 140 | { 141 | points.Add(new Vertex(x, y, boundary)); 142 | 143 | bounds.Update(x, y); 144 | } 145 | 146 | /// 147 | /// Adds a point to the geometry. 148 | /// 149 | /// X coordinate. 150 | /// Y coordinate. 151 | /// Boundary marker. 152 | /// Point attribute. 153 | public void AddPoint(float x, float y, int boundary, float attribute) 154 | { 155 | AddPoint(x, y, 0, new float[] { attribute }); 156 | } 157 | 158 | /// 159 | /// Adds a point to the geometry. 160 | /// 161 | /// X coordinate. 162 | /// Y coordinate. 163 | /// Boundary marker. 164 | /// Point attributes. 165 | public void AddPoint(float x, float y, int boundary, float[] attribs) 166 | { 167 | if (pointAttributes < 0) 168 | { 169 | pointAttributes = attribs == null ? 0 : attribs.Length; 170 | } 171 | else if (attribs == null && pointAttributes > 0) 172 | { 173 | throw new ArgumentException("Inconsitent use of point attributes."); 174 | } 175 | else if (attribs != null && pointAttributes != attribs.Length) 176 | { 177 | throw new ArgumentException("Inconsitent use of point attributes."); 178 | } 179 | 180 | points.Add(new Vertex(x, y, boundary) { attributes = attribs }); 181 | 182 | bounds.Update(x, y); 183 | } 184 | 185 | /// 186 | /// Adds a hole location to the geometry. 187 | /// 188 | /// X coordinate of the hole. 189 | /// Y coordinate of the hole. 190 | public void AddHole(float x, float y) 191 | { 192 | holes.Add(new Point(x, y)); 193 | } 194 | 195 | /// 196 | /// Adds a hole location to the geometry. 197 | /// 198 | /// X coordinate of the hole. 199 | /// Y coordinate of the hole. 200 | /// The region id. 201 | public void AddRegion(float x, float y, int id) 202 | { 203 | regions.Add(new RegionPointer(x, y, id)); 204 | } 205 | 206 | /// 207 | /// Adds a segment to the geometry. 208 | /// 209 | /// First endpoint. 210 | /// Second endpoint. 211 | public void AddSegment(int p0, int p1) 212 | { 213 | AddSegment(p0, p1, 0); 214 | } 215 | 216 | /// 217 | /// Adds a segment to the geometry. 218 | /// 219 | /// First endpoint. 220 | /// Second endpoint. 221 | /// Segment marker. 222 | public void AddSegment(int p0, int p1, int boundary) 223 | { 224 | if (p0 == p1 || p0 < 0 || p1 < 0) 225 | { 226 | throw new NotSupportedException("Invalid endpoints."); 227 | } 228 | 229 | segments.Add(new Edge(p0, p1, boundary)); 230 | } 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/InputGeometry.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52b80a66b7a8ba241a5bce1a6e397382 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/Point.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using UnityEngine; 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | 15 | /// 16 | /// Represents a 2D point. 17 | /// 18 | public class Point : IComparable, IEquatable 19 | { 20 | internal int id; 21 | public Vector2 coordinates; 22 | public float x 23 | { 24 | get 25 | { 26 | return coordinates.x; 27 | } 28 | set 29 | { 30 | coordinates.x = value; 31 | } 32 | } 33 | 34 | public float y 35 | { 36 | get 37 | { 38 | return coordinates.y; 39 | } 40 | set 41 | { 42 | coordinates.y = value; 43 | } 44 | } 45 | 46 | internal int mark; 47 | internal float[] attributes; 48 | 49 | public Point() 50 | : this(0, 0, 0) 51 | { 52 | } 53 | 54 | public Point(float x, float y) 55 | : this(x, y, 0) 56 | { 57 | } 58 | 59 | public Point(float x, float y, int mark) 60 | { 61 | this.coordinates.x = x; 62 | this.coordinates.y = y; 63 | this.mark = mark; 64 | } 65 | 66 | public Point(Vector2 coordinates) 67 | { 68 | this.coordinates = coordinates; 69 | } 70 | 71 | #region Public properties 72 | 73 | /// 74 | /// Gets the vertex id. 75 | /// 76 | public int ID 77 | { 78 | get { return this.id; } 79 | } 80 | 81 | /// 82 | /// Gets the vertex x coordinate. 83 | /// 84 | public float X 85 | { 86 | get { return this.x; } 87 | } 88 | 89 | /// 90 | /// Gets the vertex y coordinate. 91 | /// 92 | public float Y 93 | { 94 | get { return this.y; } 95 | } 96 | 97 | /// 98 | /// Gets the vertex boundary mark. 99 | /// 100 | public int Boundary 101 | { 102 | get { return this.mark; } 103 | } 104 | 105 | /// 106 | /// Gets the vertex attributes (may be null). 107 | /// 108 | public float[] Attributes 109 | { 110 | get { return this.attributes; } 111 | } 112 | 113 | #endregion 114 | 115 | #region Operator overloading / overriding Equals 116 | 117 | // Compare "Guidelines for Overriding Equals() and Operator ==" 118 | // http://msdn.microsoft.com/en-us/library/ms173147.aspx 119 | 120 | public static bool operator ==(Point a, Point b) 121 | { 122 | // If both are null, or both are same instance, return true. 123 | if (System.Object.ReferenceEquals(a, b)) 124 | { 125 | return true; 126 | } 127 | 128 | // If one is null, but not both, return false. 129 | if (((object)a == null) || ((object)b == null)) 130 | { 131 | return false; 132 | } 133 | 134 | return a.Equals(b); 135 | } 136 | 137 | public static bool operator !=(Point a, Point b) 138 | { 139 | return !(a == b); 140 | } 141 | 142 | public override bool Equals(object obj) 143 | { 144 | // If parameter is null return false. 145 | if (obj == null) 146 | { 147 | return false; 148 | } 149 | 150 | Point p = obj as Point; 151 | 152 | if ((object)p == null) 153 | { 154 | return false; 155 | } 156 | 157 | return (x == p.x) && (y == p.y); 158 | } 159 | 160 | public bool Equals(Point p) 161 | { 162 | // If vertex is null return false. 163 | if ((object)p == null) 164 | { 165 | return false; 166 | } 167 | 168 | // Return true if the fields match: 169 | return (x == p.x) && (y == p.y); 170 | } 171 | 172 | #endregion 173 | 174 | public int CompareTo(Point other) 175 | { 176 | if (x == other.x && y == other.y) 177 | { 178 | return 0; 179 | } 180 | 181 | return (x < other.x || (x == other.x && y < other.y)) ? -1 : 1; 182 | } 183 | 184 | public override int GetHashCode() 185 | { 186 | return x.GetHashCode() ^ y.GetHashCode(); 187 | } 188 | 189 | public override string ToString() 190 | { 191 | return String.Format("[{0},{1}]", x, y); 192 | } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/Point.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45b370d3a9cc67a489fa68a684c51469 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/RegionPointer.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Geometry 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | 12 | /// 13 | /// Pointer to a region in the mesh geometry. A region is a well-defined 14 | /// subset of the geomerty (enclosed by subsegments). 15 | /// 16 | public class RegionPointer 17 | { 18 | internal Point point; 19 | internal int id; 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// X coordinate of the region. 25 | /// Y coordinate of the region. 26 | /// Region id. 27 | public RegionPointer(float x, float y, int id) 28 | { 29 | this.point = new Point(x, y); 30 | this.id = id; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Geometry/RegionPointer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92da3f5c27fc4d84a9ca76315eececa3 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64b5503664592a947ab4db07054e8e91 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/DataReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b3ac6a713436804c9f01e8f2e98400b 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/DebugWriter.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | using System; 10 | using System.Globalization; 11 | using System.IO; 12 | using System.IO.Compression; 13 | using System.Text; 14 | using TriangleNet.Data; 15 | using TriangleNet.Geometry; 16 | 17 | /// 18 | /// Writes a the current mesh into a text file. 19 | /// 20 | /// 21 | /// File format: 22 | /// 23 | /// num_nodes 24 | /// id_1 nx ny mark 25 | /// ... 26 | /// id_n nx ny mark 27 | /// 28 | /// num_segs 29 | /// id_1 p1 p2 mark 30 | /// ... 31 | /// id_n p1 p2 mark 32 | /// 33 | /// num_tris 34 | /// id_1 p1 p2 p3 n1 n2 n3 35 | /// ... 36 | /// id_n p1 p2 p3 n1 n2 n3 37 | /// 38 | class DebugWriter 39 | { 40 | static NumberFormatInfo nfi = CultureInfo.InvariantCulture.NumberFormat; 41 | 42 | int iteration; 43 | string session; 44 | StreamWriter stream; 45 | string tmpFile; 46 | int[] vertices; 47 | int triangles; 48 | 49 | #region Singleton pattern 50 | 51 | private static readonly DebugWriter instance = new DebugWriter(); 52 | 53 | // Explicit static constructor to tell C# compiler 54 | // not to mark type as beforefieldinit 55 | static DebugWriter() { } 56 | 57 | private DebugWriter() { } 58 | 59 | public static DebugWriter Session 60 | { 61 | get 62 | { 63 | return instance; 64 | } 65 | } 66 | 67 | #endregion 68 | 69 | /// 70 | /// Start a new session with given name. 71 | /// 72 | /// Name of the session (and output files). 73 | public void Start(string session) 74 | { 75 | this.iteration = 0; 76 | this.session = session; 77 | 78 | if (this.stream != null) 79 | { 80 | throw new Exception("A session is active. Finish before starting a new."); 81 | } 82 | 83 | this.tmpFile = Path.GetTempFileName(); 84 | this.stream = new StreamWriter(tmpFile); 85 | } 86 | 87 | /// 88 | /// Write complete mesh to file. 89 | /// 90 | public void Write(Mesh mesh, bool skip = false) 91 | { 92 | this.WriteMesh(mesh, skip); 93 | 94 | this.triangles = mesh.Triangles.Count; 95 | } 96 | 97 | /// 98 | /// Finish this session. 99 | /// 100 | public void Finish() 101 | { 102 | this.Finish(session + ".mshx"); 103 | } 104 | 105 | private void Finish(string path) 106 | { 107 | if (stream != null) 108 | { 109 | stream.Flush(); 110 | stream.Dispose(); 111 | stream = null; 112 | 113 | string header = "#!N" + this.iteration + Environment.NewLine; 114 | 115 | using (var gzFile = new FileStream(path, FileMode.Create)) 116 | { 117 | using (var gzStream = new GZipStream(gzFile, CompressionMode.Compress, false)) 118 | { 119 | byte[] bytes = Encoding.UTF8.GetBytes(header); 120 | gzStream.Write(bytes, 0, bytes.Length); 121 | 122 | // TODO: read with stream 123 | bytes = File.ReadAllBytes(tmpFile); 124 | gzStream.Write(bytes, 0, bytes.Length); 125 | } 126 | } 127 | 128 | File.Delete(this.tmpFile); 129 | } 130 | } 131 | 132 | private void WriteGeometry(InputGeometry geometry) 133 | { 134 | stream.WriteLine("#!G{0}", this.iteration++); 135 | } 136 | 137 | private void WriteMesh(Mesh mesh, bool skip) 138 | { 139 | // Mesh may have changed, but we choose to skip 140 | if (triangles == mesh.triangles.Count && skip) 141 | { 142 | return; 143 | } 144 | 145 | // Header line 146 | stream.WriteLine("#!M{0}", this.iteration++); 147 | 148 | Vertex p1, p2, p3; 149 | 150 | if (VerticesChanged(mesh)) 151 | { 152 | HashVertices(mesh); 153 | 154 | // Number of vertices. 155 | stream.WriteLine("{0}", mesh.vertices.Count); 156 | 157 | foreach (var v in mesh.vertices.Values) 158 | { 159 | // Vertex number, x and y coordinates and marker. 160 | stream.WriteLine("{0} {1} {2} {3}", v.hash, v.x.ToString(nfi), v.y.ToString(nfi), v.mark); 161 | } 162 | } 163 | else 164 | { 165 | stream.WriteLine("0"); 166 | } 167 | 168 | // Number of segments. 169 | stream.WriteLine("{0}", mesh.subsegs.Count); 170 | 171 | Osub subseg = default(Osub); 172 | subseg.orient = 0; 173 | 174 | foreach (var item in mesh.subsegs.Values) 175 | { 176 | if (item.hash <= 0) 177 | { 178 | continue; 179 | } 180 | 181 | subseg.seg = item; 182 | 183 | p1 = subseg.Org(); 184 | p2 = subseg.Dest(); 185 | 186 | // Segment number, indices of its two endpoints, and marker. 187 | stream.WriteLine("{0} {1} {2} {3}", subseg.seg.hash, p1.hash, p2.hash, subseg.seg.boundary); 188 | } 189 | 190 | Otri tri = default(Otri), trisym = default(Otri); 191 | tri.orient = 0; 192 | 193 | int n1, n2, n3, h1, h2, h3; 194 | 195 | // Number of triangles. 196 | stream.WriteLine("{0}", mesh.triangles.Count); 197 | 198 | foreach (var item in mesh.triangles.Values) 199 | { 200 | tri.triangle = item; 201 | 202 | p1 = tri.Org(); 203 | p2 = tri.Dest(); 204 | p3 = tri.Apex(); 205 | 206 | h1 = (p1 == null) ? -1 : p1.hash; 207 | h2 = (p2 == null) ? -1 : p2.hash; 208 | h3 = (p3 == null) ? -1 : p3.hash; 209 | 210 | // Triangle number, indices for three vertices. 211 | stream.Write("{0} {1} {2} {3}", tri.triangle.hash, h1, h2, h3); 212 | 213 | tri.orient = 1; 214 | tri.Sym(ref trisym); 215 | n1 = trisym.triangle.hash; 216 | 217 | tri.orient = 2; 218 | tri.Sym(ref trisym); 219 | n2 = trisym.triangle.hash; 220 | 221 | tri.orient = 0; 222 | tri.Sym(ref trisym); 223 | n3 = trisym.triangle.hash; 224 | 225 | // Neighboring triangle numbers. 226 | stream.WriteLine(" {0} {1} {2}", n1, n2, n3); 227 | } 228 | } 229 | 230 | private bool VerticesChanged(Mesh mesh) 231 | { 232 | if (vertices == null || mesh.Vertices.Count != vertices.Length) 233 | { 234 | return true; 235 | } 236 | 237 | int i = 0; 238 | foreach (var v in mesh.Vertices) 239 | { 240 | if (v.id != vertices[i++]) 241 | { 242 | return true; 243 | } 244 | } 245 | 246 | return false; 247 | } 248 | 249 | private void HashVertices(Mesh mesh) 250 | { 251 | if (vertices == null || mesh.Vertices.Count != vertices.Length) 252 | { 253 | vertices = new int[mesh.Vertices.Count]; 254 | } 255 | 256 | int i = 0; 257 | foreach (var v in mesh.Vertices) 258 | { 259 | vertices[i++] = v.id; 260 | } 261 | } 262 | } 263 | } 264 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/DebugWriter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c6a497c40fa00c478326f8514c5920f 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/FileReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9872583fe5522234882b40bd623912cd 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/FileWriter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af5cbaf5c9ddaf0478c84e796cc39d8b 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/IGeometryFormat.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Geometry; 14 | 15 | /// 16 | /// Interface for geometry input. 17 | /// 18 | public interface IGeometryFormat 19 | { 20 | /// 21 | /// Read a file containing geometry information. 22 | /// 23 | /// The path of the file to read. 24 | /// An instance of the class. 25 | InputGeometry Read(string filename); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/IGeometryFormat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84ae43ee6e756ca4bb2b1480dc4690ef 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/IMeshFormat.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Geometry; 14 | 15 | /// 16 | /// Interface for mesh I/O. 17 | /// 18 | public interface IMeshFormat 19 | { 20 | /// 21 | /// Read a file containing a mesh. 22 | /// 23 | /// The path of the file to read. 24 | /// An instance of the class. 25 | Mesh Import(string filename); 26 | 27 | /// 28 | /// Save a mesh to disk. 29 | /// 30 | /// An instance of the class. 31 | /// The path of the file to save. 32 | void Write(Mesh mesh, string filename); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/IMeshFormat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a4709bc241d31f4098191c4d6812190 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/InputTriangle.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | using TriangleNet.Data; 10 | using TriangleNet.Geometry; 11 | 12 | /// 13 | /// Simple triangle class for input. 14 | /// 15 | public class InputTriangle : ITriangle 16 | { 17 | internal int[] vertices; 18 | internal int region; 19 | internal float area; 20 | 21 | public InputTriangle(int p0, int p1, int p2) 22 | { 23 | this.vertices = new int[] { p0, p1, p2 }; 24 | } 25 | 26 | #region Public properties 27 | 28 | /// 29 | /// Gets the triangle id. 30 | /// 31 | public int ID 32 | { 33 | get { return 0; } 34 | } 35 | 36 | /// 37 | /// Gets the first corners vertex id. 38 | /// 39 | public int P0 40 | { 41 | get { return this.vertices[0]; } 42 | } 43 | 44 | /// 45 | /// Gets the seconds corners vertex id. 46 | /// 47 | public int P1 48 | { 49 | get { return this.vertices[1]; } 50 | } 51 | 52 | /// 53 | /// Gets the third corners vertex id. 54 | /// 55 | public int P2 56 | { 57 | get { return this.vertices[2]; } 58 | } 59 | 60 | /// 61 | /// Gets the specified corners vertex. 62 | /// 63 | public Vertex GetVertex(int index) 64 | { 65 | return null; // TODO: throw NotSupportedException? 66 | } 67 | 68 | public bool SupportsNeighbors 69 | { 70 | get { return false; } 71 | } 72 | 73 | public int N0 74 | { 75 | get { return -1; } 76 | } 77 | 78 | public int N1 79 | { 80 | get { return -1; } 81 | } 82 | 83 | public int N2 84 | { 85 | get { return -1; } 86 | } 87 | 88 | public ITriangle GetNeighbor(int index) 89 | { 90 | return null; 91 | } 92 | 93 | public ISegment GetSegment(int index) 94 | { 95 | return null; 96 | } 97 | 98 | /// 99 | /// Gets the triangle area constraint. 100 | /// 101 | public float Area 102 | { 103 | get { return area; } 104 | set { area = value; } 105 | } 106 | 107 | /// 108 | /// Region ID the triangle belongs to. 109 | /// 110 | public int Region 111 | { 112 | get { return region; } 113 | set { region = value; } 114 | } 115 | 116 | #endregion 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/InputTriangle.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 554057c905339504bbb229582ab80f85 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/TriangleFormat.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.IO 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Geometry; 14 | using System.IO; 15 | 16 | /// 17 | /// Implements geometry and mesh file formats of the the original Triangle code. 18 | /// 19 | public class TriangleFormat : IGeometryFormat, IMeshFormat 20 | { 21 | public Mesh Import(string filename) 22 | { 23 | string ext = Path.GetExtension(filename); 24 | 25 | if (ext == ".node" || ext == ".poly" || ext == ".ele") 26 | { 27 | List triangles; 28 | InputGeometry geometry; 29 | 30 | FileReader.Read(filename, out geometry, out triangles); 31 | 32 | if (geometry != null && triangles != null) 33 | { 34 | Mesh mesh = new Mesh(); 35 | mesh.Load(geometry, triangles); 36 | 37 | return mesh; 38 | } 39 | } 40 | 41 | throw new NotSupportedException("Could not load '" + filename + "' file."); 42 | } 43 | 44 | public void Write(Mesh mesh, string filename) 45 | { 46 | FileWriter.WritePoly(mesh, Path.ChangeExtension(filename, ".poly")); 47 | FileWriter.WriteElements(mesh, Path.ChangeExtension(filename, ".ele")); 48 | } 49 | 50 | public InputGeometry Read(string filename) 51 | { 52 | string ext = Path.GetExtension(filename); 53 | 54 | if (ext == ".node") 55 | { 56 | return FileReader.ReadNodeFile(filename); 57 | } 58 | 59 | if (ext == ".poly") 60 | { 61 | return FileReader.ReadPolyFile(filename); 62 | } 63 | 64 | throw new NotSupportedException("File format '" + ext + "' not supported."); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/IO/TriangleFormat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c3f3b53e0e055745a21047d8665b09d 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 602d44b354671ec44b1a59762921819a 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/ILog.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Log 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | public enum LogLevel 15 | { 16 | Info = 0, 17 | Warning = 1, 18 | Error = 2 19 | } 20 | 21 | /// 22 | /// A basic log interface. 23 | /// 24 | public interface ILog where T : ILogItem 25 | { 26 | void Add(T item); 27 | void Clear(); 28 | 29 | void Info(string message); 30 | void Error(string message, string info); 31 | void Warning(string message, string info); 32 | 33 | IList Data { get; } 34 | 35 | LogLevel Level { get; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/ILog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ba22f0e2a143cc449d69ebf16a8e353 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/ILogItem.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Log 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// A basic log item interface. 16 | /// 17 | public interface ILogItem 18 | { 19 | DateTime Time { get; } 20 | LogLevel Level { get; } 21 | string Message { get; } 22 | string Info { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/ILogItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e9aad16ded800647b1a0d238bd59b4e 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/SimpleLog.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Log 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// A simple logger, which logs messages to a List. 16 | /// 17 | /// Using singleton pattern as proposed by Jon Skeet. 18 | /// http://csharpindepth.com/Articles/General/Singleton.aspx 19 | /// 20 | public sealed class SimpleLog : ILog 21 | { 22 | private List log = new List(); 23 | 24 | private LogLevel level = LogLevel.Info; 25 | 26 | #region Singleton pattern 27 | 28 | private static readonly SimpleLog instance = new SimpleLog(); 29 | 30 | // Explicit static constructor to tell C# compiler 31 | // not to mark type as beforefieldinit 32 | static SimpleLog() { } 33 | 34 | private SimpleLog() { } 35 | 36 | public static ILog Instance 37 | { 38 | get 39 | { 40 | return instance; 41 | } 42 | } 43 | 44 | #endregion 45 | 46 | public void Add(SimpleLogItem item) 47 | { 48 | log.Add(item); 49 | } 50 | 51 | public void Clear() 52 | { 53 | log.Clear(); 54 | } 55 | 56 | public void Info(string message) 57 | { 58 | log.Add(new SimpleLogItem(LogLevel.Info, message)); 59 | } 60 | 61 | public void Warning(string message, string location) 62 | { 63 | log.Add(new SimpleLogItem(LogLevel.Warning, message, location)); 64 | } 65 | 66 | public void Error(string message, string location) 67 | { 68 | log.Add(new SimpleLogItem(LogLevel.Error, message, location)); 69 | } 70 | 71 | public IList Data 72 | { 73 | get { return log; } 74 | } 75 | 76 | public LogLevel Level 77 | { 78 | get { return level; } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/SimpleLog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: baa169efb7fd9954c80a8f18fbff5d48 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/SimpleLogItem.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Log 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// Represents an item stored in the log. 16 | /// 17 | public class SimpleLogItem : ILogItem 18 | { 19 | DateTime time; 20 | LogLevel level; 21 | string message; 22 | string info; 23 | 24 | public DateTime Time 25 | { 26 | get { return time; } 27 | } 28 | 29 | public LogLevel Level 30 | { 31 | get { return level; } 32 | } 33 | 34 | public string Message 35 | { 36 | get { return message; } 37 | } 38 | 39 | public string Info 40 | { 41 | get { return info; } 42 | } 43 | 44 | public SimpleLogItem(LogLevel level, string message) 45 | : this(level, message, "") 46 | { } 47 | 48 | public SimpleLogItem(LogLevel level, string message, string info) 49 | { 50 | this.time = DateTime.Now; 51 | this.level = level; 52 | this.message = message; 53 | this.info = info; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Log/SimpleLogItem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59d7c5b7d89185342937fe78878bf665 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Mesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea186a0c1bb0e1340a1fc750e96b5961 3 | timeCreated: 1429807110 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/NewLocation.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96f20ea57ee91e740a29bb9d39db1829 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Primitives.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b522a050a4d794e4fae7cf84002524fb 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Properties.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f57c94a8046d27a43b59fa88ff03f331 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Triangle")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Triangle")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("96a540d0-1772-4bed-8d25-ef5fa23cd1bc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Properties/AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f174af90bc156049914ed03f3fa7f4e 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Quality.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aed7b9f37af76fb49acfc074789347f1 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Sampler.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// Used for triangle sampling in the Mesh.Locate method. 16 | /// 17 | class Sampler 18 | { 19 | static Random rand = new Random(DateTime.Now.Millisecond); 20 | 21 | // Number of random samples for point location (at least 1). 22 | int samples = 1; 23 | 24 | // Number of triangles in mesh. 25 | int triangleCount = 0; 26 | 27 | // Empirically chosen factor. 28 | static int samplefactor = 11; 29 | 30 | // Keys of the triangle dictionary. 31 | int[] keys; 32 | 33 | /// 34 | /// Reset the sampler. 35 | /// 36 | public void Reset() 37 | { 38 | this.samples = 1; 39 | this.triangleCount = 0; 40 | } 41 | 42 | /// 43 | /// Update sampling parameters if mesh changed. 44 | /// 45 | /// Current mesh. 46 | public void Update(Mesh mesh) 47 | { 48 | this.Update(mesh, false); 49 | } 50 | 51 | /// 52 | /// Update sampling parameters if mesh changed. 53 | /// 54 | /// Current mesh. 55 | public void Update(Mesh mesh, bool forceUpdate) 56 | { 57 | int count = mesh.triangles.Count; 58 | 59 | // TODO: Is checking the triangle count a good way to monitor mesh changes? 60 | if (triangleCount != count || forceUpdate) 61 | { 62 | triangleCount = count; 63 | 64 | // The number of random samples taken is proportional to the cube root of 65 | // the number of triangles in the mesh. The next bit of code assumes 66 | // that the number of triangles increases monotonically (or at least 67 | // doesn't decrease enough to matter). 68 | while (samplefactor * samples * samples * samples < count) 69 | { 70 | samples++; 71 | } 72 | 73 | // TODO: Is there a way not calling ToArray()? 74 | keys = mesh.triangles.Keys.ToArray(); 75 | } 76 | } 77 | 78 | /// 79 | /// Get a random sample set of triangle keys. 80 | /// 81 | /// Array of triangle keys. 82 | public int[] GetSamples(Mesh mesh) 83 | { 84 | // TODO: Using currKeys to check key availability? 85 | List randSamples = new List(samples); 86 | 87 | int range = triangleCount / samples; 88 | int key; 89 | 90 | for (int i = 0; i < samples; i++) 91 | { 92 | // Yeah, rand should be equally distributed, but just to make 93 | // sure, use a range variable... 94 | key = rand.Next(i * range, (i + 1) * range - 1); 95 | 96 | if (!mesh.triangles.Keys.Contains(keys[key])) 97 | { 98 | // Keys collection isn't up to date anymore! 99 | this.Update(mesh, true); 100 | i--; 101 | } 102 | else 103 | { 104 | randSamples.Add(keys[key]); 105 | } 106 | } 107 | 108 | return randSamples.ToArray(); 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Sampler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92f0f48d37d8f1b4c9530e2c5e057ae8 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Smoothing.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db225f14be3d04f4c8dd057d4a69db00 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Smoothing/ISmoother.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Smoothing 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// Interface for mesh smoothers. 16 | /// 17 | public interface ISmoother 18 | { 19 | void Smooth(); 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Smoothing/ISmoother.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2d3f413dfd38444ba804b7f6876da1b 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Smoothing/SimpleSmoother.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Smoothing 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Geometry; 14 | using TriangleNet.Tools; 15 | 16 | /// 17 | /// Simple mesh smoother implementation. 18 | /// 19 | /// 20 | /// Vertices wich should not move (e.g. segment vertices) MUST have a 21 | /// boundary mark greater than 0. 22 | /// 23 | public class SimpleSmoother : ISmoother 24 | { 25 | Mesh mesh; 26 | 27 | public SimpleSmoother(Mesh mesh) 28 | { 29 | this.mesh = mesh; 30 | } 31 | 32 | public void Smooth() 33 | { 34 | mesh.behavior.Quality = false; 35 | 36 | // Take a few smoothing rounds. 37 | for (int i = 0; i < 5; i++) 38 | { 39 | Step(); 40 | 41 | // Actually, we only want to rebuild, if mesh is no longer 42 | // Delaunay. Flipping edges could be the right choice instead 43 | // of re-triangulating... 44 | mesh.Triangulate(Rebuild()); 45 | } 46 | } 47 | 48 | /// 49 | /// Smooth all free nodes. 50 | /// 51 | private void Step() 52 | { 53 | BoundedVoronoi voronoi = new BoundedVoronoi(this.mesh, false); 54 | 55 | var cells = voronoi.Regions; 56 | 57 | float x, y; 58 | int n; 59 | 60 | foreach (var cell in cells) 61 | { 62 | n = 0; 63 | x = y = 0.0f; 64 | foreach (var p in cell.Vertices) 65 | { 66 | n++; 67 | x += p.x; 68 | y += p.y; 69 | } 70 | 71 | cell.Generator.x = x / n; 72 | cell.Generator.y = y / n; 73 | } 74 | } 75 | 76 | /// 77 | /// Rebuild the input geometry. 78 | /// 79 | private InputGeometry Rebuild() 80 | { 81 | InputGeometry geometry = new InputGeometry(mesh.vertices.Count); 82 | 83 | foreach (var vertex in mesh.vertices.Values) 84 | { 85 | geometry.AddPoint(vertex.x, vertex.y, vertex.mark); 86 | } 87 | 88 | foreach (var segment in mesh.subsegs.Values) 89 | { 90 | geometry.AddSegment(segment.P0, segment.P1, segment.Boundary); 91 | } 92 | 93 | foreach (var hole in mesh.holes) 94 | { 95 | geometry.AddHole(hole.x, hole.y); 96 | } 97 | 98 | foreach (var region in mesh.regions) 99 | { 100 | geometry.AddRegion(region.point.x, region.point.y, region.id); 101 | } 102 | 103 | return geometry; 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Smoothing/SimpleSmoother.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a015eb96843d7904d8650ce5479029b2 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 316ab288180b2514cbdc8dcd52cf1bac 3 | folderAsset: yes 4 | timeCreated: 1429807108 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/AdjacencyMatrix.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Tools 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | 14 | /// 15 | /// The adjacency matrix of the mesh. 16 | /// 17 | public class AdjacencyMatrix 18 | { 19 | // Number of nodes in the mesh. 20 | int node_num; 21 | 22 | // Number of adjacency entries. 23 | int adj_num; 24 | 25 | // Pointers into the actual adjacency structure adj. Information about row k is 26 | // stored in entries adj_row(k) through adj_row(k+1)-1 of adj. Size: node_num + 1 27 | int[] adj_row; 28 | 29 | // The adjacency structure. For each row, it contains the column indices 30 | // of the nonzero entries. Size: adj_num 31 | int[] adj; 32 | 33 | public int[] AdjacencyRow 34 | { 35 | get { return adj_row; } 36 | } 37 | 38 | public int[] Adjacency 39 | { 40 | get { return adj; } 41 | } 42 | 43 | public AdjacencyMatrix(Mesh mesh) 44 | { 45 | this.node_num = mesh.vertices.Count; 46 | 47 | // Set up the adj_row adjacency pointer array. 48 | this.adj_row = AdjacencyCount(mesh); 49 | this.adj_num = adj_row[node_num] - 1; 50 | 51 | // Set up the adj adjacency array. 52 | this.adj = AdjacencySet(mesh, this.adj_row); 53 | } 54 | 55 | /// 56 | /// Computes the bandwidth of an adjacency matrix. 57 | /// 58 | /// Bandwidth of the adjacency matrix. 59 | public int Bandwidth() 60 | { 61 | int band_hi; 62 | int band_lo; 63 | int col; 64 | int i, j; 65 | 66 | band_lo = 0; 67 | band_hi = 0; 68 | 69 | for (i = 0; i < node_num; i++) 70 | { 71 | for (j = adj_row[i]; j <= adj_row[i + 1] - 1; j++) 72 | { 73 | col = adj[j - 1]; 74 | band_lo = UnityEngine.Mathf.Max(band_lo, i - col); 75 | band_hi = UnityEngine.Mathf.Max(band_hi, col - i); 76 | } 77 | } 78 | 79 | return band_lo + 1 + band_hi; 80 | } 81 | 82 | #region Adjacency matrix 83 | 84 | /// 85 | /// Counts adjacencies in a triangulation. 86 | /// 87 | /// 88 | /// This routine is called to count the adjacencies, so that the 89 | /// appropriate amount of memory can be set aside for storage when 90 | /// the adjacency structure is created. 91 | /// 92 | /// The triangulation is assumed to involve 3-node triangles. 93 | /// 94 | /// Two nodes are "adjacent" if they are both nodes in some triangle. 95 | /// Also, a node is considered to be adjacent to itself. 96 | /// 97 | /// Diagram: 98 | /// 99 | /// 3 100 | /// s |\ 101 | /// i | \ 102 | /// d | \ 103 | /// e | \ side 1 104 | /// | \ 105 | /// 2 | \ 106 | /// | \ 107 | /// 1-------2 108 | /// 109 | /// side 3 110 | /// 111 | int[] AdjacencyCount(Mesh mesh) 112 | { 113 | int i; 114 | int node; 115 | int n1, n2, n3; 116 | int tri_id; 117 | int neigh_id; 118 | 119 | int[] adj_rows = new int[node_num + 1]; 120 | 121 | // Set every node to be adjacent to itself. 122 | for (node = 0; node < node_num; node++) 123 | { 124 | adj_rows[node] = 1; 125 | } 126 | 127 | // Examine each triangle. 128 | foreach (var tri in mesh.triangles.Values) 129 | { 130 | tri_id = tri.id; 131 | 132 | n1 = tri.vertices[0].id; 133 | n2 = tri.vertices[1].id; 134 | n3 = tri.vertices[2].id; 135 | 136 | // Add edge (1,2) if this is the first occurrence, that is, if 137 | // the edge (1,2) is on a boundary (nid <= 0) or if this triangle 138 | // is the first of the pair in which the edge occurs (tid < nid). 139 | neigh_id = tri.neighbors[2].triangle.id; 140 | 141 | if (neigh_id < 0 || tri_id < neigh_id) 142 | { 143 | adj_rows[n1] += 1; 144 | adj_rows[n2] += 1; 145 | } 146 | 147 | // Add edge (2,3). 148 | neigh_id = tri.neighbors[0].triangle.id; 149 | 150 | if (neigh_id < 0 || tri_id < neigh_id) 151 | { 152 | adj_rows[n2] += 1; 153 | adj_rows[n3] += 1; 154 | } 155 | 156 | // Add edge (3,1). 157 | neigh_id = tri.neighbors[1].triangle.id; 158 | 159 | if (neigh_id < 0 || tri_id < neigh_id) 160 | { 161 | adj_rows[n3] += 1; 162 | adj_rows[n1] += 1; 163 | } 164 | } 165 | 166 | // We used ADJ_COL to count the number of entries in each column. 167 | // Convert it to pointers into the ADJ array. 168 | for (node = node_num; 1 <= node; node--) 169 | { 170 | adj_rows[node] = adj_rows[node - 1]; 171 | } 172 | 173 | adj_rows[0] = 1; 174 | for (i = 1; i <= node_num; i++) 175 | { 176 | adj_rows[i] = adj_rows[i - 1] + adj_rows[i]; 177 | } 178 | 179 | return adj_rows; 180 | } 181 | 182 | /// 183 | /// Sets adjacencies in a triangulation. 184 | /// 185 | /// 186 | /// This routine can be used to create the compressed column storage 187 | /// for a linear triangle finite element discretization of Poisson's 188 | /// equation in two dimensions. 189 | /// 190 | int[] AdjacencySet(Mesh mesh, int[] rows) 191 | { 192 | // Output list, stores the actual adjacency information. 193 | int[] list; 194 | 195 | // Copy of the adjacency rows input. 196 | int[] rowsCopy = new int[node_num]; 197 | Array.Copy(rows, rowsCopy, node_num); 198 | 199 | int i, n = rows[node_num] - 1; 200 | 201 | list = new int[n]; 202 | for (i = 0; i < n; i++) 203 | { 204 | list[i] = -1; 205 | } 206 | 207 | // Set every node to be adjacent to itself. 208 | for (i = 0; i < node_num; i++) 209 | { 210 | list[rowsCopy[i] - 1] = i; 211 | rowsCopy[i] += 1; 212 | } 213 | 214 | int n1, n2, n3; // Vertex numbers. 215 | int tid, nid; // Triangle and neighbor id. 216 | 217 | // Examine each triangle. 218 | foreach (var tri in mesh.triangles.Values) 219 | { 220 | tid = tri.id; 221 | 222 | n1 = tri.vertices[0].id; 223 | n2 = tri.vertices[1].id; 224 | n3 = tri.vertices[2].id; 225 | 226 | // Add edge (1,2) if this is the first occurrence, that is, if 227 | // the edge (1,2) is on a boundary (nid <= 0) or if this triangle 228 | // is the first of the pair in which the edge occurs (tid < nid). 229 | nid = tri.neighbors[2].triangle.id; 230 | 231 | if (nid < 0 || tid < nid) 232 | { 233 | list[rowsCopy[n1] - 1] = n2; 234 | rowsCopy[n1] += 1; 235 | list[rowsCopy[n2] - 1] = n1; 236 | rowsCopy[n2] += 1; 237 | } 238 | 239 | // Add edge (2,3). 240 | nid = tri.neighbors[0].triangle.id; 241 | 242 | if (nid < 0 || tid < nid) 243 | { 244 | list[rowsCopy[n2] - 1] = n3; 245 | rowsCopy[n2] += 1; 246 | list[rowsCopy[n3] - 1] = n2; 247 | rowsCopy[n3] += 1; 248 | } 249 | 250 | // Add edge (3,1). 251 | nid = tri.neighbors[1].triangle.id; 252 | 253 | if (nid < 0 || tid < nid) 254 | { 255 | list[rowsCopy[n1] - 1] = n3; 256 | rowsCopy[n1] += 1; 257 | list[rowsCopy[n3] - 1] = n1; 258 | rowsCopy[n3] += 1; 259 | } 260 | } 261 | 262 | int k1, k2; 263 | 264 | // Ascending sort the entries for each node. 265 | for (i = 0; i < node_num; i++) 266 | { 267 | k1 = rows[i]; 268 | k2 = rows[i + 1] - 1; 269 | HeapSort(list, k1 - 1, k2 + 1 - k1); 270 | } 271 | 272 | return list; 273 | } 274 | 275 | #endregion 276 | 277 | #region Heap sort 278 | 279 | /// 280 | /// Reorders an array of integers into a descending heap. 281 | /// 282 | /// the size of the input array. 283 | /// an unsorted array. 284 | /// 285 | /// A heap is an array A with the property that, for every index J, 286 | /// A[J] >= A[2*J+1] and A[J] >= A[2*J+2], (as long as the indices 287 | /// 2*J+1 and 2*J+2 are legal). 288 | /// 289 | /// Diagram: 290 | /// 291 | /// A(0) 292 | /// / \ 293 | /// A(1) A(2) 294 | /// / \ / \ 295 | /// A(3) A(4) A(5) A(6) 296 | /// / \ / \ 297 | /// A(7) A(8) A(9) A(10) 298 | /// 299 | private void CreateHeap(int[] a, int offset, int size) 300 | { 301 | int i; 302 | int ifree; 303 | int key; 304 | int m; 305 | 306 | // Only nodes (N/2)-1 down to 0 can be "parent" nodes. 307 | for (i = (size / 2) - 1; 0 <= i; i--) 308 | { 309 | // Copy the value out of the parent node. 310 | // Position IFREE is now "open". 311 | key = a[offset + i]; 312 | ifree = i; 313 | 314 | for (; ; ) 315 | { 316 | // Positions 2*IFREE + 1 and 2*IFREE + 2 are the descendants of position 317 | // IFREE. (One or both may not exist because they equal or exceed N.) 318 | m = 2 * ifree + 1; 319 | 320 | // Does the first position exist? 321 | if (size <= m) 322 | { 323 | break; 324 | } 325 | else 326 | { 327 | // Does the second position exist? 328 | if (m + 1 < size) 329 | { 330 | // If both positions exist, take the larger of the two values, 331 | // and update M if necessary. 332 | if (a[offset + m] < a[offset + m + 1]) 333 | { 334 | m = m + 1; 335 | } 336 | } 337 | 338 | // If the large descendant is larger than KEY, move it up, 339 | // and update IFREE, the location of the free position, and 340 | // consider the descendants of THIS position. 341 | if (key < a[offset + m]) 342 | { 343 | a[offset + ifree] = a[offset + m]; 344 | ifree = m; 345 | } 346 | else 347 | { 348 | break; 349 | } 350 | } 351 | } 352 | 353 | // When you have stopped shifting items up, return the item you 354 | // pulled out back to the heap. 355 | a[offset + ifree] = key; 356 | } 357 | 358 | return; 359 | } 360 | 361 | 362 | /// 363 | /// ascending sorts an array of integers using heap sort. 364 | /// 365 | /// Number of entries in the array. 366 | /// Array to be sorted; 367 | private void HeapSort(int[] a, int offset, int size) 368 | { 369 | int n1; 370 | int temp; 371 | 372 | if (size <= 1) 373 | { 374 | return; 375 | } 376 | 377 | // 1: Put A into descending heap form. 378 | CreateHeap(a, offset, size); 379 | 380 | // 2: Sort A. 381 | // The largest object in the heap is in A[0]. 382 | // Move it to position A[N-1]. 383 | temp = a[offset]; 384 | a[offset] = a[offset + size - 1]; 385 | a[offset + size - 1] = temp; 386 | 387 | // Consider the diminished heap of size N1. 388 | for (n1 = size - 1; 2 <= n1; n1--) 389 | { 390 | // Restore the heap structure of the initial N1 entries of A. 391 | CreateHeap(a, offset, n1); 392 | 393 | // Take the largest object from A[0] and move it to A[N1-1]. 394 | temp = a[offset]; 395 | a[offset] = a[offset + n1 - 1]; 396 | a[offset + n1 - 1] = temp; 397 | } 398 | 399 | return; 400 | } 401 | 402 | #endregion 403 | } 404 | } 405 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/AdjacencyMatrix.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9a53cd21e202fa41b16639a498e7551 3 | timeCreated: 1429807111 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/BoundedVoronoi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fe89fbafd4ea47419c80457b2a492dd 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/CuthillMcKee.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 12e29869d38502f47b938dfce4021e02 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/IVoronoi.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Tools 8 | { 9 | using System.Collections.Generic; 10 | using TriangleNet.Geometry; 11 | 12 | /// 13 | /// TODO: Update summary. 14 | /// 15 | public interface IVoronoi 16 | { 17 | /// 18 | /// Gets the list of Voronoi vertices. 19 | /// 20 | Point[] Points { get; } 21 | 22 | /// 23 | /// Gets the list of Voronoi regions. 24 | /// 25 | List Regions { get; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/IVoronoi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7832ee5a66ec354f96b1ab307f59a54 3 | timeCreated: 1429807110 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/QuadTree.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f5d1c4692f498446ba0e356b1debf20 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/QualityMeasure.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2597a8eddea1f7a48931a6b4bda44242 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/RegionIterator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Matlab code by John Burkardt, Florida State University 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | namespace TriangleNet.Tools 9 | { 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | using TriangleNet.Data; 15 | 16 | /// 17 | /// Iterates the region a given triangle belongs to and applies an action 18 | /// to each connected trianlge in that region. Default action is to set the 19 | /// region id. 20 | /// 21 | public class RegionIterator 22 | { 23 | Mesh mesh; 24 | List viri; 25 | 26 | public RegionIterator(Mesh mesh) 27 | { 28 | this.mesh = mesh; 29 | this.viri = new List(); 30 | } 31 | 32 | /// 33 | /// Spread regional attributes and/or area constraints (from a .poly file) 34 | /// throughout the mesh. 35 | /// 36 | /// 37 | /// 38 | /// 39 | /// This procedure operates in two phases. The first phase spreads an 40 | /// attribute and/or an area constraint through a (segment-bounded) region. 41 | /// The triangles are marked to ensure that each triangle is added to the 42 | /// virus pool only once, so the procedure will terminate. 43 | /// 44 | /// The second phase uninfects all infected triangles, returning them to 45 | /// normal. 46 | /// 47 | void ProcessRegion(Action func) 48 | { 49 | Otri testtri = default(Otri); 50 | Otri neighbor = default(Otri); 51 | Osub neighborsubseg = default(Osub); 52 | 53 | Behavior behavior = mesh.behavior; 54 | 55 | // Loop through all the infected triangles, spreading the attribute 56 | // and/or area constraint to their neighbors, then to their neighbors' 57 | // neighbors. 58 | for (int i = 0; i < viri.Count; i++) 59 | { 60 | // WARNING: Don't use foreach, viri list gets modified. 61 | 62 | testtri.triangle = viri[i]; 63 | // A triangle is marked as infected by messing with one of its pointers 64 | // to subsegments, setting it to an illegal value. Hence, we have to 65 | // temporarily uninfect this triangle so that we can examine its 66 | // adjacent subsegments. 67 | // TODO: Not true in the C# version (so we could skip this). 68 | testtri.Uninfect(); 69 | 70 | // Apply function. 71 | func(testtri.triangle); 72 | 73 | // Check each of the triangle's three neighbors. 74 | for (testtri.orient = 0; testtri.orient < 3; testtri.orient++) 75 | { 76 | // Find the neighbor. 77 | testtri.Sym(ref neighbor); 78 | // Check for a subsegment between the triangle and its neighbor. 79 | testtri.SegPivot(ref neighborsubseg); 80 | // Make sure the neighbor exists, is not already infected, and 81 | // isn't protected by a subsegment. 82 | if ((neighbor.triangle != Mesh.dummytri) && !neighbor.IsInfected() 83 | && (neighborsubseg.seg == Mesh.dummysub)) 84 | { 85 | // Infect the neighbor. 86 | neighbor.Infect(); 87 | // Ensure that the neighbor's neighbors will be infected. 88 | viri.Add(neighbor.triangle); 89 | } 90 | } 91 | // Remark the triangle as infected, so it doesn't get added to the 92 | // virus pool again. 93 | testtri.Infect(); 94 | } 95 | 96 | // Uninfect all triangles. 97 | foreach (var virus in viri) 98 | { 99 | virus.infected = false; 100 | } 101 | 102 | // Empty the virus pool. 103 | viri.Clear(); 104 | } 105 | 106 | /// 107 | /// Set the region attribute of all trianlges connected to given triangle. 108 | /// 109 | public void Process(Triangle triangle) 110 | { 111 | // Default action is to just set the region id for all trianlges. 112 | this.Process(triangle, (tri) => { tri.region = triangle.region; }); 113 | } 114 | 115 | /// 116 | /// Process all trianlges connected to given triangle and apply given action. 117 | /// 118 | public void Process(Triangle triangle, Action func) 119 | { 120 | if (triangle != Mesh.dummytri) 121 | { 122 | // Make sure the triangle under consideration still exists. 123 | // It may have been eaten by the virus. 124 | if (!Otri.IsDead(triangle)) 125 | { 126 | // Put one triangle in the virus pool. 127 | triangle.infected = true; 128 | viri.Add(triangle); 129 | // Apply one region's attribute and/or area constraint. 130 | ProcessRegion(func); 131 | // The virus pool should be empty now. 132 | } 133 | } 134 | 135 | // Free up memory (virus pool should be empty anyway). 136 | viri.Clear(); 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/RegionIterator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 586f3b651bbae66478e60bfb1c9cee61 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/Statistic.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc812c0bd4735924389b71949f9ceb43 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/Voronoi.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Original Triangle code by Jonathan Richard Shewchuk, http://www.cs.cmu.edu/~quake/triangle.html 4 | // Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ 5 | // 6 | // ----------------------------------------------------------------------- 7 | 8 | using System; 9 | using System.Collections.Generic; 10 | using TriangleNet.Data; 11 | using TriangleNet.Geometry; 12 | 13 | namespace TriangleNet.Tools 14 | { 15 | /// 16 | /// The Voronoi Diagram is the dual of a pointset triangulation. 17 | /// 18 | public class Voronoi : IVoronoi 19 | { 20 | Mesh mesh; 21 | 22 | Point[] points; 23 | List regions; 24 | 25 | // Stores the endpoints of rays of infinite Voronoi cells 26 | Dictionary rayPoints; 27 | int rayIndex; 28 | 29 | // Bounding box of the triangles circumcenters. 30 | BoundingBox bounds; 31 | 32 | /// 33 | /// Initializes a new instance of the class. 34 | /// 35 | /// 36 | /// 37 | /// Be sure MakeVertexMap has been called (should always be the case). 38 | /// 39 | public Voronoi(Mesh mesh) 40 | { 41 | this.mesh = mesh; 42 | 43 | Generate(); 44 | } 45 | 46 | /// 47 | /// Gets the list of Voronoi vertices. 48 | /// 49 | public Point[] Points 50 | { 51 | get { return points; } 52 | } 53 | 54 | /// 55 | /// Gets the list of Voronoi regions. 56 | /// 57 | public List Regions 58 | { 59 | get { return regions; } 60 | } 61 | 62 | /// 63 | /// Gets the Voronoi diagram as raw output data. 64 | /// 65 | /// 66 | /// 67 | /// 68 | /// The Voronoi diagram is the geometric dual of the Delaunay triangulation. 69 | /// Hence, the Voronoi vertices are listed by traversing the Delaunay 70 | /// triangles, and the Voronoi edges are listed by traversing the Delaunay 71 | /// edges. 72 | /// 73 | private void Generate() 74 | { 75 | mesh.Renumber(); 76 | mesh.MakeVertexMap(); 77 | 78 | // Allocate space for voronoi diagram 79 | this.points = new Point[mesh.triangles.Count + mesh.hullsize]; 80 | this.regions = new List(mesh.vertices.Count); 81 | 82 | rayPoints = new Dictionary(); 83 | rayIndex = 0; 84 | 85 | bounds = new BoundingBox(); 86 | 87 | // Compute triangles circumcenters and setup bounding box 88 | ComputeCircumCenters(); 89 | 90 | // Loop over the mesh vertices (Voronoi generators). 91 | foreach (var item in mesh.vertices.Values) 92 | { 93 | //if (item.Boundary == 0) 94 | { 95 | ConstructVoronoiRegion(item); 96 | } 97 | } 98 | } 99 | 100 | private void ComputeCircumCenters() 101 | { 102 | Otri tri = default(Otri); 103 | float xi = 0, eta = 0; 104 | Point pt; 105 | 106 | // Compue triangle circumcenters 107 | foreach (var item in mesh.triangles.Values) 108 | { 109 | tri.triangle = item; 110 | 111 | pt = Primitives.FindCircumcenter(tri.Org(), tri.Dest(), tri.Apex(), ref xi, ref eta); 112 | pt.id = item.id; 113 | 114 | points[item.id] = pt; 115 | 116 | bounds.Update(pt.x, pt.y); 117 | } 118 | 119 | float ds = UnityEngine.Mathf.Max(bounds.Width, bounds.Height); 120 | bounds.Scale(ds, ds); 121 | } 122 | 123 | /// 124 | /// Construct Voronoi region for given vertex. 125 | /// 126 | /// 127 | /// The circumcenter indices which make up the cell. 128 | private void ConstructVoronoiRegion(Vertex vertex) 129 | { 130 | VoronoiRegion region = new VoronoiRegion(vertex); 131 | regions.Add(region); 132 | 133 | List vpoints = new List(); 134 | 135 | Otri f = default(Otri); 136 | Otri f_init = default(Otri); 137 | Otri f_next = default(Otri); 138 | Otri f_prev = default(Otri); 139 | 140 | Osub sub = default(Osub); 141 | 142 | // Call f_init a triangle incident to x 143 | vertex.tri.Copy(ref f_init); 144 | 145 | f_init.Copy(ref f); 146 | f_init.Onext(ref f_next); 147 | 148 | // Check if f_init lies on the boundary of the triangulation. 149 | if (f_next.triangle == Mesh.dummytri) 150 | { 151 | f_init.Oprev(ref f_prev); 152 | 153 | if (f_prev.triangle != Mesh.dummytri) 154 | { 155 | f_init.Copy(ref f_next); 156 | // Move one triangle clockwise 157 | f_init.OprevSelf(); 158 | f_init.Copy(ref f); 159 | } 160 | } 161 | 162 | // Go counterclockwise until we reach the border or the initial triangle. 163 | while (f_next.triangle != Mesh.dummytri) 164 | { 165 | // Add circumcenter of current triangle 166 | vpoints.Add(points[f.triangle.id]); 167 | 168 | if (f_next.Equal(f_init)) 169 | { 170 | // Voronoi cell is complete (bounded case). 171 | region.Add(vpoints); 172 | return; 173 | } 174 | 175 | f_next.Copy(ref f); 176 | f_next.OnextSelf(); 177 | } 178 | 179 | // Voronoi cell is unbounded 180 | region.Bounded = false; 181 | 182 | Vertex torg, tdest, tapex, intersection; 183 | int sid, n = mesh.triangles.Count; 184 | 185 | // Find the boundary segment id. 186 | f.Lprev(ref f_next); 187 | f_next.SegPivot(ref sub); 188 | sid = sub.seg.hash; 189 | 190 | // Last valid f lies at the boundary. Add the circumcenter. 191 | vpoints.Add(points[f.triangle.id]); 192 | 193 | // Check if the intersection with the bounding box has already been computed. 194 | if (rayPoints.ContainsKey(sid)) 195 | { 196 | vpoints.Add(rayPoints[sid]); 197 | } 198 | else 199 | { 200 | torg = f.Org(); 201 | tapex = f.Apex(); 202 | BoxRayIntersection(points[f.triangle.id], torg.y - tapex.y, tapex.x - torg.x, out intersection); 203 | 204 | // Set the correct id for the vertex 205 | intersection.id = n + rayIndex; 206 | 207 | points[n + rayIndex] = intersection; 208 | 209 | rayIndex++; 210 | 211 | vpoints.Add(intersection); 212 | rayPoints.Add(sid, intersection); 213 | } 214 | 215 | // Now walk from f_init clockwise till we reach the boundary. 216 | vpoints.Reverse(); 217 | 218 | f_init.Copy(ref f); 219 | f.Oprev(ref f_prev); 220 | 221 | while (f_prev.triangle != Mesh.dummytri) 222 | { 223 | vpoints.Add(points[f_prev.triangle.id]); 224 | 225 | f_prev.Copy(ref f); 226 | f_prev.OprevSelf(); 227 | } 228 | 229 | // Find the boundary segment id. 230 | f.SegPivot(ref sub); 231 | sid = sub.seg.hash; 232 | 233 | if (rayPoints.ContainsKey(sid)) 234 | { 235 | vpoints.Add(rayPoints[sid]); 236 | } 237 | else 238 | { 239 | // Intersection has not been computed yet. 240 | torg = f.Org(); 241 | tdest = f.Dest(); 242 | 243 | BoxRayIntersection(points[f.triangle.id], tdest.y - torg.y, torg.x - tdest.x, out intersection); 244 | 245 | // Set the correct id for the vertex 246 | intersection.id = n + rayIndex; 247 | 248 | points[n + rayIndex] = intersection; 249 | 250 | rayIndex++; 251 | 252 | vpoints.Add(intersection); 253 | rayPoints.Add(sid, intersection); 254 | } 255 | 256 | // Add the new points to the region (in counter-clockwise order) 257 | vpoints.Reverse(); 258 | region.Add(vpoints); 259 | } 260 | 261 | private bool BoxRayIntersection(Point pt, float dx, float dy, out Vertex intersect) 262 | { 263 | float x = pt.X; 264 | float y = pt.Y; 265 | 266 | float t1, x1, y1, t2, x2, y2; 267 | 268 | // Bounding box 269 | float minX = bounds.Xmin; 270 | float maxX = bounds.Xmax; 271 | float minY = bounds.Ymin; 272 | float maxY = bounds.Ymax; 273 | 274 | // Check if point is inside the bounds 275 | if (x < minX || x > maxX || y < minY || y > maxY) 276 | { 277 | intersect = null; 278 | return false; 279 | } 280 | 281 | // Calculate the cut through the vertical boundaries 282 | if (dx < 0) 283 | { 284 | // Line going to the left: intersect with x = minX 285 | t1 = (minX - x) / dx; 286 | x1 = minX; 287 | y1 = y + t1 * dy; 288 | } 289 | else if (dx > 0) 290 | { 291 | // Line going to the right: intersect with x = maxX 292 | t1 = (maxX - x) / dx; 293 | x1 = maxX; 294 | y1 = y + t1 * dy; 295 | } 296 | else 297 | { 298 | // Line going straight up or down: no intersection possible 299 | t1 = float.MaxValue; 300 | x1 = y1 = 0; 301 | } 302 | 303 | // Calculate the cut through upper and lower boundaries 304 | if (dy < 0) 305 | { 306 | // Line going downwards: intersect with y = minY 307 | t2 = (minY - y) / dy; 308 | x2 = x + t2 * dx; 309 | y2 = minY; 310 | } 311 | else if (dx > 0) 312 | { 313 | // Line going upwards: intersect with y = maxY 314 | t2 = (maxY - y) / dy; 315 | x2 = x + t2 * dx; 316 | y2 = maxY; 317 | } 318 | else 319 | { 320 | // Horizontal line: no intersection possible 321 | t2 = float.MaxValue; 322 | x2 = y2 = 0; 323 | } 324 | 325 | if (t1 < t2) 326 | { 327 | intersect = new Vertex(x1, y1, -1); 328 | } 329 | else 330 | { 331 | intersect = new Vertex(x2, y2, -1); 332 | } 333 | 334 | return true; 335 | } 336 | } 337 | } 338 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/Voronoi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 875eb4cd8979fac479952fe6c0a5acd3 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/VoronoiRegion.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // TODO: Update copyright text. 4 | // 5 | // ----------------------------------------------------------------------- 6 | 7 | namespace TriangleNet.Tools 8 | { 9 | using System; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using System.Text; 13 | using TriangleNet.Geometry; 14 | using TriangleNet.Data; 15 | 16 | /// 17 | /// Represents a region in the Voronoi diagram. 18 | /// 19 | public class VoronoiRegion 20 | { 21 | int id; 22 | Point generator; 23 | List vertices; 24 | bool bounded; 25 | 26 | /// 27 | /// Gets the Voronoi region id (which is the same as the generators vertex id). 28 | /// 29 | public int ID 30 | { 31 | get { return id; } 32 | } 33 | 34 | /// 35 | /// Gets the Voronoi regions generator. 36 | /// 37 | public Point Generator 38 | { 39 | get { return generator; } 40 | } 41 | 42 | /// 43 | /// Gets the Voronoi vertices on the regions boundary. 44 | /// 45 | public ICollection Vertices 46 | { 47 | get { return vertices; } 48 | } 49 | 50 | /// 51 | /// Gets or sets whether the Voronoi region is bounded. 52 | /// 53 | public bool Bounded 54 | { 55 | get { return bounded; } 56 | set { bounded = value; } 57 | } 58 | 59 | public VoronoiRegion(Vertex generator) 60 | { 61 | this.id = generator.id; 62 | this.generator = generator; 63 | this.vertices = new List(); 64 | this.bounded = true; 65 | } 66 | 67 | public void Add(Point point) 68 | { 69 | this.vertices.Add(point); 70 | } 71 | 72 | public void Add(List points) 73 | { 74 | this.vertices.AddRange(points); 75 | } 76 | 77 | public override string ToString() 78 | { 79 | return String.Format("R-ID {0}", id); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Tools/VoronoiRegion.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c9f8b56bd40fb4479bf1178682f2d7d 3 | timeCreated: 1429807109 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Triangle.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B} 9 | Library 10 | Properties 11 | TriangleNet 12 | Triangle 13 | v4.0 14 | 512 15 | Client 16 | SAK 17 | SAK 18 | SAK 19 | SAK 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 108 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/Triangle.csproj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8413a72ac53b3f547b2ce7dda6bd41d4 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/Triangle/TriangleLocator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d8e604e2157de7458c4524d8be27986 3 | timeCreated: 1429807108 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02fe78e962405814a83b8ba6c9471d32 3 | folderAsset: yes 4 | timeCreated: 1429807240 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e71a3e2fb5854e43823a9da25b68e21 3 | folderAsset: yes 4 | timeCreated: 1429807240 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/Assets/TriangleDotNet/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Bridge.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38d405c119fcc7c4e83d4a478a40ff2f 3 | PluginImporter: 4 | serializedVersion: 1 5 | iconMap: {} 6 | executionOrder: {} 7 | isPreloaded: 0 8 | platformData: 9 | Any: 10 | enabled: 0 11 | settings: {} 12 | Editor: 13 | enabled: 1 14 | settings: 15 | DefaultValueInitialized: true 16 | userData: 17 | assetBundleName: 18 | assetBundleVariant: 19 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/Assets/TriangleDotNet/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor/SyntaxTree.VisualStudio.Unity.Messaging.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ad02dc83da735c4e8d945332b9202f6 3 | PluginImporter: 4 | serializedVersion: 1 5 | iconMap: {} 6 | executionOrder: {} 7 | isPreloaded: 0 8 | platformData: 9 | Any: 10 | enabled: 0 11 | settings: {} 12 | Editor: 13 | enabled: 1 14 | settings: 15 | DefaultValueInitialized: true 16 | userData: 17 | assetBundleName: 18 | assetBundleVariant: 19 | -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor/UnityVS.VersionSpecific.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/Assets/TriangleDotNet/UnityVS/Editor/UnityVS.VersionSpecific.dll -------------------------------------------------------------------------------- /Assets/TriangleDotNet/UnityVS/Editor/UnityVS.VersionSpecific.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3510ce2ca49c73941bccb1f94dfb19f3 3 | timeCreated: 1429807451 4 | licenseType: Free 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | platformData: 11 | Any: 12 | enabled: 0 13 | settings: {} 14 | Editor: 15 | enabled: 1 16 | settings: 17 | DefaultValueInitialized: true 18 | userData: 19 | assetBundleName: 20 | assetBundleVariant: 21 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.0.1p1 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parahunter/triangle-net-for-unity/50059d5f8c8314098b74780719e3b37409eadbc4/ProjectSettings/TimeManager.asset --------------------------------------------------------------------------------