vispy.geometry.torusknot module#

class vispy.geometry.torusknot.TorusKnot(p=3, q=2, num_points=100, major_radius=10.0, minor_radius=5.0)#

Bases: object

Representation of a torus knot or link.

A torus knot is one that can be drawn on the surface of a torus. It is parameterised by two integers p and q as below; in fact this returns a single knot (a single curve) only if p and q are coprime, otherwise it describes multiple linked curves.

Parameters:
pint

The number of times the knot winds around the outside of the torus. Defaults to 2.

qint

The number of times the knot passes through the hole in the centre of the torus. Defaults to 3.

num_pointsint

The number of points in the returned piecewise linear curve. If there are multiple curves (i.e. a torus link), this is the number of points in each curve. Defaults to 100.

major_radiusfloat

Distance from the center of the torus tube to the center of the torus. Defaults to 10.

minor_radiusfloat

The radius of the torus tube. Defaults to 5.

property components#

A list of the vertices in each line of the torus knot or link. Even if p and q are coprime, this is a list with just one entry.

property first_component#

The vertices of the first component line of the torus knot or link.

property major_radius#

The major radius of the torus.

property minor_radius#

The minor radius of the torus.

property num_components#

The number of component lines in the torus link. This is equal to the greatest common divisor of p and q.

property num_points#

The number of points in the vertices returned for each knot/link component

property p#

The p parameter of the torus knot or link.

property q#

The q parameter of the torus knot or link.