2020-06-25 05:33:41 +00:00
|
|
|
include <BOSL2/std.scad>
|
|
|
|
|
|
|
|
|
|
|
|
module test_turtle() {
|
|
|
|
assert_approx(
|
|
|
|
turtle([
|
|
|
|
"move", 10,
|
|
|
|
"ymove", 5,
|
|
|
|
"xmove", 5,
|
|
|
|
"xymove", [10,15],
|
|
|
|
"left", 135,
|
|
|
|
"untilx", 0,
|
|
|
|
"turn", 90,
|
|
|
|
"untily", 0,
|
|
|
|
"right", 135,
|
|
|
|
"arcsteps", 5,
|
|
|
|
"arcright", 15, 30,
|
|
|
|
"arcleft", 15, 30,
|
|
|
|
"arcsteps", 0,
|
|
|
|
"arcrightto", 15, 90,
|
|
|
|
"arcleftto", 15, 180,
|
|
|
|
"jump", [10,10],
|
|
|
|
"xjump", 15,
|
|
|
|
"yjump", 15,
|
|
|
|
"angle", 30,
|
|
|
|
"length", 15,
|
|
|
|
"right",
|
|
|
|
"move",
|
|
|
|
"scale", 2,
|
|
|
|
"left",
|
|
|
|
"move",
|
|
|
|
"addlength", 5,
|
|
|
|
"repeat", 3, ["move"],
|
|
|
|
], $fn=24),
|
|
|
|
[[0,0],[10,0],[10,5],[15,5],[25,20],[-3.5527136788e-15,45],[-45,0],[-44.8716729206,1.9578928833],[-44.4888873943,3.88228567654],[-43.8581929877,5.74025148548],[-42.9903810568,7.5],[-42.1225691259,9.25974851452],[-41.4918747192,11.1177143235],[-41.1090891929,13.0421071167],[-40.9807621135,15],[-41.0157305757,16.0236362005],[-41.120472923,17.0424997364],[-41.2945007983,18.0518401958],[-41.5370028033,19.0469515674],[-41.8468482818,20.0231941826],[-42.222592591,20.9760163477],[-42.6624838375,21.900975566],[-43.1644710453,22.7937592505],[-43.7262137184,23.6502048317],[-44.345092753,24.4663191649],[-45.0182226494,25.2382971483],[-45.7424649653,25.9625394642],[-46.5144429486,26.6356693606],[-47.3305572818,27.2545483952],[-48.187002863,27.8162910682],[-49.0797865476,28.318278276],[-50.0047457658,28.7581695226],[-50.957567931,29.1339138318],[-51.9338105462,29.4437593102],[-52.9289219177,29.6862613152],[-53.9382623771,29.8602891905],[-54.9571259131,29.9650315379],[-55.9807621135,30],[10,10],[15,10],[15,15],[2.00961894323,22.5],[-27.9903810568,22.5],[-62.9903810568,22.5],[-97.9903810568,22.5],[-132.990381057,22.5]]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
test_turtle();
|
|
|
|
|
|
|
|
|
|
|
|
module test_arc() {
|
|
|
|
assert_approx(arc(N=8, d=100, angle=135, cp=[10,10]), [[60,10],[57.1941665154,26.5139530978],[49.0915741234,41.1744900929],[36.6016038258,52.3362099614],[21.1260466978,58.7463956091],[4.40177619483,59.6856104947],[-11.6941869559,55.0484433951],[-25.3553390593,45.3553390593]]);
|
|
|
|
assert_approx(arc(N=8, d=100, angle=[45,225], cp=[10,10]), [[45.3553390593,45.3553390593],[26.5139530978,57.1941665154],[4.40177619483,59.6856104947],[-16.6016038258,52.3362099614],[-32.3362099614,36.6016038258],[-39.6856104947,15.5982238052],[-37.1941665154,-6.51395309776],[-25.3553390593,-25.3553390593]]);
|
|
|
|
assert_approx(arc(N=8, d=100, start=45, angle=135, cp=[10,10]), [[45.3553390593,45.3553390593],[31.6941869559,55.0484433951],[15.5982238052,59.6856104947],[-1.12604669782,58.7463956091],[-16.6016038258,52.3362099614],[-29.0915741234,41.1744900929],[-37.1941665154,26.5139530978],[-40,10]]);
|
|
|
|
assert_approx(arc(N=8, d=100, start=45, angle=-90, cp=[10,10]), [[45.3553390593,45.3553390593],[52.3362099614,36.6016038258],[57.1941665154,26.5139530978],[59.6856104947,15.5982238052],[59.6856104947,4.40177619483],[57.1941665154,-6.51395309776],[52.3362099614,-16.6016038258],[45.3553390593,-25.3553390593]]);
|
|
|
|
assert_approx(arc(N=8, width=100, thickness=30), [[50,-3.5527136788e-15],[39.5300788555,13.9348601124],[25.3202618476,24.0284558904],[8.71492362453,29.3258437015],[-8.71492362453,29.3258437015],[-25.3202618476,24.0284558904],[-39.5300788555,13.9348601124],[-50,-1.42108547152e-14]]);
|
|
|
|
assert_approx(arc(N=8, cp=[10,10], points=[[45,45],[-25,45]]), [[45,45],[36.3342442379,51.9107096148],[26.3479795075,56.7198412457],[15.5419588213,59.1862449514],[4.45804117867,59.1862449514],[-6.34797950747,56.7198412457],[-16.3342442379,51.9107096148],[-25,45]]);
|
|
|
|
assert_approx(arc(N=24, cp=[10,10], points=[[45,45],[-25,45]], long=true), [[45,45],[51.3889035257,37.146982612],[56.0464336973,28.1583574081],[58.7777575294,18.4101349813],[59.4686187624,8.31010126292],[58.0901174104,-1.71924090789],[54.6999187001,-11.2583458482],[49.4398408296,-19.9081753929],[42.5299224539,-27.3068913894],[34.2592180667,-33.1449920477],[24.9737063235,-37.1782589647],[15.0618171232,-39.2379732261],[4.93818287676,-39.2379732261],[-4.97370632349,-37.1782589647],[-14.2592180667,-33.1449920477],[-22.5299224539,-27.3068913894],[-29.4398408296,-19.9081753929],[-34.6999187001,-11.2583458482],[-38.0901174104,-1.71924090789],[-39.4686187624,8.31010126292],[-38.7777575294,18.4101349813],[-36.0464336973,28.1583574081],[-31.3889035257,37.146982612],[-25,45]]);
|
|
|
|
assert_approx(arc($fn=24, cp=[10,10], points=[[45,45],[-25,45]], long=true), [[45,45],[53.2421021636,34.0856928585],[58.1827254512,21.3324740498],[59.4446596304,7.71403542491],[56.9315576496,-5.72987274525],[50.8352916125,-17.9728253654],[41.6213035891,-28.0800887515],[29.9930697126,-35.2799863457],[16.8383906815,-39.0228152281],[3.16160931847,-39.0228152281],[-9.9930697126,-35.2799863457],[-21.6213035891,-28.0800887515],[-30.8352916125,-17.9728253654],[-36.9315576496,-5.72987274525],[-39.4446596304,7.71403542491],[-38.1827254512,21.3324740498],[-33.2421021636,34.0856928585],[-25,45]]);
|
|
|
|
}
|
|
|
|
test_arc();
|
|
|
|
|
|
|
|
|
|
|
|
module test_rect() {
|
|
|
|
assert_equal(rect(100,anchor=CENTER), [[50,-50],[-50,-50],[-50,50],[50,50]]);
|
|
|
|
assert_equal(rect(100), [[100,0],[0,0],[0,100],[100,100]]);
|
|
|
|
assert_equal(rect([100,80]), [[100,0],[0,0],[0,80],[100,80]]);
|
|
|
|
assert_equal(rect([100,80],anchor=CENTER), [[50,-40],[-50,-40],[-50,40],[50,40]]);
|
|
|
|
assert_equal(rect([100,80],anchor=FRONT+LEFT), [[100,0],[0,0],[0,80],[100,80]]);
|
|
|
|
assert_equal(rect([100,80],anchor=BACK+RIGHT), [[0,-80],[-100,-80],[-100,0],[0,0]]);
|
|
|
|
assert_approx(rect([100,80],rounding=10,anchor=CENTER,$fn=12), [[50,-30],[48.6602540378,-35],[45,-38.6602540378],[40,-40],[-40,-40],[-45,-38.6602540378],[-48.6602540378,-35],[-50,-30],[-50,30],[-48.6602540378,35],[-45,38.6602540378],[-40,40],[40,40],[45,38.6602540378],[48.6602540378,35],[50,30]]);
|
|
|
|
}
|
|
|
|
test_rect();
|
|
|
|
|
|
|
|
|
|
|
|
module test_trapezoid() {
|
|
|
|
assert_equal(trapezoid(w1=100,w2=80,h=60,anchor=CENTER), [[50,-30],[-50,-30],[-40,30],[40,30]]);
|
|
|
|
}
|
|
|
|
test_trapezoid();
|
|
|
|
|
|
|
|
|
|
|
|
module test_oval() {
|
|
|
|
assert_approx(oval(d=100,$fn=24), [[50,0],[48.2962913145,-12.9409522551],[43.3012701892,-25],[35.3553390593,-35.3553390593],[25,-43.3012701892],[12.9409522551,-48.2962913145],[0,-50],[-12.9409522551,-48.2962913145],[-25,-43.3012701892],[-35.3553390593,-35.3553390593],[-43.3012701892,-25],[-48.2962913145,-12.9409522551],[-50,0],[-48.2962913145,12.9409522551],[-43.3012701892,25],[-35.3553390593,35.3553390593],[-25,43.3012701892],[-12.9409522551,48.2962913145],[0,50],[12.9409522551,48.2962913145],[25,43.3012701892],[35.3553390593,35.3553390593],[43.3012701892,25],[48.2962913145,12.9409522551]]);
|
|
|
|
assert_approx(oval(d=[100,80],$fn=24), [[50,0],[48.2962913145,-10.3527618041],[43.3012701892,-20],[35.3553390593,-28.2842712475],[25,-34.6410161514],[12.9409522551,-38.6370330516],[0,-40],[-12.9409522551,-38.6370330516],[-25,-34.6410161514],[-35.3553390593,-28.2842712475],[-43.3012701892,-20],[-48.2962913145,-10.3527618041],[-50,0],[-48.2962913145,10.3527618041],[-43.3012701892,20],[-35.3553390593,28.2842712475],[-25,34.6410161514],[-12.9409522551,38.6370330516],[0,40],[12.9409522551,38.6370330516],[25,34.6410161514],[35.3553390593,28.2842712475],[43.3012701892,20],[48.2962913145,10.3527618041]]);
|
|
|
|
}
|
|
|
|
test_oval();
|
|
|
|
|
|
|
|
|
|
|
|
module test_star() {
|
|
|
|
assert_approx(star(n=5,d=100,step=2), [[50,0],[15.4508497187,-11.2256994145],[15.4508497187,-47.5528258148],[-5.90169943749,-18.1635632001],[-40.4508497187,-29.3892626146],[-19.0983005625,0],[-40.4508497187,29.3892626146],[-5.90169943749,18.1635632001],[15.4508497187,47.5528258148],[15.4508497187,11.2256994145]]);
|
|
|
|
assert_approx(star(n=6,d=100,step=2), [[50,0],[25,-14.4337567297],[25,-43.3012701892],[0,-28.8675134595],[-25,-43.3012701892],[-25,-14.4337567297],[-50,0],[-25,14.4337567297],[-25,43.3012701892],[0,28.8675134595],[25,43.3012701892],[25,14.4337567297]]);
|
|
|
|
assert_approx(star(n=7,d=100,step=3), [[50,0],[16.0776033027,-7.74256568183],[31.1744900929,-39.0915741234],[3.97084009243,-17.3973871675],[-11.1260466978,-48.7463956091],[-11.1260466978,-13.951621274],[-45.0484433951,-21.6941869559],[-17.8447933946,0],[-45.0484433951,21.6941869559],[-11.1260466978,13.951621274],[-11.1260466978,48.7463956091],[3.97084009243,17.3973871675],[31.1744900929,39.0915741234],[16.0776033027,7.74256568183]]);
|
|
|
|
}
|
|
|
|
test_star();
|
|
|
|
|
|
|
|
|
|
|
|
module test_regular_ngon() {
|
|
|
|
assert_approx(regular_ngon(n=7,d=100), [[50,0],[31.1744900929,-39.0915741234],[-11.1260466978,-48.7463956091],[-45.0484433951,-21.6941869559],[-45.0484433951,21.6941869559],[-11.1260466978,48.7463956091],[31.1744900929,39.0915741234]]);
|
|
|
|
assert_approx(regular_ngon(n=9,d=100), [[50,0],[38.3022221559,-32.1393804843],[8.68240888335,-49.2403876506],[-25,-43.3012701892],[-46.9846310393,-17.1010071663],[-46.9846310393,17.1010071663],[-25,43.3012701892],[8.68240888335,49.2403876506],[38.3022221559,32.1393804843]]);
|
|
|
|
assert_approx(regular_ngon(n=5,d=100,rounding=10,$fn=24), [[47.4207962323,2.07911690818],[47.4207962323,-2.07911690818],[45.7294901688,-5.87785252292],[19.72135955,-41.6749732918],[16.6311896062,-44.4573748068],[12.6764742389,-45.7423397226],[8.5410196625,-45.3076859319],[-33.5410196625,-31.6344024975],[-37.1421557823,-29.5552855893],[-39.5863042952,-26.1912037653],[-40.4508497187,-22.1238373346],[-40.4508497187,22.1238373346],[-39.5863042952,26.1912037653],[-37.1421557823,29.5552855893],[-33.5410196625,31.6344024975],[8.5410196625,45.3076859319],[12.6764742389,45.7423397226],[16.6311896062,44.4573748068],[19.72135955,41.6749732918],[45.7294901688,5.87785252292]]);
|
|
|
|
}
|
|
|
|
test_regular_ngon();
|
|
|
|
|
|
|
|
|
|
|
|
module test_pentagon() {
|
|
|
|
assert_approx(pentagon(d=100), [[50,0],[15.4508497187,-47.5528258148],[-40.4508497187,-29.3892626146],[-40.4508497187,29.3892626146],[15.4508497187,47.5528258148]]);
|
|
|
|
assert_approx(pentagon(d=100,rounding=10,$fn=24), [[47.4207962323,2.07911690818],[47.4207962323,-2.07911690818],[45.7294901688,-5.87785252292],[19.72135955,-41.6749732918],[16.6311896062,-44.4573748068],[12.6764742389,-45.7423397226],[8.5410196625,-45.3076859319],[-33.5410196625,-31.6344024975],[-37.1421557823,-29.5552855893],[-39.5863042952,-26.1912037653],[-40.4508497187,-22.1238373346],[-40.4508497187,22.1238373346],[-39.5863042952,26.1912037653],[-37.1421557823,29.5552855893],[-33.5410196625,31.6344024975],[8.5410196625,45.3076859319],[12.6764742389,45.7423397226],[16.6311896062,44.4573748068],[19.72135955,41.6749732918],[45.7294901688,5.87785252292]]);
|
|
|
|
}
|
|
|
|
test_pentagon();
|
|
|
|
|
|
|
|
|
|
|
|
module test_hexagon() {
|
|
|
|
assert_approx(hexagon(d=100), [[50,0],[25,-43.3012701892],[-25,-43.3012701892],[-50,0],[-25,43.3012701892],[25,43.3012701892]]);
|
|
|
|
assert_approx(hexagon(d=100,rounding=10,$fn=24), [[48.3010721463,1.73648177667],[48.3010721463,-1.73648177667],[47.1132486541,-5],[27.8867513459,-38.3012701892],[25.654373405,-40.9617146204],[22.6466987414,-42.6981963971],[19.2264973081,-43.3012701892],[-19.2264973081,-43.3012701892],[-22.6466987414,-42.6981963971],[-25.654373405,-40.9617146204],[-27.8867513459,-38.3012701892],[-47.1132486541,-5],[-48.3010721463,-1.73648177667],[-48.3010721463,1.73648177667],[-47.1132486541,5],[-27.8867513459,38.3012701892],[-25.654373405,40.9617146204],[-22.6466987414,42.6981963971],[-19.2264973081,43.3012701892],[19.2264973081,43.3012701892],[22.6466987414,42.6981963971],[25.654373405,40.9617146204],[27.8867513459,38.3012701892],[47.1132486541,5]]);
|
|
|
|
}
|
|
|
|
test_hexagon();
|
|
|
|
|
|
|
|
|
|
|
|
module test_octagon() {
|
|
|
|
assert_approx(octagon(d=100), [[50,0],[35.3553390593,-35.3553390593],[0,-50],[-35.3553390593,-35.3553390593],[-50,0],[-35.3553390593,35.3553390593],[0,50],[35.3553390593,35.3553390593]]);
|
|
|
|
assert_approx(octagon(d=100,rounding=10,$fn=24), [[49.1760779971,0],[48.4148733222,-3.82683432365],[36.9404657371,-31.5285047357],[34.7727382239,-34.7727382239],[31.5285047357,-36.9404657371],[3.82683432365,-48.4148733222],[0,-49.1760779971],[-3.82683432365,-48.4148733222],[-31.5285047357,-36.9404657371],[-34.7727382239,-34.7727382239],[-36.9404657371,-31.5285047357],[-48.4148733222,-3.82683432365],[-49.1760779971,0],[-48.4148733222,3.82683432365],[-36.9404657371,31.5285047357],[-34.7727382239,34.7727382239],[-31.5285047357,36.9404657371],[-3.82683432365,48.4148733222],[0,49.1760779971],[3.82683432365,48.4148733222],[31.5285047357,36.9404657371],[34.7727382239,34.7727382239],[36.9404657371,31.5285047357],[48.4148733222,3.82683432365]]);
|
|
|
|
}
|
|
|
|
test_octagon();
|
|
|
|
|
|
|
|
|
|
|
|
module test_teardrop2d() {
|
2020-07-01 00:19:09 +00:00
|
|
|
$fn=24;
|
|
|
|
assert_approx(teardrop2d(r=50), [[50,0],[48.2962913145,-12.9409522551],[43.3012701892,-25],[35.3553390593,-35.3553390593],[25,-43.3012701892],[12.9409522551,-48.2962913145],[0,-50],[-12.9409522551,-48.2962913145],[-25,-43.3012701892],[-35.3553390593,-35.3553390593],[-43.3012701892,-25],[-48.2962913145,-12.9409522551],[-50,0],[-48.2962913145,12.9409522551],[-43.3012701892,25],[-35.3553390593,35.3553390593],[0,70.7106781187],[35.3553390593,35.3553390593],[43.3012701892,25],[48.2962913145,12.9409522551]]);
|
|
|
|
assert_approx(teardrop2d(d=100), [[50,0],[48.2962913145,-12.9409522551],[43.3012701892,-25],[35.3553390593,-35.3553390593],[25,-43.3012701892],[12.9409522551,-48.2962913145],[0,-50],[-12.9409522551,-48.2962913145],[-25,-43.3012701892],[-35.3553390593,-35.3553390593],[-43.3012701892,-25],[-48.2962913145,-12.9409522551],[-50,0],[-48.2962913145,12.9409522551],[-43.3012701892,25],[-35.3553390593,35.3553390593],[0,70.7106781187],[35.3553390593,35.3553390593],[43.3012701892,25],[48.2962913145,12.9409522551]]);
|
|
|
|
assert_approx(teardrop2d(r=50,cap_h=50), [[50,0],[48.2962913145,-12.9409522551],[43.3012701892,-25],[35.3553390593,-35.3553390593],[25,-43.3012701892],[12.9409522551,-48.2962913145],[0,-50],[-12.9409522551,-48.2962913145],[-25,-43.3012701892],[-35.3553390593,-35.3553390593],[-43.3012701892,-25],[-48.2962913145,-12.9409522551],[-50,0],[-48.2962913145,12.9409522551],[-43.3012701892,25],[-35.3553390593,35.3553390593],[-20.7106781187,50],[20.7106781187,50],[35.3553390593,35.3553390593],[43.3012701892,25],[48.2962913145,12.9409522551]]);
|
|
|
|
assert_approx(teardrop2d(r=50,cap_h=50,ang=30), [[50,0],[48.2962913145,-12.9409522551],[43.3012701892,-25],[35.3553390593,-35.3553390593],[25,-43.3012701892],[12.9409522551,-48.2962913145],[0,-50],[-12.9409522551,-48.2962913145],[-25,-43.3012701892],[-35.3553390593,-35.3553390593],[-43.3012701892,-25],[-48.2962913145,-12.9409522551],[-50,0],[-48.2962913145,12.9409522551],[-43.3012701892,25],[-28.8675134595,50],[28.8675134595,50],[43.3012701892,25],[48.2962913145,12.9409522551]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
|
|
|
test_teardrop2d();
|
|
|
|
|
|
|
|
|
|
|
|
module test_glued_circles() {
|
2020-07-01 00:19:09 +00:00
|
|
|
$fn=24;
|
|
|
|
assert_approx(glued_circles(r=15, spread=40, tangent=30), [[35,0],[34.4888873943,-3.88228567654],[32.9903810568,-7.5],[30.6066017178,-10.6066017178],[27.5,-12.9903810568],[23.8822856765,-14.4888873943],[20,-15],[16.1177143235,-14.4888873943],[12.5,-12.9903810568],[12.5,-12.9903810568],[6.47047612756,-10.4928704942],[0,-9.64101615138],[-6.47047612756,-10.4928704942],[-12.5,-12.9903810568],[-12.5,-12.9903810568],[-16.1177143235,-14.4888873943],[-20,-15],[-23.8822856765,-14.4888873943],[-27.5,-12.9903810568],[-30.6066017178,-10.6066017178],[-32.9903810568,-7.5],[-34.4888873943,-3.88228567654],[-35,0],[-34.4888873943,3.88228567654],[-32.9903810568,7.5],[-30.6066017178,10.6066017178],[-27.5,12.9903810568],[-23.8822856765,14.4888873943],[-20,15],[-16.1177143235,14.4888873943],[-12.5,12.9903810568],[-6.47047612756,10.4928704942],[0,9.64101615138],[6.47047612756,10.4928704942],[12.5,12.9903810568],[12.5,12.9903810568],[16.1177143235,14.4888873943],[20,15],[23.8822856765,14.4888873943],[27.5,12.9903810568],[30.6066017178,10.6066017178],[32.9903810568,7.5],[34.4888873943,3.88228567654]]);
|
|
|
|
assert_approx(glued_circles(d=30, spread=40, tangent=30), [[35,0],[34.4888873943,-3.88228567654],[32.9903810568,-7.5],[30.6066017178,-10.6066017178],[27.5,-12.9903810568],[23.8822856765,-14.4888873943],[20,-15],[16.1177143235,-14.4888873943],[12.5,-12.9903810568],[12.5,-12.9903810568],[6.47047612756,-10.4928704942],[0,-9.64101615138],[-6.47047612756,-10.4928704942],[-12.5,-12.9903810568],[-12.5,-12.9903810568],[-16.1177143235,-14.4888873943],[-20,-15],[-23.8822856765,-14.4888873943],[-27.5,-12.9903810568],[-30.6066017178,-10.6066017178],[-32.9903810568,-7.5],[-34.4888873943,-3.88228567654],[-35,0],[-34.4888873943,3.88228567654],[-32.9903810568,7.5],[-30.6066017178,10.6066017178],[-27.5,12.9903810568],[-23.8822856765,14.4888873943],[-20,15],[-16.1177143235,14.4888873943],[-12.5,12.9903810568],[-6.47047612756,10.4928704942],[0,9.64101615138],[6.47047612756,10.4928704942],[12.5,12.9903810568],[12.5,12.9903810568],[16.1177143235,14.4888873943],[20,15],[23.8822856765,14.4888873943],[27.5,12.9903810568],[30.6066017178,10.6066017178],[32.9903810568,7.5],[34.4888873943,3.88228567654]]);
|
|
|
|
assert_approx(glued_circles(d=30, spread=30, tangent=45), [[30,0],[29.4888873943,-3.88228567654],[27.9903810568,-7.5],[25.6066017178,-10.6066017178],[22.5,-12.9903810568],[18.8822856765,-14.4888873943],[15,-15],[11.1177143235,-14.4888873943],[7.5,-12.9903810568],[4.3933982822,-10.6066017178],[4.3933982822,-10.6066017178],[3.1066017178,-9.61920798589],[1.60809538023,-8.99850633757],[0,-8.7867965644],[-1.60809538023,-8.99850633757],[-3.1066017178,-9.61920798589],[-4.3933982822,-10.6066017178],[-4.3933982822,-10.6066017178],[-7.5,-12.9903810568],[-11.1177143235,-14.4888873943],[-15,-15],[-18.8822856765,-14.4888873943],[-22.5,-12.9903810568],[-25.6066017178,-10.6066017178],[-27.9903810568,-7.5],[-29.4888873943,-3.88228567654],[-30,0],[-29.4888873943,3.88228567654],[-27.9903810568,7.5],[-25.6066017178,10.6066017178],[-22.5,12.9903810568],[-18.8822856765,14.4888873943],[-15,15],[-11.1177143235,14.4888873943],[-7.5,12.9903810568],[-4.3933982822,10.6066017178],[-3.1066017178,9.61920798589],[-1.60809538023,8.99850633757],[0,8.7867965644],[1.60809538023,8.99850633757],[3.1066017178,9.61920798589],[4.3933982822,10.6066017178],[4.3933982822,10.6066017178],[7.5,12.9903810568],[11.1177143235,14.4888873943],[15,15],[18.8822856765,14.4888873943],[22.5,12.9903810568],[25.6066017178,10.6066017178],[27.9903810568,7.5],[29.4888873943,3.88228567654]]);
|
|
|
|
assert_approx(glued_circles(d=30, spread=30, tangent=-30), [[30,0],[29.4888873943,-3.88228567654],[27.9903810568,-7.5],[25.6066017178,-10.6066017178],[22.5,-12.9903810568],[22.5,-12.9903810568],[11.6468570296,-17.4859000695],[0,-19.0192378865],[-11.6468570296,-17.4859000695],[-22.5,-12.9903810568],[-22.5,-12.9903810568],[-25.6066017178,-10.6066017178],[-27.9903810568,-7.5],[-29.4888873943,-3.88228567654],[-30,0],[-29.4888873943,3.88228567654],[-27.9903810568,7.5],[-25.6066017178,10.6066017178],[-22.5,12.9903810568],[-11.6468570296,17.4859000695],[0,19.0192378865],[11.6468570296,17.4859000695],[22.5,12.9903810568],[22.5,12.9903810568],[25.6066017178,10.6066017178],[27.9903810568,7.5],[29.4888873943,3.88228567654]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
|
|
|
test_glued_circles();
|
|
|
|
|
|
|
|
|
|
|
|
module test_supershape() {
|
2020-07-01 00:19:09 +00:00
|
|
|
$fn = 24;
|
|
|
|
assert_approx(supershape(step=0.5,m1=16,m2=16,n1=0.5,n2=0.5,n3=16,r=50), [[31.8072679929,0],[31.8254440703,-0.277736442783],[31.8800818691,-0.556468898942],[31.9715117231,-0.837203498428],[32.1002896772,-1.12096681644],[32.2672058831,-1.40881663388],[32.4732966814,-1.70185336507],[32.7198607165,-2.00123241238],[33.0084795316,-2.30817774075],[33.3410431535,-2.6239970035],[33.7197810671,-2.95009857994],[34.1472983973,-3.2880108612],[34.6266155102,-3.63940394304],[35.1612056414,-4.00611335337],[35.7550182057,-4.39016421046],[36.4124633674,-4.79379174563],[37.138314422,-5.21944970831],[37.9374570742,-5.66979094838],[38.8143785616,-6.14759362503],[39.7722470564,-6.65559159145],[40.8113899535,-7.19614916902],[41.9269541846,-7.77070164547],[43.1055530065,-8.37887071896],[44.3208250346,-9.01717376565],[45.5281335086,-9.67730351785],[46.6592118851,-10.344098238],[47.6184628391,-10.9935883798],[48.28369535,-11.5918896634],[48.5147863138,-12.09609478],[48.1730192886,-12.4583898795],[47.1505372707,-12.6339483844],[45.4034911139,-12.5915024719],[42.9767802608,-12.3233934346],[40.0076792879,-11.8508145072],[36.7032455714,-11.2213082803],[33.2989492854,-10.4991183806],[30.0149182764,-9.75243812881],[27.0253656239,-9.04256084558],[24.4481119546,-8.41816003875],[22.3518922366,-7.9152201722],[20.7749251664,-7.56145437968],[19.7499695415,-7.38421103185],[19.3382230386,-7.42324832601],[19.694017676,-7.75767986951],[21.2841774283,-8.59936587637],[29.3860838838,-12.1721144897],[21.1308561166,-8.96951626646],[19.4112814895,-8.44026540548],[18.9232178765,-8.42515941694],[19.1867630853,-8.74391169667],[20.0368461313,-9.3433347963],[21.4020804312,-10.2082687145],[23.2399637988,-11.3348877018],[25.5038753899,-12.7157632035],[28.119767384,-14.327737116],[30.9699106495,-16.1219150427],[33.8877770139,-18.0184506563],[36.6694926246,-19.9099100234],[39.1031278208,-21.6752176912],[41.0086532394,-23.201579673],[42.2740152165,-24.406914065],[42.8728805757,-25.2540566427],[42.8583650351,-25.7519037455],[42.3384321905,-25.945024615],[41.4449788762,-25.8976970902],[40.3074271381,-25.6786631194],[39.0361388798,-25.3503649976],[37.7156606466,-24.9634512129],[36.4049851418,-24.5554725336],[35.1415494465,-24.1521177904],[33.9464564616,-23.7695647099],[32.8294395437,-23.4170116495],[31.7929154287,-23.0989051482],[30.8349807857,-22.8166855306],[29.9514622525,-22.5700456868],[29.1372224177,-22.3577771159],[28.3869307184,-22.1783009509],[27.6954768621,-22.0299770253],[27.0581618444,-21.9112674292],[26.4707610325,-21.8208114794],[25.9295205637,-21.7574511416],[25.4311237807,-21.7202316307],[24.9726478461,-21.7083915808],[24.5515204017,-21.7213503826],[24.1654803459,-21.7586962359],[23.8125438851,-21.8201762946],[23.4909757462,-21.9056892714],[23.1992650151,-22.0152804732],[22.9361050064,-22.1491391425],[22.7003766384,-22.3075979943],[22.4911348888,-22.4911348888],[22.3075979943,-22.7003766384],[22.1491391425,-22.9361050064],[22.0152804732,-23.1992650151],[21.9056892714,-23.4909757462],[21.8201762946,-23.8125438851],[21.7586962359,-24.1654803459],[21.7213503826,-24.5515204017],[21.7083915808,-24.9726478461],[21.7202316307,-25.4311237807],[21.7574511416,-25.9295205637],[21.8208114794,-26.4707610325],[21.9112674292,-27.0581618444],[22.0299770253,-27.6954768621],[22.1783009509,-28.3869307184],[22.3577771159,-29.1372224177],[22.5700456868,-29.9514622525],[22.8166855306,-30.8349807857],[23.0989051482,-31.7929154287],[23.4170116495,-32.8294395437],[23.7695647099,-33.9464564616],[24.1521177904,-35.1415494465],[24.5554725336,-36.4049851418],[24.9634512129,-37.7156606466],[25.3503649976,-39.0361388798],[25.6786631194,-40.3074271381],[25.8976970902,-41.4449788762],[25.945024615,-42.3384321905],[25.7519037455,-42.8583650351],[25.2540566427,-42.8728805757],[24.406914065,-42.2740152165],[23.201579673,-41.0086532394],[21.6752176912,-39.1031278208],[19.9099100234,-36.6694926246],[18.0184506563,-33.8877770139],[16.1219150427,-30.9699106495],[14.327737116,-28.119767384],[12.7157632035,-25.5038753899],[11.3348877018,-23.2399637988],[10.2082687145,-21.4020804312],[9.3433347963,-20.
|
|
|
|
assert_approx(supershape(m1=7, n1=2, n2=8, n3=4), [[1,0],[1.00019517316,-0.00872857104113],[1.00078102433,-0.0174686977586],[1.0017585498,-0.0262319708163],[1.00312941419,-0.0350300510433],[1.00489595654,-0.0438747049874],[1.00706119869,-0.0527778410254],[1.00962885581,-0.0617515462009],[1.01260334878,-0.0708081239432],[1.01598981818,-0.0799601328075],[1.01979413959,-0.0892204263441],[1.0240229395,-0.0986021941772],[1.02868361163,-0.10811900433],[1.03378433254,-0.117784846781],[1.03933407606,-0.12761417816],[1.04534262515,-0.137621967435],[1.05182058018,-0.147823742296],[1.0587793619,-0.158235635844],[1.06623120726,-0.168874433019],[1.07418915584,-0.179757615985],[1.08266702407,-0.190903407467],[1.09167936393,-0.202330810682],[1.10124140209,-0.214059644174],[1.11136895468,-0.226110569338],[1.12207831186,-0.238505107894],[1.1333860853,-0.251265645826],[1.14530901022,-0.26441541947],[1.15786369227,-0.277978478424],[1.17106628758,-0.291979618679],[1.18493210244,-0.306444277958],[1.19947509676,-0.321398383517],[1.21470727308,-0.336868140672],[1.23063793043,-0.35287974809],[1.2472727598,-0.369459023352],[1.26461275593,-0.386630919653],[1.28265291846,-0.404418911741],[1.30138071516,-0.422844226653],[1.32077428165,-0.441924892758],[1.34080033604,-0.461674579605],[1.36141179612,-0.482101201868],[1.38254510094,-0.503205264274],[1.40411726123,-0.524977932173],[1.42602269563,-0.547398825996],[1.44812995451,-0.570433559133],[1.47027849121,-0.594031069729],[1.49227571289,-0.618120839079],[1.51389462641,-0.642610143307],[1.53487248259,-0.667381549418],[1.55491090311,-0.692290937163],[1.57367802873,-0.717166395447],[1.59081323057,-0.741808392109],[1.60593484806,-0.76599162963],[1.61865123028,-0.789468954531],[1.62857504526,-0.811977564899],[1.63534039155,-0.83324754808],[1.63862174143,-0.853012486907],[1.63815324577,-0.871021531282],[1.63374655172,-0.88705200202],[1.62530514368,-0.900921352515],[1.6128334029,-0.912497235111],[1.59643910952,-0.921704549628],[1.57632890991,-0.928528688623],[1.55279718806,-0.933014679643],[1.52620962151,-0.935262458929],[1.49698329573,-0.935418981821],[1.46556549563,-0.933668192529],[1.4324131807,-0.930219996144],[1.39797475806,-0.925299307277],[1.36267521949,-0.919136041237],[1.32690513459,-0.911956632875],[1.29101349317,-0.903977379849],[1.25530402436,-0.895399658682],[1.22003440231,-0.88640687891],[1.18541766257,-0.87716292795],[1.15162516709,-0.867811808863],[1.11879053251,-0.85847816949],[1.08701404382,-0.849268448251],[1.05636719081,-0.840272404763],[1.02689707061,-0.831564851513],[0.998630490424,-0.823207449243],[0.971577675677,-0.815250469321],[0.945735541708,-0.807734459729],[0.921090524428,-0.800691777214],[0.897620989299,-0.794147967228],[0.875299252405,-0.788122986837],[0.854093254551,-0.782632274663],[0.833967931608,-0.77768767758],[0.814886323466,-0.77329824687],[0.796810461115,-0.769470917947],[0.779702067617,-0.766211087893],[0.763523104482,-0.763523104482],[0.748236190758,-0.761410679404],[0.733804918133,-0.759877237135],[0.720194081714,-0.758926209655],[0.707369842875,-0.758561285914],[0.695299837765,-0.758786623746],[0.683953242625,-0.759607030817],[0.673300804976,-0.761028120197],[0.663314848035,-0.76305644522],[0.653969254213,-0.765699617546],[0.645239432346,-0.768966411581],[0.637102272286,-0.772866857811],[0.62953608962,-0.777412327008],[0.622520562564,-0.782615606762],[0.616036662471,-0.788490971254],[0.610066578882,-0.795054244721],[0.604593639556,-0.802322858557],[0.59960222555,-0.810315901451],[0.595077681001,-0.819054161405],[0.591006216921,-0.828560157837],[0.58737480797,-0.838858161213],[0.584171080778,-0.849974196821],[0.581383192055,-0.86193602829],[0.578999694296,-0.874773115235],[0.577009386474,-0.888516538024],[0.575401146653,-0.903198880958],[0.574163742953,-0.918854063171],[0.573285618773,-0.935517104201],[0.572754647627,-0.953223808466],[0.572557852412,-0.97201034972],[0.572681083409,-0.991912732999],[0.573108648924,-1.01296610763],[0.573822892216,-1.03520390063],[0.574803708461,-1.05865673543],[0.576027996016,-1.08335109689],[0.577469037497,-1.10930769991],[0.57
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
|
|
|
test_supershape();
|
|
|
|
|
|
|
|
|
|
|
|
module test_mask2d_chamfer() {
|
2020-07-01 00:19:09 +00:00
|
|
|
assert_approx(mask2d_chamfer(x=10),[[10,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[10,0]]);
|
|
|
|
assert_approx(mask2d_chamfer(y=10),[[10,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[10,0]]);
|
|
|
|
assert_approx(mask2d_chamfer(edge=10),[[7.07106781187,-0.01],[-0.01,-0.01],[-0.01,7.07106781187],[0,7.07106781187],[7.07106781187,0]]);
|
|
|
|
assert_approx(mask2d_chamfer(x=10,angle=30),[[10,-0.01],[-0.01,-0.01],[-0.01,17.3205080757],[0,17.3205080757],[10,0]]);
|
|
|
|
assert_approx(mask2d_chamfer(y=10,angle=30),[[5.7735026919,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[5.7735026919,0]]);
|
|
|
|
assert_approx(mask2d_chamfer(edge=10,angle=30),[[5,-0.01],[-0.01,-0.01],[-0.01,8.66025403784],[0,8.66025403784],[5,0]]);
|
|
|
|
assert_approx(mask2d_chamfer(x=10,angle=30,inset=1),[[11,-0.01],[-0.01,-0.01],[-0.01,18.3205080757],[1,18.3205080757],[11,1]]);
|
|
|
|
assert_approx(mask2d_chamfer(y=10,angle=30,inset=1),[[6.7735026919,-0.01],[-0.01,-0.01],[-0.01,11],[1,11],[6.7735026919,1]]);
|
|
|
|
assert_approx(mask2d_chamfer(edge=10,angle=30,inset=1),[[6,-0.01],[-0.01,-0.01],[-0.01,9.66025403784],[1,9.66025403784],[6,1]]);
|
|
|
|
assert_approx(mask2d_chamfer(x=10,angle=30,inset=1,excess=1),[[11,-1],[-1,-1],[-1,18.3205080757],[1,18.3205080757],[11,1]]);
|
|
|
|
assert_approx(mask2d_chamfer(y=10,angle=30,inset=1,excess=1),[[6.7735026919,-1],[-1,-1],[-1,11],[1,11],[6.7735026919,1]]);
|
|
|
|
assert_approx(mask2d_chamfer(edge=10,angle=30,inset=1,excess=1),[[6,-1],[-1,-1],[-1,9.66025403784],[1,9.66025403784],[6,1]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
|
|
|
test_mask2d_chamfer();
|
|
|
|
|
|
|
|
|
|
|
|
module test_mask2d_cove() {
|
2020-07-01 00:19:09 +00:00
|
|
|
$fn = 24;
|
|
|
|
assert_approx(mask2d_cove(r=10),[[10,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[2.58819045103,9.65925826289],[5,8.66025403784],[7.07106781187,7.07106781187],[8.66025403784,5],[9.65925826289,2.58819045103],[10,0]]);
|
|
|
|
assert_approx(mask2d_cove(d=20),[[10,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[2.58819045103,9.65925826289],[5,8.66025403784],[7.07106781187,7.07106781187],[8.66025403784,5],[9.65925826289,2.58819045103],[10,0]]);
|
|
|
|
assert_approx(mask2d_cove(r=10,inset=1),[[11,-0.01],[-0.01,-0.01],[-0.01,11],[1,11],[3.58819045103,10.6592582629],[6,9.66025403784],[8.07106781187,8.07106781187],[9.66025403784,6],[10.6592582629,3.58819045103],[11,1]]);
|
|
|
|
assert_approx(mask2d_cove(d=20,inset=1),[[11,-0.01],[-0.01,-0.01],[-0.01,11],[1,11],[3.58819045103,10.6592582629],[6,9.66025403784],[8.07106781187,8.07106781187],[9.66025403784,6],[10.6592582629,3.58819045103],[11,1]]);
|
|
|
|
assert_approx(mask2d_cove(r=10,inset=1,excess=1),[[11,-1],[-1,-1],[-1,11],[1,11],[3.58819045103,10.6592582629],[6,9.66025403784],[8.07106781187,8.07106781187],[9.66025403784,6],[10.6592582629,3.58819045103],[11,1]]);
|
|
|
|
assert_approx(mask2d_cove(d=20,inset=1,excess=1),[[11,-1],[-1,-1],[-1,11],[1,11],[3.58819045103,10.6592582629],[6,9.66025403784],[8.07106781187,8.07106781187],[9.66025403784,6],[10.6592582629,3.58819045103],[11,1]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
|
|
|
test_mask2d_cove();
|
|
|
|
|
|
|
|
|
2020-07-01 00:19:09 +00:00
|
|
|
module test_mask2d_roundover() {
|
|
|
|
$fn = 24;
|
|
|
|
assert_approx(mask2d_roundover(r=10),[[10,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[0.340741737109,7.41180954897],[1.33974596216,5],[2.92893218813,2.92893218813],[5,1.33974596216],[7.41180954897,0.340741737109],[10,0]]);
|
|
|
|
assert_approx(mask2d_roundover(d=20),[[10,-0.01],[-0.01,-0.01],[-0.01,10],[0,10],[0.340741737109,7.41180954897],[1.33974596216,5],[2.92893218813,2.92893218813],[5,1.33974596216],[7.41180954897,0.340741737109],[10,0]]);
|
|
|
|
assert_approx(mask2d_roundover(r=10,inset=1),[[11,-0.01],[-0.01,-0.01],[-0.01,11],[1,11],[1.34074173711,8.41180954897],[2.33974596216,6],[3.92893218813,3.92893218813],[6,2.33974596216],[8.41180954897,1.34074173711],[11,1]]);
|
|
|
|
assert_approx(mask2d_roundover(d=20,inset=1),[[11,-0.01],[-0.01,-0.01],[-0.01,11],[1,11],[1.34074173711,8.41180954897],[2.33974596216,6],[3.92893218813,3.92893218813],[6,2.33974596216],[8.41180954897,1.34074173711],[11,1]]);
|
|
|
|
assert_approx(mask2d_roundover(r=10,inset=1,excess=1),[[11,-1],[-1,-1],[-1,11],[1,11],[1.34074173711,8.41180954897],[2.33974596216,6],[3.92893218813,3.92893218813],[6,2.33974596216],[8.41180954897,1.34074173711],[11,1]]);
|
|
|
|
assert_approx(mask2d_roundover(d=20,inset=1,excess=1),[[11,-1],[-1,-1],[-1,11],[1,11],[1.34074173711,8.41180954897],[2.33974596216,6],[3.92893218813,3.92893218813],[6,2.33974596216],[8.41180954897,1.34074173711],[11,1]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
2020-07-01 00:19:09 +00:00
|
|
|
test_mask2d_roundover();
|
2020-06-25 05:33:41 +00:00
|
|
|
|
|
|
|
|
2020-07-01 00:19:09 +00:00
|
|
|
module test_mask2d_dovetail() {
|
|
|
|
assert_approx(mask2d_dovetail(x=10),[[0,0],[-0.01,0],[-0.01,17.3205080757],[10,17.3205080757],[10,17.3205080757],[0,0]]);
|
|
|
|
assert_approx(mask2d_dovetail(y=10),[[0,0],[-0.01,0],[-0.01,10],[5.7735026919,10],[5.7735026919,10],[0,0]]);
|
|
|
|
assert_approx(mask2d_dovetail(edge=10),[[0,0],[-0.01,0],[-0.01,8.66025403784],[5,8.66025403784],[5,8.66025403784],[0,0]]);
|
|
|
|
assert_approx(mask2d_dovetail(x=10,angle=30),[[0,0],[-0.01,0],[-0.01,17.3205080757],[10,17.3205080757],[10,17.3205080757],[0,0]]);
|
|
|
|
assert_approx(mask2d_dovetail(y=10,angle=30),[[0,0],[-0.01,0],[-0.01,10],[5.7735026919,10],[5.7735026919,10],[0,0]]);
|
|
|
|
assert_approx(mask2d_dovetail(edge=10,angle=30),[[0,0],[-0.01,0],[-0.01,8.66025403784],[5,8.66025403784],[5,8.66025403784],[0,0]]);
|
|
|
|
assert_approx(mask2d_dovetail(x=10,angle=30,inset=1),[[1,0],[-0.01,0],[-0.01,18.3205080757],[11,18.3205080757],[11,18.3205080757],[1,1]]);
|
|
|
|
assert_approx(mask2d_dovetail(y=10,angle=30,inset=1),[[1,0],[-0.01,0],[-0.01,11],[6.7735026919,11],[6.7735026919,11],[1,1]]);
|
|
|
|
assert_approx(mask2d_dovetail(edge=10,angle=30,inset=1),[[1,0],[-0.01,0],[-0.01,9.66025403784],[6,9.66025403784],[6,9.66025403784],[1,1]]);
|
|
|
|
assert_approx(mask2d_dovetail(x=10,angle=30,inset=1,excess=1),[[1,0],[-1,0],[-1,18.3205080757],[11,18.3205080757],[11,18.3205080757],[1,1]]);
|
|
|
|
assert_approx(mask2d_dovetail(y=10,angle=30,inset=1,excess=1),[[1,0],[-1,0],[-1,11],[6.7735026919,11],[6.7735026919,11],[1,1]]);
|
|
|
|
assert_approx(mask2d_dovetail(edge=10,angle=30,inset=1,excess=1),[[1,0],[-1,0],[-1,9.66025403784],[6,9.66025403784],[6,9.66025403784],[1,1]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
2020-07-01 00:19:09 +00:00
|
|
|
test_mask2d_dovetail();
|
2020-06-25 05:33:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
module test_mask2d_rabbet() {
|
2020-07-01 00:19:09 +00:00
|
|
|
assert_approx(mask2d_rabbet(10), [[10,-0.01],[-0.01,-0.01],[-0.01,10],[10,10]]);
|
|
|
|
assert_approx(mask2d_rabbet(size=10), [[10,-0.01],[-0.01,-0.01],[-0.01,10],[10,10]]);
|
|
|
|
assert_approx(mask2d_rabbet(size=[10,15]), [[10,-0.01],[-0.01,-0.01],[-0.01,15],[10,15]]);
|
|
|
|
assert_approx(mask2d_rabbet(size=[10,15],excess=1), [[10,-1],[-1,-1],[-1,15],[10,15]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
|
|
|
test_mask2d_rabbet();
|
|
|
|
|
|
|
|
|
2020-07-01 00:19:09 +00:00
|
|
|
module test_mask2d_teardrop() {
|
|
|
|
$fn=24;
|
|
|
|
assert_approx(mask2d_teardrop(r=10), [[5.85786437627,0],[5.85786437627,-0.1],[-0.1,-0.1],[-0.1,10],[0,10],[0.340741737109,7.41180954897],[1.33974596216,5],[2.92893218813,2.92893218813]]);
|
|
|
|
assert_approx(mask2d_teardrop(d=20), [[5.85786437627,0],[5.85786437627,-0.1],[-0.1,-0.1],[-0.1,10],[0,10],[0.340741737109,7.41180954897],[1.33974596216,5],[2.92893218813,2.92893218813]]);
|
|
|
|
assert_approx(mask2d_teardrop(r=10,angle=30), [[4.2264973081,0],[4.2264973081,-0.1],[-0.1,-0.1],[-0.1,10],[0,10],[0.340741737109,7.41180954897],[1.33974596216,5]]);
|
|
|
|
assert_approx(mask2d_teardrop(r=10,angle=30,excess=1), [[4.2264973081,0],[4.2264973081,-1],[-1,-1],[-1,10],[0,10],[0.340741737109,7.41180954897],[1.33974596216,5]]);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
2020-07-01 00:19:09 +00:00
|
|
|
test_mask2d_teardrop();
|
2020-06-25 05:33:41 +00:00
|
|
|
|
|
|
|
|
2020-07-01 00:19:09 +00:00
|
|
|
module test_mask2d_ogee() {
|
|
|
|
$fn=24;
|
|
|
|
assert_approx(
|
|
|
|
mask2d_ogee([
|
|
|
|
"xstep",1, "ystep",1, // Starting shoulder.
|
|
|
|
"fillet",5, "round",5, // S-curve.
|
|
|
|
"ystep",1, "xstep",1 // Ending shoulder.
|
|
|
|
]),
|
|
|
|
[[12,-0.01],[-0.01,-0.01],[-0.01,12],[1,12],[1,11],[1.32701564615,10.9892946162],[1.6526309611,10.9572243069],[1.97545161008,10.903926402],[2.29409522551,10.8296291314],[2.60719732652,10.7346506475],[2.91341716183,10.6193976626],[3.2114434511,10.4843637077],[3.5,10.3301270189],[3.7778511651,10.1573480615],[4.04380714504,9.96676670146],[4.2967290755,9.75919903739],[4.53553390593,9.53553390593],[4.75919903739,9.2967290755],[4.96676670146,9.04380714504],[5.15734806151,8.7778511651],[5.33012701892,8.5],[5.48436370766,8.2114434511],[5.61939766256,7.91341716183],[5.73465064748,7.60719732652],[5.82962913145,7.29409522551],[5.90392640202,6.97545161008],[5.95722430687,6.6526309611],[5.98929461619,6.32701564615],[6,6],[6.01070538381,5.67298435385],[6.04277569313,5.3473690389],[6.09607359798,5.02454838992],[6.17037086855,4.70590477449],[6.26534935252,4.39280267348],[6.38060233744,4.08658283817],[6.51563629234,3.7885565489],[6.66987298108,3.5],[6.84265193849,3.2221488349],[7.03323329854,2.95619285496],[7.24080096261,2.7032709245],[7.46446609407,2.46446609407],[7.7032709245,2.24080096261],[7.95619285496,2.03323329854],[8.2221488349,1.84265193849],[8.5,1.66987298108],[8.7885565489,1.51563629234],[9.08658283817,1.38060233744],[9.39280267348,1.26534935252],[9.70590477449,1.17037086855],[10.0245483899,1.09607359798],[10.3473690389,1.04277569313],[10.6729843538,1.01070538381],[11,1],[11,0],[12,0]]
|
|
|
|
);
|
2020-06-25 05:33:41 +00:00
|
|
|
}
|
2020-07-01 00:19:09 +00:00
|
|
|
test_mask2d_ogee();
|
2020-06-25 05:33:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|