use 45 degree offset from longest segment as hint angle

This commit is contained in:
Stewart Allen 2017-11-09 11:40:24 -05:00
commit dc008fb28f
3 changed files with 5 additions and 6 deletions

View file

@ -295,7 +295,7 @@ var gs_base_polygon = exports;
};
/**
* add fill angle hinting from longest segment
* hint fill angle hinting from longest segment
*/
PRO.hintFillAngle = function() {
var index = 0,
@ -320,7 +320,6 @@ var gs_base_polygon = exports;
if (longest && this.circularity() >= mincir) {
this.fillang = longest.p1.slopeTo(longest.p2).normal();
// console.log([this.fillang,this.getZ(),this.id]);
}
return this.fillang;

View file

@ -95,7 +95,7 @@ var gs_base_slope = exports;
PRO.invert = function() {
this.dx = -this.dx;
this.dy = -this.dy;
this.angle = 360 - this.angle;//Math.atan2(this.dy, this.dx) * RAD2DEG;
this.angle = 360 - this.angle;
return this;
};

View file

@ -478,7 +478,7 @@ var gs_kiri_slice = exports;
this.tops.forEach(function(top) {
if (top.inner && top.inner.length > 0) {
top.fill_lines = fillArea(top.inner, angle, spacing);
top.fill_lines = fillArea(top.inner, angle, spacing, null, 0.00001);
} else {
top.fill_lines = null;
}
@ -751,8 +751,8 @@ var gs_kiri_slice = exports;
if (angfill.length > 0) {
top.fill_lines_ang = {spacing:spacing,list:[],poly:[]};
angfill.forEach(function(af) {
fillArea([af], af.fillang.angle+90, spacing, top.fill_lines);
top.fill_lines_ang.list.push(af.fillang.angle+90);
fillArea([af], af.fillang.angle + 45, spacing, top.fill_lines);
top.fill_lines_ang.list.push(af.fillang.angle + 45);
top.fill_lines_ang.poly.push(af.clone());
});
}