Expand description
Triangulating a face.
The second half of tessellation. A face is a trimmed region of a surface, so
the triangulation is built in the surface’s (u, v) parameter space (where
the region is an ordinary polygon with holes) and then lifted back into
space by evaluating the surface at each vertex.
§Why parameter space
Triangulating in 3D would mean deciding which side of a curved boundary a point falls on, in space, which is the point-in-solid problem. In parameter space the boundary is a closed 2D polygon and the question is a winding count. The surface does the rest.
The cost is that parameter space is distorted: equal steps in (u, v) cover
very different distances near a sphere’s pole than near its equator. So the
interior points are chosen by measuring deflection in space and the
triangulation is done in parameter space: measuring where the answer
matters, connecting where it is easy.
§Watertightness
A face’s boundary points come from discretizing the edge’s 3D curve and evaluating the pcurve at those same parameters. Two faces sharing an edge therefore place their boundary vertices at identical spatial positions, and the join has no gap. Discretizing each face’s pcurve independently would give each face its own idea of where the edge runs, and the seams would show.
Structs§
- Face
Mesh Cache - Face meshes kept by what each face is, for a caller that meshes a run of models in which most faces recur unchanged, as a construction retried after a few of its faces changed does.
Functions§
- edge_
chords_ for - The chords the faces below
shapeagree to draw their shared edges to. - face_
boundary - A face’s trimming boundary, in its surface’s parameter space.
- face_
boundary_ in_ chart face_boundary, each ring keeping within the chord of its edges in the chart too, read in space through the surface’s tangent scales: a point on an edge then lies within the chord of its ring however much more the edge bends in the chart than in space.- face_
boundary_ in_ chart_ met face_boundary_in_chartwhere every edge’s polyline honours the deflection, andNonewhere one reachedDeflection::max_segmentsfirst: rings that keep within the chord are what a point can be placed against at that chord.- face_
meshes_ for - Every face below
shapein exploration order, each with whattriangulate_face_withanswers for it with the chords the faces agree on (whatedge_chords_foranswers), and those chords: the agreement and the meshes drawn in one pass. A facekepthas drawn before to the same chords is taken from it. - inside_
boundary - Whether a point in parameter space lies inside the region
ringsbound. - inside_
boundary_ with - As
inside_boundary, with the predicate implementation named. - open_
chart_ ring - One wire’s trimming ring on a face whose chart neither repeats nor
closes on itself, as
face_boundary_in_chartdraws it among the face’s other rings;Nonewhere the wire leaves no ring there. - polyline_
of_ edge - Discretize an edge into a polyline in space, for display or coarse queries.
- triangle_
normal - The unit normal of a triangle, or
Noneif it is degenerate. - triangulate
- Triangulate every face below a shape, welded into one mesh.
- triangulate_
face - Triangulate one face.
- triangulate_
face_ kept - As
triangulate_face, taking the face fromkeptwhere it drew this face at this deflection before, and keeping what it draws there. - triangulate_
face_ with - As
triangulate_face, with the edge chords the shape agreed on (the answer ofedge_chords_for), so the face’s boundary matches its neighbours’ point for point along every edge the map names. - triangulate_
with_ chords - As
triangulate, with the edge chords the faces agreed on: whatedge_chords_foranswers for the same shape and deflection, without drawing every face a second time to find it. - triangulate_
with_ face_ meshes - As
triangulate_with_chords, with every face’s own mesh beside the welded whole: each face belowshapein exploration order, and whattriangulate_face_withanswers for it with the returned chords. The whole is welded from those same meshes, so they are drawn once. A facekepthas drawn before to the same chords is taken from it.
Type Aliases§
- Edge
Chords - The chord each edge is to be drawn to, by edge node index, where a face wants its edges finer than the caller’s chord: what every face sharing an edge has to agree on, or their meshes disagree along it.
- Face
Mesh - A face and its mesh, or why it would not draw.