Saturday, December 1, 2012

Torus Knot Maker

Overview

This post provides documentation for the Rhino 5 Python plug-in I wrote called the Torus Knot Maker.

A Torus Knot is a curve which lies on the surface of a torus (think donut shape). This plug-in generates them by sweeping a section curve along a path (a one rail sweep in Rhino). These are a few examples of the knots you can create:

The User Interface

The plug-in has a small dialog of controls and an interactive preview. The controls are documented below. 

Online Help: Clicking this control launches your default browser to this help page!

Path Curve Options
The two main parameters which define the path curve are conventionally called P and Q. See Torus Knot Wiki for more technical information.

  • P: The number of times the knot winds around the axis of rotational symmetry. 
  • Q: The number of times the knot winds around the interior of the torus. 
  • Number of Points: The number of control points in the path curve. 
  • Z Scale Factor: Use this number to increase the vertical height of the knot relative to its width. As fewer points are used in the path the knot can become "squashed down". This allows you to restore its height vertically. 


Note: P and Q need to be "relatively prime" otherwise the knot is simply a loop. Two numbers are relatively prime if they have no common factors other than 1 (in other words you cannot evenly divide both by some common value). Example: 2 and 3 are relatively prime (no common factor), but 2 and 4 are not relatively prime because you can divide both by 2 (2 is a common factor). As you change the values in the UI you'll quickly see when the values are not relatively prime because the shape is no longer twisting as if wrapping a torus.


Section Curve Options
These options affect the curve that is swept along the path.

  • Smooth: If checked the section curve is smoothed (a degree 3 curve). Otherwise it is a polyline (degree 1). With this unchecked the knot will have crisp edges. 
  • Radius: Controls the size of the section. Higher values make "thicker" knots. 
  • Rotation: This allows you to rotate the section about its center point. This is most noticeable when Smooth is off. 
  • Number of Points: The number of points in the section. 3 produces a triangular section, 4 a square, etc. The effect of this setting is less noticeable when Smooth is on. 

Output Options
These options control what is created after you press OK.

  • Path Curve: If checked the path curve is created (degree 3 NURBS); otherwise it is not. 
  • Section Curve: If checked the section curve is output (degree 1 or 3 NURBS); otherwise it is not. 
  • Surface: If checked a surface (polysurface) is created; otherwise it is knot (hardy, har, har...)

Notes:


  • The interactive preview does not appear in a Rendered viewport. Therefore you must use one of the other display modes when using the plug-in. 
  • See the post Torus Knot Table - Design and Fabrication for details on actually making one of these knots from wood. 



No comments:

Post a Comment