var length=15;
var pan = new iPath().line(15,0).line(pan.length,0).line(0,pan.length)
.line(-pan.length,0).line(0, -pan.length)
.move(0.45*pan.length,-5).line(0.1*pan.length,0);
document.querySelector("svg g .this")
.setAttribute("d", pan.dPath(3, 0.5));
var length=150;
var gear = new iPath().turtleLine({a: Math.PI/2
, r: length,0)}.repeat(4);
var partial=0.56;
var gear = new iPath() .turtleLine({a:Math.PI/2,r:length,0}).repeat(4);
document.querySelector("svg g .gear").setAttribute("d",
gear.dPath(3, partial));
- Are problematic in SVG
- ♥ by CNC.
- Can be used in iPath to round line joints.
SVG: a rx ry x-axis-rotation large-arc-flag sweep-flag dx dy
iPath: new iPath().line(50,0).fillet(radius).line(0,50);
- are troublesome (to say the least) for CNC devices
Most CNC devices or software can not handle (well)
- are translated to linesegments by iPath
var weight=0.7;
wave = new iPath().bezier(450,0,-100, -350,300,-350)
.smooth(weight, 0,350,350,350);
words.e= new iPath().bezier(10, 0, 30, 5, 30, -30)
.smooth(0.15, -10, -35, -20, 20).smooth(0.6, 0, 35, 20, 20);
words.h= new iPath().bezier(6, -10, 23, 0, 32, -50).smooth(2.5, -10, -41, -12, 70)
.smooth(-0.6, 27, -45, 22, -10).smooth(0.65,3,4,3,1);
- Lots of forms and figures are symmetric
- Waist of time to code out symmetric parts
- Pen continuation is king so reflection is mirroring and reversing
- Default reflection line is from current pen position to origin
var mirror = new iPath().line(50,50).fillet(2).line(-100,100)...;
document.querySelector("svg g .mirror").setAttribute("d"
, mirror.reflect().dPath(3, partial));
var mirror = new iPath().line(50,50).fillet(2).line(-100,100)...;
document.querySelector("svg g .mirror").setAttribute("d"
, mirror.reflect({x:0,y:1}).dPath(3, partial));
- Transfer
- Rotation
- Skewing
var heart = new iPath().bezier(-20, -20, -5, -40, 0,-20).mirror()
var rotation, dx, skew = 0;
document.querySelector("svg g .transform").setAttribute("d"
, heart.rotate(Math.PI * rotation).skew(sew).dPath({x:dx,y:0}), 3);
var overcut = new iPath().line(-10,0).overcut(bitradius).line(0,-20).overcut(bitradius).line(10,-20).overcut(bitradius).line(10,20)..overcut(bitradius).line(0,20).overcut(bitradius).line(-10,0);
document.querySelector("svg g .overcut2").setAttribute("d"
, heart.rotate(Math.PI * rotation).skew(sew).dPath({x:dx,y:0}), 3);
- Is better readable
- has cartesian and polar coordinate system
- Is waaaay more flexible with variables and expression
- Is extensible with third party made add ons