Doc > Nodes > SOP > TorusKnot

Doc > Nodes > SOP > TorusKnot

Creates a Torus Knot.

Description

The Torus Knot is akin to the Torus, except that you can create more complex shapes by using the p and q paramters.

Parameters

Name Type Description
radius float large radius
radiusTube float radius of the tube
segmentsRadial integer number of segments along the length of the torus
segmentsTube integer number of segments along the tube
p integer change this to create more interesting shapes. Don't ask me what it is exactly, I don't know!
q integer change this to create more interesting shapes. Don't ask me what it is exactly, I don't know!
center vector3 center of the torus knot

Edit code in JsFiddle , Codepen , view in a new tab or Open in the Editor


// create a scene
const scene = new PolyScene();
const root = scene.root();

// create a torus
const geo = root.createNode('geo');
const torusKnot = geo.createNode('torusKnot');

// add a light
root.createNode('hemisphereLight');

// create a camera
const perspectiveCamera1 = root.createNode('perspectiveCamera');
perspectiveCamera1.p.t.set([5, 5, 5]);
// add orbitControls
const events1 = perspectiveCamera1.createNode('eventsNetwork');
const orbitsControls = events1.createNode('cameraOrbitControls');
perspectiveCamera1.p.controls.setNode(orbitsControls);

// mount the viewer
const element = document.getElementById('app');
perspectiveCamera1.createViewer(element);