Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.delete

Delete the triangles a per-primitive mask field or attribute selects: a triangle is selected when its value is strictly above threshold. Every point is kept, and the triangles that stay keep their corners and every attribute. invert deletes the triangles the test did not select instead.

The value each triangle is tested by is the mask field when it is wired, else the named primitive attribute, else 0. elements.keep on the primitives does the removal, on the device.

Built from: g.compare, elements.keep.

Inputs

  • geometry (Geometry). Whose triangles are thinned. Point and detail attributes carry over as they are; primitive and vertex attributes stay with the triangles that survive.
  • mask (Field, optional). Read once per triangle for whether it goes. Wired, it is what the selection reads, and attribute is read only when this is empty.
  • threshold (Float, default 0.5). A triangle is selected when its value is strictly above this. Raising it deletes less.
  • attribute (String, optional). A primitive attribute on the geometry to read the selection from, instead of a wired mask. A name the triangles do not carry is refused.
  • invert (Bool, default false). true deletes every triangle the test did NOT select: a mask naming what to keep cuts away the rest.

Outputs

  • geometry (Geometry). The geometry with the selected triangles removed and every point kept.
local box = g.mesh.box({})
box.primitive.band = g.element.id * 1.0
local open = g.geometry.delete({ geometry = box, attribute = "band", threshold = 9.5 })
local kept = g.geometry.delete({ geometry = box, attribute = "band", threshold = 1.5, invert = true })