-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hey there. I am generating a random shape through the following process:
- Choose n points around a circle with random radius r from (minR, maxR)
- Create a spline connecting those points
- Create a polygon by sampling that spline at m points around the circle.
I'm then passing that shape into tessellation with maxEdge being 0.5, though I've seen similar results at 1.0.
I get relatively inconsistent results. Sometimes, it tessellates beautifully:
Sometimes, it half is tessellated, half is fanned:
Sometimes it just gets full fan treatment:
No code has changed between these screenshots, but the random shape has obviously changed. I would expect closer to the first one for all results.
// returns Vector2[] polygon
var polygon = section.splineToPolygon();
var iGeom = IntGeom.DefGeom;
var extraPoints = new NativeArray<IntVector>(0, Allocator.Temp);
// copied from sample code
var pShape = ToPlainShape(polygon, null, iGeom, Allocator.Temp);
var delaunay = pShape.Delaunay(iGeom.Int(0.f5), extraPoints, Allocator.Temp);
delaunay.Tessellate(iGeom, 1.0f);
extraPoints.Dispose();
var triangles = delaunay.Indices(Allocator.Temp);
_triangles.AddRange(triangles);
var vertices = delaunay.Vertices(Allocator.Temp, iGeom, 0);
foreach (var vtx in vertices) {
_vertices.Add(new Vector3(vtx.x, 0f, vtx.y)-this._worldPos);
}
delaunay.Dispose();
Metadata
Metadata
Assignees
Labels
No labels




