Creating A Torus Knot

Torus Knot

A torus knot is a continuous shape that twists and turns around the surface of a torus. The number of twists and turns are determined by two windings integers p and q. The simplest knotted knot is with 2 and 3 for p and q. The origin of the created torus knot is at the center of the underlying torus.

MeshBuilder

Example :

const torus = BABYLON.MeshBuilder.CreateTorusKnot("torusKnot", options, scene);
optionvaluedefault value
option
radius
value
(number) radius of the torus knot
default value
2
option
tube
value
(number) thickness of its tube
default value
0.5
option
radialSegments
value
(number) number of radial segments
default value
32
option
tubularSegments
value
(number) number of tubular segments
default value
32
option
p
value
(number) number of windings
default value
2
option
q
value
(number) number of windings
default value
3
option
updatable
value
(boolean) true if the mesh is updatable
default value
false
option
sideOrientation
value
(number) side orientation
default value
DEFAULTSIDE
option
frontUVs
value
(Vector4) ONLY WHEN sideOrientation:BABYLON.Mesh.DOUBLESIDE set
default value
Vector4(0,0, 1,1)
option
backUVs
value
(Vector4) ONLY WHEN sideOrientation:BABYLON.Mesh.DOUBLESIDE set
default value
Vector4(0,0, 1,1)

Examples

Simplest: Create a Simple Torus Knot Low p and q: Create a Torus Knot With Low P And Q High p and q: Create a Torus Knot With High P And Q Breaking the rules - using high non integer P and q: Create a Torus Knot With High non integer P And Q

Mesh

const knot = BABYLON.Mesh.CreateTorusKnot("knot", radius, tube, radialSegments, tubularSegments, p, q, scene);
const knot = BABYLON.Mesh.CreateTorusKnot("knot", radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation); //optional parameters after scene