Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

points.pose (procNode)

Compose the instance attributes of points into one pose: P, orient and scale. The order is pivot, then scale (scale times pscale), then orientation (orient, else the alignment of N, else of v, with +Z along the direction and +Y toward up), then rot after it, then translation (trans plus P). An attribute a point lacks is identity: no pivot, scale 1, unrotated, no extra translation. Reads P, orient, scale, N, v, up, pscale, rot, trans and pivot. Use it before prefab.from_instances, an instancer or anything else that reads only P, orient and scale.

What each attribute reads as, and what a missing one reads as:

AttributeTypeMissing reads asRole
PVec3(required)where the pivot lands, before trans
orientVec4 quaternion (x, y, z, w)see belowthe base orientation; wins over N and v
NVec3see belowturns +Z onto it when the points carry no orient
vVec3see belowturns +Z onto it when the points carry neither orient nor N
upVec3(0, 1, 0)where +Y leans while N or v aims +Z
rotVec4 quaternion(0, 0, 0, 1)a further turn applied after the base orientation
scaleVec3(1, 1, 1)per-axis size
pscaleFloat1uniform size, multiplied into scale
transVec3(0, 0, 0)added to P
pivotVec3(0, 0, 0)the point of the source, in its own space, that lands on P + trans

The base orientation is orient when the points carry it, else the alignment of N when they carry it, else the alignment of v, else identity; which one applies is decided once for the whole set, by which attributes the points carry. A zero-length N or v aligns to identity. The composed result is:

  • orient = rot applied after the base orientation;
  • scale = scale * pscale;
  • P = P + trans - orient(scale * pivot).

Built from: g.has, g.where, instances.turn, vector.* over sockets.

Inputs

  • points (Points). Points carrying any of the instance attributes. orient and rot are quaternions (x, y, z, w); scale, trans, pivot, N, v and up are vectors; pscale is a number.
  • keep (String, default "none"; "none" or "all"). What happens to the instance attributes once composed. "none" removes pscale, rot, trans, pivot, up, N and v from the result; "all" keeps them, writing each one the points lacked at the value it was read as (N and v at (0, 0, 1)). P, orient and scale always hold the composed pose.

Outputs

  • points (Points). The points with P, orient and scale holding the composed pose, and every other attribute they carried.
local spots = g.points.grid({ countX = 3, countZ = 1 })
spots.point.N = g.math.vec3(1, 0, 0)
spots.point.pscale = 2
local posed = g.points.pose({ points = spots })