Search code examples
openscad

openscad - align a shape with a path defined by two points


I have a function:

function knotAng(a,s) =
    [(sin(a)+(2*sin(2*a)))*s,
     (cos(a)-(2*cos(2*a)))*s,
     sin(3*a)*s];

I am placing a number of objects along a path where a=0 to 359 and s is constant

I want to orient the objects so they follow the path described by knotAng(a-step,s) and knotAng(a,s)


Solution

  • The Tips&Tricks page, section 'Drawing "lines" in OpenSCAD' of the user manual shows how to rotate "lines" in 3D space by calculating the minimal rotation matrix as described in section 'Minimum rotation problem'.