// Copyright (c) 2007, author: Jens Schwaiger // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or (at // your option) any later version. // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA // 02110-1301, USA. // INSTALLATION: // Paste this file in the sub-directory $HOME/.asy // Code: import graph3; // similar to roundedpath for 3D guide3 roundedguide(guide3 A, real r=0.2){ guide3 rounded; triple before, after, indir, outdir; int len=length(A); bool guideclosed=cyclic(A); if(len<2){return A;}; if(guideclosed){rounded=point(point(A,0)--point(A,1),r);} else {rounded=point(A,0);}; for(int i=1;i0) {return unit((-p.y,p.x,0));} else {return (1,0,0);}; }; // used in constructin the array of Bishop frames triple nextnormal(triple p, triple q){ triple nw=p-(dot(p,q)*q); if(abs(nw)<0.001){return p;} else {return unit(nw);} }; // Bishop frame itself; for closed curves a modification guarantees // smoothness also at the // "closing" position of the guide3 g // tw<>0 means some additional twist (measured in radians) // for closed g twist should be a multiple of 2pi /* See http://ada.math.uga.edu/research/software/tube/tube.html */ triple[][] bframe(guide3 g, int subdiv=20, real tw=0){ triple[][] bf=new triple[subdiv+1][3]; real lg=arclength(g); for(int i=0;i