public NewLocation(Mesh mesh, IPredicates predicates) { this.mesh = mesh; this.predicates = predicates; this.behavior = mesh.behavior; }
public Quality(Mesh mesh) { logger = SimpleLog.Instance; badsubsegs = new Queue<BadSubseg>(); queue = new BadTriQueue(); this.mesh = mesh; this.behavior = mesh.behavior; newLocation = new NewLocation(mesh); }
Mesh generateFaceMesh(ShapePoints shape) { var mesh = new Mesh(); var verts = new List <Vector3>(); var tris = new List <int>(); var uvs = new List <Vector2>(); var uv2 = new List <Vector2>(); var geometry = new InputGeometry(); for (int i = 0; i < shape.edge.Length; ++i) { var pt = shape.edge[i]; geometry.AddPoint(pt.x, pt.y); verts.Add(pt.p.AsVector3(-pt.groundness * _groundPull)); uvs.Add(pt.p); uv2.Add(new Vector2(pt.groundness * pt.groundness, 0)); geometry.AddSegment(i, (i + 1) % shape.edge.Length); } for (int i = 0; i < shape.interior.Length; ++i) { var pt = shape.interior[i]; geometry.AddPoint(pt.x, pt.y); verts.Add(pt.p.AsVector3(-pt.groundness * _groundPull + UnityEngine.Random.value * 0.4f)); uvs.Add(pt.p); uv2.Add(new Vector2(pt.groundness * pt.groundness, 0)); } var behave = new TriangleNet.Behavior(); behave.Algorithm = TriangleNet.TriangulationAlgorithm.Incremental; var meshRepresentation = new TriangleNet.Mesh(behave); meshRepresentation.Triangulate(geometry); foreach (var tri in meshRepresentation.Triangles) { tris.Add(tri.GetVertex(2).ID); tris.Add(tri.GetVertex(1).ID); tris.Add(tri.GetVertex(0).ID); } mesh.vertices = verts.ToArray(); mesh.triangles = tris.ToArray(); mesh.uv = uvs.ToArray(); mesh.uv2 = uv2.ToArray(); mesh.RecalculateNormals(); mesh.RecalculateBounds(); return(mesh); }
/// <summary> /// Initializes a new instance of the <see cref="Mesh" /> class. /// </summary> public Mesh(Behavior behavior) { this.behavior = behavior; logger = SimpleLog.Instance; behavior = new Behavior(); vertices = new Dictionary<int, Vertex>(); triangles = new Dictionary<int, Triangle>(); subsegs = new Dictionary<int, Segment>(); flipstack = new Stack<Otri>(); holes = new List<Point>(); regions = new List<RegionPointer>(); quality = new Quality(this); locator = new TriangleLocator(this); Primitives.ExactInit(); if (dummytri == null) { // Initialize static dummy triangle and subseg. DummyInit(); } }
/// <summary> /// Initializes a new instance of the <see cref="Mesh" /> class. /// </summary> public Mesh(Configuration config) { Initialize(); logger = Log.Instance; behavior = new Behavior(); vertices = new Dictionary<int, Vertex>(); subsegs = new Dictionary<int, SubSegment>(); triangles = config.TrianglePool(); flipstack = new Stack<Otri>(); holes = new List<Point>(); regions = new List<RegionPointer>(); steinerleft = -1; this.predicates = config.Predicates(); this.locator = new TriangleLocator(this, predicates); }
public NewLocation(Mesh mesh) { this.mesh = mesh; this.behavior = mesh.behavior; }