Overview
These Macros were created by David Sharp based upon Aaron K. Trautwein's concepts for the Fourier "harmonic" parameterizations of knots. David has given his permission for them to be released under the terms of the CC-LGPL to enable you to use, modify and redistribute them for both commercial and non-commercial purposes. You can help improve the macros by submitting enhanced versions back into the collection by registering yourself on the web site. This download consists of:
- include files containing the Harmonic Knots macros and some utility macros
- an include file containing the sets of Harmonic Knot parameters
- a sample scene file to illustrate the use of the include file
- a copy of this documentation and the image files used in it
- a few other files that you may find handy if you submit a new version to the collection
You can add a Knot to your scene file by including the "hknots.inc" file, declaring the 'HKnots_H_Array'
and running the 'HKnots' macro with one of the ribbon styles specified as a parameter on the macro call.
light_source { <200, 100, -1200> rgb 1}
camera {location <0, 0, -400> look_at <0,0,0>}
#include "hknots.inc"
#declare HKnots_H_Array = HKnots_Granny_knot_array
HKnots("Tracks")
This example returns a single object centred at the origin about 200 POV-Ray units high and about 400 wide. Some of the parameter sets generate knots that are up to 3 times larger than this.
You can wrap the macro call in an object statement and transform it as required to fit into your scene. For example:
light_source { <200, 100, -1200> rgb 1}
camera {location <0, 0, -400> look_at <0,0,0>}
#include "hknots.inc"
#declare HKnots_H_Array = HKnots_seven_1_array
object {
HKnots("TriangleRibs")
scale 0.5
rotate <0,30,0>
translate <35,0,20>
}
Return to Table of Contents
Available Configuration Options
Ribbon Styles
The following ribbon styles can be specified as a parameter on the 'HKnots' macro call:
 "STriangles2" |
 "KTriangles" |
 "CylRibs" |
 "CylArray" |
 "STriangles" |
 "Tracks" |
 "TriangleRibs" |
Predefined Coefficient Settings
The following images illustrate the predefined coefficient settings that are available and that can be assigned directly to the 'HKnots_H_Array' identifier. Click on an image to see a larger version.
 HKnots_three_1_array Scale 0.75; |
 HKnots_four_1_array Scale 0.5; |
 HKnots_five_1_array Scale 0.35; |
 HKnots_five_2_array Scale 0.45; |
 HKnots_six_1_array Scale 0.5; |
 HKnots_six_2_array Scale 0.5; |
 HKnots_six_3_array Scale 0.5; |
 HKnots_Square_knot_array Scale 1; |
 HKnots_Granny_knot_array Scale 1; |
 HKnots_seven_1_array Scale 0.5; |
 HKnots_seven_2_array Scale 0.45; |
 HKnots_seven_3_array Scale 0.45; |
 HKnots_seven_4_array Scale 0.75; |
 HKnots_seven_5_array Scale 0.75; |
 HKnots_seven_6_array Scale 0.45; |
 HKnots_seven_7_array Scale 0.55; |
Alternatively you can assign parameters of your own directly to the 'HKnots_H_Array' identifier.
Variable Settings
There are a couple of variables that you can set to control the construction of the shape:
| HKnots_R0 | can be used to set the size of the tube, ribbon (or whatever the shape is constructed using) | Defaults to 15 |
| HKnots_Total_Segs | can be used to set the 'resolution' of the parameterization. | Defaults to 200 |
#declare HKnots_R0=35;
#declare HKnots_Total_Segs= 900;
hknots_arrays.inc
The file 'hknots_arrays.inc' contains declarations for the arrays that parameterize Aaron K. Trautwein's formulation of the Fourier 'Harmonic' knots series for prime knots up through 7 (minimal) crossings:
- 3_1, 4_1, 5_1, 5_2, 6_1, 6_2, 6_3,
- 7_1, 7_2, 7_3, 7_4, 7_5, 7_6, 7_7,
and
The parameterization of each curve (knot) is a Fourier series:
x(t)=a_1x*cos(t)+b1_x*sin(t) + a_2x*cos(2t)+b2_x*sin(2t)
+... +a_nx*cos(nt)+bn_x*sin(nt)
y(t)=a_1y*cos(t)+b1_y*sin(t) + a_2y*cos(2t)+b2_y*sin(2t)
+... +a_ny*cos(nt) + bn_y*sin(nt)
z(t)=a_1z*cos(t)+b1_z*sin(t) + a_2z*cos(2t)+b2_z*sin(2t)
+... +a_nz*cos(nt) + bn_z*sin(nt)
The arrays in this file hold the Fourier coeffiecients
a_1x, b_1x, a_2x, b_2x, ..., a_15x, b_15x,
a_1y, b_1y, a_2y, b_2y, ..., a_15y, b_15y,
a_1z, b_1z, a_2z, b_2z, ..., a_15z, b_15z
as in:
#declare HKnots_knot_array=array[3][15][2]{
{{a_1x,b_1x} {a_2x,b_2x} {a_3x,b_3x} ... {a_15x,b_15x}},
{{a_1y,b_1y} {a_2y,b_2y} {a_3y,b_3y} ... {a_15y,b_15y}},
{{a_1z,b_1z} {a_2z,b_2z} {a_3z,b_3z} ... {a_15z,b_15z}},
}
Setting your own coefficients
You can use the #declares in the 'hknots_arrays.inc' file to define the knot parameterization, or you can use your own 3D array ([3][15][2]) of Fourier coefficients. Reference: http://www.math.uiowa.edu/~jsimon/aaron.html.
Setting up an array of coefficients for the 'harmonic' Fourier series.
array[3][15][2]
'3' for the three components x,y,z
'15' for terms up to the 15th order, and
'2' for the cosine and sine coefficients
for example, the trefoil HKnots_knot (3_1) is parametrized by:
x(m) = 41*cos(m) - 18*sin(m) - 83*cos(2*m) - 83*sin(2*m)
- 11*cos(3*m) + 27*sin(3*m),
y(m) = 36*cos(m) + 27*sin(m) - 113*cos(2*m) + 30*sin(2*m)
+ 11*cos(3*m) - 27*sin(3*m),
z(m) = 0*cos(m) + 45*sin(m) - 30*cos(2*m) + 113*sin(2*m)
- 11*cos(3*m) + 27*sin(3*m)
The array for this would look like:
#declare HKnots_three_1_array=array[3][15][2]{
// The Fourier series coefficients of:
// cos(m) sin(m) cos(2m) sin(2m) cos(3m) sin(3m) ...
/* x */{ { 41, -18 } {-83, -83 } {-11, 27 }
{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}},
/* y */{ { 36, 27 } {-113, 30 } { 11, -27 }
{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}},
/* z */{ { 0, 45 } {-30, 113 } {-11, 27 }
{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}{0,0}}
}
Return to Table of Contents
Change History
The Harmonic Knots macros were created by David Sharp. He made them available for download from Geocities until the web server service closed in October 2009, at which point he kindly gave his permission for them to be redistributed on the POV-Ray Object Collection license (CC-LGPL).
Version 1.0 of the include file was adapted to conform to the naming conventions for the POV-Ray Object Collection by Chris Bartlett in October 2009. All identifiers are now prefixed with 'HKnots_' and all file names start with 'hknots'. The following additional changes were made:
- The main macros were split out into an include file and the arrays moved to another file.
- A separate scene file was added to illustrate the use of the model and a second scene file to generate the images in this document.
- The HKnots macro was added to make it easier to select the desired Ribbon style.
Return to Table of Contents