mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 19:43:48 +01:00
Fixed error with handling clipper
no longer need to comment clipper error alerts
This commit is contained in:
parent
3141440c42
commit
ae02c3efc2
@ -4884,8 +4884,8 @@
|
|||||||
else ClipperLib.Clipper.Round = R2; // eg. browser.chrome || browser.firefox || browser.opera
|
else ClipperLib.Clipper.Round = R2; // eg. browser.chrome || browser.firefox || browser.opera
|
||||||
ClipperLib.Clipper.TopX = function (edge, currentY)
|
ClipperLib.Clipper.TopX = function (edge, currentY)
|
||||||
{
|
{
|
||||||
//if (edge.Bot == edge.Curr) console.warn ("edge.Bot = edge.Curr");
|
//if (edge.Bot == edge.Curr) alert ("edge.Bot = edge.Curr");
|
||||||
//if (edge.Bot == edge.Top) console.warn ("edge.Bot = edge.Top");
|
//if (edge.Bot == edge.Top) alert ("edge.Bot = edge.Top");
|
||||||
if (currentY == edge.Top.Y)
|
if (currentY == edge.Top.Y)
|
||||||
return edge.Top.X;
|
return edge.Top.X;
|
||||||
return edge.Bot.X + ClipperLib.Clipper.Round(edge.Dx * (currentY - edge.Bot.Y));
|
return edge.Bot.X + ClipperLib.Clipper.Round(edge.Dx * (currentY - edge.Bot.Y));
|
||||||
@ -6596,7 +6596,7 @@
|
|||||||
}
|
}
|
||||||
catch (err)
|
catch (err)
|
||||||
{
|
{
|
||||||
//console.warn(err.message);
|
console.warn(err.message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"bottomThickness": 0.4,
|
"bottomThickness": 0.4,
|
||||||
"topThickness": 0.8,
|
"topThickness": 0.8,
|
||||||
"shellThickness": 0.4,
|
"shellThickness": 0.4,
|
||||||
"brimOffset": 5.0,
|
"brimOffset": 4.0,
|
||||||
"fillGridSize": 5.0,
|
"fillGridSize": 5.0,
|
||||||
"infillOverlap": 0.5,
|
"infillOverlap": 0.5,
|
||||||
"travelSpeed": 200.0,
|
"travelSpeed": 200.0,
|
||||||
|
12
src/paths.js
12
src/paths.js
@ -32,14 +32,16 @@ D3D.Paths.prototype.setPaths = function (paths) {
|
|||||||
D3D.Paths.prototype._clip = function (path, type) {
|
D3D.Paths.prototype._clip = function (path, type) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var solution = new ClipperLib.Paths();
|
var solution = new ClipperLib.PolyTree();
|
||||||
|
|
||||||
var clipper = new ClipperLib.Clipper();
|
var clipper = new ClipperLib.Clipper();
|
||||||
clipper.AddPaths(this, ClipperLib.PolyType.ptSubject, this.closed);
|
clipper.AddPaths(this, ClipperLib.PolyType.ptSubject, this.closed);
|
||||||
clipper.AddPaths(path, ClipperLib.PolyType.ptClip, path.closed);
|
clipper.AddPaths(path, ClipperLib.PolyType.ptClip, path.closed);
|
||||||
clipper.Execute(type, solution);
|
clipper.Execute(type, solution);
|
||||||
|
|
||||||
return new D3D.Paths(solution, this.closed);
|
var paths = this.closed ? ClipperLib.Clipper.ClosedPathsFromPolyTree(solution) : ClipperLib.Clipper.OpenPathsFromPolyTree(solution);
|
||||||
|
|
||||||
|
return new D3D.Paths(paths, this.closed);
|
||||||
};
|
};
|
||||||
D3D.Paths.prototype.union = function (path) {
|
D3D.Paths.prototype.union = function (path) {
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -236,12 +238,14 @@ D3D.Paths.prototype.draw = function (context, color) {
|
|||||||
//context.fillText(i, point.X*2, point.Y*2);
|
//context.fillText(i, point.X*2, point.Y*2);
|
||||||
|
|
||||||
context.beginPath();
|
context.beginPath();
|
||||||
var length = this.closed ? (shape.length + 1) : shape.length;
|
for (var j = 0; j < shape.length; j ++) {
|
||||||
for (var j = 0; j < length; j ++) {
|
|
||||||
var point = shape[j % shape.length];
|
var point = shape[j % shape.length];
|
||||||
|
|
||||||
context.lineTo(point.X*2, point.Y*2);
|
context.lineTo(point.X*2, point.Y*2);
|
||||||
}
|
}
|
||||||
|
if (this.closed) {
|
||||||
|
context.closePath();
|
||||||
|
}
|
||||||
context.stroke();
|
context.stroke();
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user