Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

search_curve

Places samples on curves by arc length. Each sample names a curve (owner, Int) and how far along it (at, Float, 0 at the start to 1 at the end); the kernel answers the segment it stands on (segment, a vec2<i32> of the vertex the segment starts at and the one it ends at), where it stands (placed: the position in xyz and how far along the segment in w, 0 at its start to 1 at its end) and the segment's unit direction (heading, xyz, zero for a segment of no length).

SpecializeOptionsMeaning
COUNTplain, deviceevery slot is live, or the live count is read from domain_count and a slot at or past it is left alone

The curves are described per vertex by vertices (vec4<f32>: the position in xyz and the arc length from the start of the first curve in w, ascending) and per curve by curves (vec4<f32>: the vertex its run starts at in x, how many vertices it holds in y, negative for a closed curve, the arc length that comes before it in z and its own length in w). A sample stands at arc length curves[owner].z + at * curves[owner].w.

A sample on the last vertex of an open curve stands on the segment before it. On a closed curve the last vertex starts the segment that closes the loop.

One thread per sample; the dispatch size n is the number of samples. Exact: every output element has one writer and reads only its inputs, so the same inputs give the same answers on every dispatch.

core.sample_curve runs it and takes the sample's position, its blend between the segment's ends and its tangent from the outputs.