samples.frames
A smoothed tangent line field, the principal curvatures and the anisotropy at each sample, from the mesh the samples were scattered on.
Usage
Samples.frames(samples: Geometry, geometry: Mesh | Geometry | NurbsSurface, options?: SampleFramesOptions): Result<Geometry>Parameters
samplesGeometryPoints geometry from Samples.scatter: its N, anchorCorners, anchorCornersFrom and anchorBary are read.
geometryMesh | Geometry | NurbsSurfaceThe mesh or NURBS surface the samples were scattered on: on a mesh the anchors’ corner ids must name its points (rebind samples onto a re-cooked mesh first); on a surface each sample is read at its anchorUv, exactly, and smoothing is not used.
options.source"curvature" | "param" | "uv"curvature: the κ1 direction, weighted by min(1, (κ1 − κ2)² / (κ1² + κ2²)) so umbilic and flat parts fill from smoothing; uv: the direction of increasing u; param: NURBS ∂u. Default
"curvature". One ofcurvature,param,uv.options.symmetry1 | 22: a line field, whose sign is arbitrary (fixed by a world axis); 1: a signed vector field, with source uv only. Default
2. One of1,2.options.smoothingnumber0 follows the guidance; towards 1 the field is smoothed over the mesh (64 Jacobi sweeps over point neighbours). Default
0.5. Range [0, 1] normalised.options.anisotropyFloornumberaniso below it is written as 0, so near-isotropic marks are round. Default
0.05. Range [0, 1] normalised.
Returns
Ok with the samples and four more point attributes: T (Float64 ×3, a unit tangent at the sample’s N), k1 and k2 (Float64, k1 ≥ k2, positive where the surface curves away from N), and aniso (Float64 in [0, 1], the field’s strength: 1 where it follows a clear direction, falling to 0 near singularities, umbilics and flat parts).
Errors
Guarantees
- every other attribute of the samples is unchanged, and T, k1, k2 and aniso replace earlier ones
- T is unit and tangent to the sample’s N; for a line field T · e1 ≥ 0 for a fixed basis vector e1 of that plane
- on a closed manifold part the singularities’ indices (½ each for a line field) sum to its Euler characteristic
- scaling the mesh and the samples by a power of two leaves T and aniso the same bits and divides k1 and k2 by it
- the same input gives the same bytes (geometryContentHash), natively and in WASM
- The same result on every machine.
Example
const s = Samples.scatter(Mesh.box().value, { scope: 'scatter1', spacing: 0.1 })
s.ok && Samples.frames(s.value, Mesh.box().value).ok // → T, k1, k2 and aniso on each sample once loadGeometryKernel() has run