Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

mesh.capsule

A capsule with its axis along Y, centred on the origin: a cylinder whose two ends are hemispheres, with smooth normals throughout. Use it for pills, limbs and rounded posts.

It is a lattice of 32 segments round and 34 rows from pole to pole; the straight band sits between the two middle rows, and the triangles that close to a point at each pole are dropped. uv runs 0 to 1 round the axis and from pole to pole.

Inputs

  • radius (Float, default 0.5, at least 0). The radius of its round cross-section and end caps, in metres.
  • height (Float, default 1, at least 0). Its whole length along Y, caps included, in metres. Below twice the radius the capsule is a sphere of radius.

Outputs

  • geometry (Geometry). Triangles with P, N and uv on their points; primitives carry vstart and vcount.
local pill = g.mesh.capsule({ radius = 0.25, height = 1.5 })