rename short poly to short path. add circle center functions
This commit is contained in:
parent
00d7ffec12
commit
3662f9b50c
4 changed files with 59 additions and 2 deletions
1
notes.md
1
notes.md
|
|
@ -12,6 +12,7 @@
|
|||
* `P` client/worker interface normalization
|
||||
* `P` explore widget vertex reloading / replacing (Onshape primarily)
|
||||
|
||||
* `F` G2/G3 arc output / input
|
||||
* `F` expose grouping feature
|
||||
* `F` SVG import to 3D part like images
|
||||
* `F` bundle current profile into exported device
|
||||
|
|
|
|||
|
|
@ -316,6 +316,60 @@
|
|||
return (d2y * d1x) - (d2x * d1y);
|
||||
}
|
||||
|
||||
/**
|
||||
* return circle center given three points
|
||||
* from https://math.stackexchange.com/questions/1076177/3d-coordinates-of-circle-center-given-three-point-on-the-circle
|
||||
*/
|
||||
function center3d(a,b,c) {
|
||||
let ax = a.x,
|
||||
ay = a.y,
|
||||
az = a.z || 0,
|
||||
bx = b.x,
|
||||
by = b.y,
|
||||
bz = b.z || 0,
|
||||
cx = c.x,
|
||||
cy = c.y,
|
||||
cz = c.z || 0,
|
||||
Cx = bx-ax,
|
||||
Cy = by-ay,
|
||||
Cz = bz-az,
|
||||
Bx = cx-ax,
|
||||
By = cy-ay,
|
||||
Bz = cz-az,
|
||||
B2 = (ax*ax)-(cx*cx)+(ay*ay)-(cy*cy)+(az*az)-(cz*cz),
|
||||
C2 = (ax*ax)-(bx*bx)+(ay*ay)-(by*by)+(az*az)-(bz*bz),
|
||||
CByz = Cy*Bz-Cz*By,
|
||||
CBxz = Cx*Bz-Cz*Bx,
|
||||
CBxy = Cx*By-Cy*Bx,
|
||||
ZZ1 = -(Bz-Cz*Bx/Cx)/(By-Cy*Bx/Cx),
|
||||
Z01 = -(B2-Bx/Cx*C2)/(2*(By-Cy*Bx/Cx)),
|
||||
ZZ2 = -(ZZ1*Cy+Cz)/Cx,
|
||||
Z02 = -(2*Z01*Cy+C2)/(2*Cx),
|
||||
dz = -((Z02-ax)*CByz-(Z01-ay)*CBxz-az*CBxy)/(ZZ2*CByz-ZZ1*CBxz+CBxy),
|
||||
dx = ZZ2*dz + Z02,
|
||||
dy = ZZ1*dz + Z01;
|
||||
|
||||
return {x:dx, y:dy, z:dz};
|
||||
}
|
||||
|
||||
/**
|
||||
* return circle center given three points
|
||||
* from https://stackoverflow.com/questions/4103405/what-is-the-algorithm-for-finding-the-center-of-a-circle-from-three-points
|
||||
*/
|
||||
function center2d(A,B,C) {
|
||||
let yDelta_a = B.y - A.y,
|
||||
xDelta_a = B.x - A.x,
|
||||
yDelta_b = C.y - B.y,
|
||||
xDelta_b = C.x - B.x,
|
||||
aSlope = yDelta_a/xDelta_a,
|
||||
bSlope = yDelta_b/xDelta_b,
|
||||
center = {x:0, y:0, z:0};
|
||||
center.x = (aSlope*bSlope*(A.y - C.y) + bSlope*(A.x + B.x) - aSlope*(B.x+C.x) )/(2* (bSlope-aSlope) );
|
||||
center.y = -1*(center.x - (A.x+B.x)/2)/aSlope + (A.y+B.y)/2;
|
||||
|
||||
return center;
|
||||
}
|
||||
|
||||
/** ******************************************************************
|
||||
* Connect to base
|
||||
******************************************************************* */
|
||||
|
|
@ -399,6 +453,8 @@
|
|||
time,
|
||||
round,
|
||||
area2,
|
||||
center2d,
|
||||
center3d,
|
||||
distSq : dist2,
|
||||
distSqv2 : dist2v2,
|
||||
inRange,
|
||||
|
|
|
|||
|
|
@ -1779,8 +1779,8 @@
|
|||
// outputWipeDistance: UC.newInput("wipe", {title:"non-printing move at\close of polygon\nin millimeters", bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM}),
|
||||
sliceSolidMinArea: UC.newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:UC.toFloat, modes:FDM}),
|
||||
outputMinSpeed: UC.newInput(LANG.ad_mins_s, {title:LANG.ad_mins_l, bound:UC.bound(5,200), convert:UC.toFloat, modes:FDM}),
|
||||
outputCoastDist: UC.newInput(LANG.ad_scst_s, {title:LANG.ad_scst_l, bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM}),
|
||||
outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,10000), convert:UC.toFloat, modes:FDM}),
|
||||
outputCoastDist: UC.newInput(LANG.ad_scst_s, {title:LANG.ad_scst_l, bound:UC.bound(0.0,10), convert:UC.toFloat, modes:FDM}),
|
||||
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
||||
zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM}),
|
||||
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM}),
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ kiri.lang['en-us'] = {
|
|||
ad_msol_l: "minimum area (mm^2)\nrequired to keep solid\nmust be > 0.1",
|
||||
ad_mins_s: "min speed",
|
||||
ad_mins_l: "minimum speed\nfor short segments",
|
||||
ad_spol_s: "slow poly",
|
||||
ad_spol_s: "short path",
|
||||
ad_spol_l: "polygons shorter than this\nwill have their print speed\nscaled down to min speed\nin millimeters",
|
||||
ad_zhop_s: "z hop dist",
|
||||
ad_zhop_l: "amount to raise z\non retraction moves\nin millimeters\n0 to disable",
|
||||
|
|
|
|||
Loading…
Reference in a new issue