@@ -680,133 +680,105 @@ module debug_nurbs(control,degree,splinesteps=16,width=1, size, mult,weights,typ
680680// nurbs_curve(nurbs_interp(data, 3, start_deriv=[1,0], end_deriv=[1,0])), width=0.3);
681681// color("black") move_copies(data) circle(r=0.75, $fn=16);
682682//
683- // Example(2D,Huge,NoAxes,VPT=[55,50,0],VPR=[0,0,0],VPD=600): Controlling the start and end of an otherwise unconstrained NURBS curve using derivitives.
684- // data = [[0,0], [20,30], [30,90], [36,111],[50,25], [80,0]];
685- // xdistribute(90){
686- // union(){
687- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1);
688- // fwd(15)text("unconstrained",size=6);
689- // }
690- // union(){
691- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
692- // start_deriv=RIGHT);
693- // fwd(15)text("start=RIGHT",size=6);
694- // }
695- // union(){
696- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
697- // start_deriv=2*RIGHT,end_deriv=RIGHT);
698- // fwd(15)text("start=[2,0] end=[1,0]",size=6);
699- // }
700- // }
683+ // Example(2D,Med): An unconstrained NURBS curve.
684+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
685+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1);
701686//
702- // Example(2D,Huge,NoAxes,VPT=[45,50,0],VPR=[0,0,0],VPD=600): Controlling the shape with derivatives and corners
703- // data = [[0,0], [20,30], [30,90], [36,111],[50,25], [80,0]];
704- // xdistribute(110){
705- // back(20) union(){
706- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
707- // deriv=[2*RIGHT,[0,1],undef,undef,undef,RIGHT]
708- // );
709- // fwd(15)text("derivs at 0, 1, 5",size=6);
710- // }
711- // union(){
712- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
713- // deriv=[undef,[0,1],undef,undef,RIGHT,undef]
714- // );
715- // fwd(15)text("derivs at pts 1, 4",size=6);
716- // }
717- // fwd(20) union(){
718- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
719- // deriv=[undef,[0,1],undef,undef,NAN,undef]
720- // );
721- // fwd(15)text("corner and pt 1 deriv",size=6);
722- // }
723- // }
687+ // Example(2D,Med): Controlling the start using derivitives. Note the effect of the starting derivative on the end of the curve.
688+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
689+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
690+ // start_deriv=RIGHT);
724691//
725- // Example(2D,Huge,NoAxes,VPT=[70,50,0],VPR=[0,0,0],VPD=725): Specifying the curvature at select points. In the middle example shows continuous curvature joins to arcs at each end.
726- // data = [[0,0], [20,30], [30,90], [36,111],[50,25], [80,0]];
727- // xdistribute(110){
728- // back(30) union(){
729- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
730- // start_deriv=RIGHT,end_deriv=RIGHT, start_curvature=0,end_curvature=0
731- // );
732- // fwd(15)text("ends curvature=0",size=6);
733- // }
734- // union(){
735- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
736- // start_deriv=RIGHT,end_deriv=RIGHT, start_curvature=1/10*unit([1000,1]),end_curvature=1/5
737- // );
738- // color("lime") {
739- // stroke(arc(angle=[180,270], cp=[0,10],r=10));
740- // stroke(arc(angle=[270,360], cp=last(data)+[0,5], r=5,$fn=32));
741- // }
742- // fwd(15)text("ends curvature>0",size=6);
743- // }
744- // fwd(30) union(){
745- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1,
746- // deriv=[undef,[0,1],undef,[1,0],undef,undef],
747- // curvature=[undef,-1/10,undef,0,undef,undef]
748- // );
749- // fwd(15)text("curvature at points 1 and 3",size=6);
750- // }
751- // }
692+ // Example(2D,Med): Increasing the start derivative and adding an end derivitive.
693+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
694+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
695+ // start_deriv=2*RIGHT,end_deriv=RIGHT);
752696//
753- // Example(2D,Huge,NoAxes,VPT=[45,50,0],VPR=[0,0,0],VPD=700): Closed NURBS curves
754- // data = [[0,0], [20,30], [30,90], [36,111],[50,25], [80,0]];
755- // xdistribute(120){
756- // union(){
757- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1, closed = true
758- // );
759- // fwd(22)text("unconstrained",size=6);
760- // }
761- // union(){
762- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1, closed = true,
763- // deriv=[[0,1]/4, undef, undef, undef, undef, [0,-1]/3]
764- // );
765- // fwd(15)text("deriv at pts 0 and 5",size=6);
766- // }
767- // union(){
768- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1, closed = true,
769- // deriv=[undef,undef,undef,[1,0],undef,undef]
770- // );
771- // fwd(15)text("deriv at point 4",size=6);
772- // }
773- // }
697+ // Example(2D,Med): Adding an additional derivitive at data point 1.
698+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
699+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
700+ // deriv=[2*RIGHT,[0,1],undef,undef,undef,RIGHT]);
774701//
775- // Example(2D,Huge,NoAxes,VPT=[45,50,0],VPR=[0,0,0],VPD=500): Closed NURBS curves with corners
776- // data = [[0,0], [20,30], [30,90], [36,111],[50,25], [80,0]];
777- // xdistribute(120){
778- // union(){
779- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1, closed = true,
780- // deriv=[undef,[0,1],undef,undef,NAN,undef]
781- // );
782- // fwd(20)text("pt 1 deriv and pt 4 corner",size=6);
783- // }
784- // union(){
785- // debug_nurbs_interp(data,3, splinesteps=32, data_size=1, closed = true,
786- // deriv=[undef,NAN,undef,undef,NAN,undef]
787- // );
788- // fwd(20)text("corners at pts 1 and 4", size=6);
702+ // Example(2D,Med): Uncontrolled ends, but derivitive control of the data points adjacent to the ends.
703+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
704+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
705+ // deriv=[undef,[0,1],undef,undef,RIGHT,undef]);
706+ //
707+ // Example(2D,Med): Controlling shape with a derivative and a corner.
708+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
709+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
710+ // deriv=[undef,[0,1],undef,undef,NAN,undef]);
711+ //
712+ // Example(2D,Med): Zero curvature at the start and end.
713+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
714+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
715+ // start_deriv=RIGHT,end_deriv=RIGHT, start_curvature=0,end_curvature=0);
716+ //
717+ // Example(2D,Med): Adjusting the curvature at the end points to match the attached arcs.
718+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
719+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
720+ // start_deriv=RIGHT,end_deriv=RIGHT, start_curvature=1/10*unit([1000,1]),end_curvature=1/5
721+ // );
722+ // color("lime") {
723+ // stroke(arc(angle=[180,270], cp=[0,10],r=10));
724+ // stroke(arc(angle=[270,360], cp=last(data)+[0,5], r=5,$fn=32));
789725// }
790- // }
726+ //
727+ // Example(2D,Med): Curvature control at point 1 with derivative control at point 1 and 3.
728+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
729+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
730+ // deriv=[undef,[0,1],undef,[1,0],undef,undef],
731+ // curvature=[undef,-1/10,undef,0,undef,undef]);
732+ //
733+ // Example(2D,Med): Taming the extremes by adding extra points.
734+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
735+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1,
736+ // deriv=[undef,[0,1],undef,[1,0],undef,undef],
737+ // curvature=[undef,-1/10,undef,0,undef,undef],
738+ // extra_pts=2);
739+ //
740+ // Example(2D,Med): The same data but for an uncontrolled closed NURBS curve.
741+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
742+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1, closed = true);
743+ //
744+ // Example(2D,Med): Addng extra points to control the oscillation
745+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
746+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1, closed = true,
747+ // extra_pts = 2);
748+ //
749+ // Example(2D,Med): Small derivatives at the first and last data points also calm the curve.
750+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
751+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1, closed = true,
752+ // deriv=[[0,1]/4, undef, undef, undef, undef, [0,-1]/3]);
753+ //
754+ // Example(2D,Med): A closed NURBS curve with a derivative at pt 1, and a corner at pt 4.
755+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
756+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1, closed = true,
757+ // deriv=[undef,[0,1],undef,undef,NAN,undef]);
758+ //
759+ // Example(2D,Med): The same closed curve with corners at points 1 and 4.
760+ // data = [[0,0], [20,30], [30,90], [36,111], [50,25], [80,0]];
761+ // debug_nurbs_interp(data, degree=3, splinesteps=32, width=2, data_size=1, closed = true,
762+ // deriv=[undef,NAN,undef,undef,NAN,undef]);
791763//
792764// Example(2D,NoAxes): Keyhole Shape: Simply interpolating a NURBS through the data points yields disappointing results.
793765// data = [[0,0],[0,10],[-5,20],[5,30],[15,20],[10,10],[10,0],[0,0]];
794- // debug_nurbs_interp(data,3, method="centripetal");
766+ // debug_nurbs_interp(data, degree= 3, method="centripetal");
795767//
796768// Example(2D,NoAxes,VPT=[3,15,0],VPD=130): Keyhole Shape: Adding derivative constraints causes unwanted oscillation.
797769// data = [[0,0],[0,10],[-5,20],[5,30],[15,20],[10,10],[10,0],[0,0]];
798- // debug_nurbs_interp(data,3, method="centripetal",
770+ // debug_nurbs_interp(data, degree= 3, method="centripetal",
799771// deriv=[undef,NAN,UP,RIGHT*1.3,DOWN,NAN,NAN,undef]);
800772//
801773// Example(2D,NoAxes): Keyhole Shape: Adding extra points calms oscillations.
802774// data = [[0,0],[0,10],[-5,20],[5,30],[15,20],[10,10],[10,0],[0,0]];
803- // debug_nurbs_interp(data,3, method="centripetal",
775+ // debug_nurbs_interp(data, degree= 3, method="centripetal",
804776// deriv=[undef,NAN,UP,RIGHT*1.3,DOWN,NAN,NAN,undef],
805777// extra_pts = 1, smooth = 3);
806778//
807779// Example(2D,NoAxes): Keyhole Shape: Constrained curvature at point 3 improves the shape.
808780// data = [[0,0],[0,10],[-5,20],[5,30],[15,20],[10,10],[10,0],[0,0]];
809- // debug_nurbs_interp(data,3, method="centripetal",
781+ // debug_nurbs_interp(data, degree= 3, method="centripetal",
810782// deriv=[undef,NAN,UP,RIGHT*1.3,DOWN,NAN,NAN,undef],
811783// curvature=[undef,undef,undef,-.1,undef,undef,undef,undef],
812784// extra_pts = 1, smooth = 3);
0 commit comments