sectorFold

Fold a point into one mirrored wedge around a centre: the kaleidoscope fold.

sectorFold(x: Expr, y: Expr, sectorAngle: Expr, center: number = 0.5): Expr

Import frames from shaders/std and use frames.sectorFold.

sectorAngle is the wedge's angle in radians (2π divided by the number of facets). center is where the wedges meet, 0.5 by default. Returns the folded point as an offset from the centre. Sample anything at that point and it repeats and mirrors around the centre.

Parameters

NameTypeNotes
xExpr
yExpr
sectorAngleExpr
centernumberOptional. Default 0.5.

Example

const folded = sectorFold(uv.member('x'), uv.member('y'), math.div(2 * Math.PI, params.uniforms.facets))

See also

  • directionFrame — The two axes of a direction given in degrees, for patterns that run along it.
  • centredFrame — A frame centred on a position prop: each pixel's offset from the centre and its distance.

Used by

Crystal