mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +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
|
||||
ClipperLib.Clipper.TopX = function (edge, currentY)
|
||||
{
|
||||
//if (edge.Bot == edge.Curr) console.warn ("edge.Bot = edge.Curr");
|
||||
//if (edge.Bot == edge.Top) console.warn ("edge.Bot = edge.Top");
|
||||
//if (edge.Bot == edge.Curr) alert ("edge.Bot = edge.Curr");
|
||||
//if (edge.Bot == edge.Top) alert ("edge.Bot = edge.Top");
|
||||
if (currentY == edge.Top.Y)
|
||||
return edge.Top.X;
|
||||
return edge.Bot.X + ClipperLib.Clipper.Round(edge.Dx * (currentY - edge.Bot.Y));
|
||||
@ -6596,7 +6596,7 @@
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
//console.warn(err.message);
|
||||
console.warn(err.message);
|
||||
}
|
||||
};
|
||||
// ---------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
"bottomThickness": 0.4,
|
||||
"topThickness": 0.8,
|
||||
"shellThickness": 0.4,
|
||||
"brimOffset": 5.0,
|
||||
"brimOffset": 4.0,
|
||||
"fillGridSize": 5.0,
|
||||
"infillOverlap": 0.5,
|
||||
"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) {
|
||||
'use strict';
|
||||
|
||||
var solution = new ClipperLib.Paths();
|
||||
var solution = new ClipperLib.PolyTree();
|
||||
|
||||
var clipper = new ClipperLib.Clipper();
|
||||
clipper.AddPaths(this, ClipperLib.PolyType.ptSubject, this.closed);
|
||||
clipper.AddPaths(path, ClipperLib.PolyType.ptClip, path.closed);
|
||||
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) {
|
||||
'use strict';
|
||||
@ -236,12 +238,14 @@ D3D.Paths.prototype.draw = function (context, color) {
|
||||
//context.fillText(i, point.X*2, point.Y*2);
|
||||
|
||||
context.beginPath();
|
||||
var length = this.closed ? (shape.length + 1) : shape.length;
|
||||
for (var j = 0; j < length; j ++) {
|
||||
for (var j = 0; j < shape.length; j ++) {
|
||||
var point = shape[j % shape.length];
|
||||
|
||||
context.lineTo(point.X*2, point.Y*2);
|
||||
}
|
||||
if (this.closed) {
|
||||
context.closePath();
|
||||
}
|
||||
context.stroke();
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user