pygfx.geometries.torus_knot_geometry

pygfx.geometries.torus_knot_geometry(scale=1.0, tube=0.4, tubular_segments=64, radial_segments=8, p=2, q=3, stitch=False)

Generate a torus knot.

Create geometry representing a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q. If p and q are not coprime, the result will be a torus link.

Parameters:
  • scale (float) – The scale of the torus, default 1.

  • tube (float) – The radius of the tube. Default 0.4.

  • tubular_segments (int) – default is 64.

  • radial_segments (int) – default is 8.

  • p (int) – How many times the geometry winds around its axis of rotational symmetry. Default 2.

  • q (int) – How many times the geometry winds around a circle in the interior of the torus. Default 3.

  • stitch (bool) – Whether to stitch the ends together to produce a closed manifold. Default False. If False, the mesh is basically a curved surface with the edges meeting to make it visually closed, which works better for texturing. Set to True for a mathematically closed object.

Returns:

torus – A geometry object representing the requested torus. Mathematically, it is an open orientable manifold, which can be closed with the stitch parameter.

Return type:

Geometry

Examples

Torus knot

Torus knot

Mesh dynamic

Mesh dynamic

Flat Shading

Flat Shading

Wireframe 1

Wireframe 1

Wireframe 2

Wireframe 2

Instancing

Instancing

Mesh Slice Material

Mesh Slice Material

Colormap Channels

Colormap Channels

Mesh Picking

Mesh Picking

Dynamic Environment Map

Dynamic Environment Map

Depth Material

Depth Material

Culling

Culling

Light Effects

Light Effects