Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

group.by_normal

Group the elements whose normal is within angle degrees of direction, the limit included: the top faces, the ones facing a camera, the overhangs. A primitive is read by its own facet winding, a point by the geometry's normals (its N, else normals computed from its faces), a vertex by the normal of its point, an edge by the mean of the faces bordering it; wire a normal field to read any other orientation.

Inputs

  • geometry (Geometry). The geometry the group is made on. A copy carrying the group comes out.
  • normal (Field<Vec3>, optional). The normal each element is judged by. Left unwired, the class's own normals are used.
  • name (String, default ""). The name the group is written under.
  • class (String, default "point", one of "edge", "point", "primitive", "vertex"). The element class the group lives on.
  • direction (Vec3, default (0, 1, 0)). The direction elements have to face. Only where it points matters, not how long it is; a zero-length direction is refused.
  • angle (Float, default 30, 0 to 180). How far from direction, in degrees, an element's normal may point and still join, the limit included. An element with no orientation joins at no angle.
  • invert (Bool, default false). true takes the complement: every element of the class outside the cone.

Outputs

  • geometry (Geometry). The input carrying the group name on class.
local tops = g.group.by_normal({ geometry = g.mesh.box({}), name = "top", class = "primitive", direction = vector.create(0, 1, 0), angle = 10 })