Interface: InitialTriangulation
Defined in: delatin.ts:58
A seed triangulation for RasterReprojector, in delaunator's data
shape. All UV coordinates must lie in [0, 1]. The triangulation must be a
valid (ideally Delaunay) mesh — its triangles are NOT legalized on seeding.
The fields deliberately match delaunator's output, so building a seed from a set of UV points is a one-liner — pass the points (which must form a convex domain; delaunator triangulates the convex hull of its input):
import Delaunator from "delaunator";
const points: [number, number][] = [[0, 0], [1, 0], [0, 1], [1, 1]];
const d = Delaunator.from(points);
const seed: InitialTriangulation = {
uvs: Array.from(d.coords),
triangles: Array.from(d.triangles),
halfedges: Array.from(d.halfedges),
};
delaunator is not a dependency of this package; consumers that want this convenience add it themselves. A hand-built triangulation works too, as long as it is a valid mesh with the halfedge convention below.
Properties
halfedges
halfedges:
number[]
Defined in: delatin.ts:68
Halfedge twins: halfedges[e] is the opposite halfedge of e, or -1
if e is on the boundary. Same convention as delaunator and the
reprojector's internal _halfedges.
triangles
triangles:
number[]
Defined in: delatin.ts:62
Triangle vertex indices, 3 per triangle (indices into uvs).
uvs
uvs:
number[]
Defined in: delatin.ts:60
Flat UV vertex coordinates [u0, v0, u1, v1, ...], each in [0, 1].