Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
01cac616f5 | ||
![]() |
6ef1e8d8b0 |
33
api.cjs.js
33
api.cjs.js
@@ -6372,7 +6372,7 @@ class Contour {
|
|||||||
hasEqualCus = fastEqualCurve(cu, pl, COMBINE_FUZZ);
|
hasEqualCus = fastEqualCurve(cu, pl, COMBINE_FUZZ);
|
||||||
if (hasEqualCus) {
|
if (hasEqualCus) {
|
||||||
//方向相同
|
//方向相同
|
||||||
if (equalv3(cu.GetFirstDeriv(cu.MidParam).normalize(), pl.GetFirstDeriv(pl.MidParam).normalize(), 1e-3)
|
if (equalv3(cu.GetFirstDeriv(cu.MidParam).normalize(), pl.GetFirstDeriv(pl.MidParam).normalize(), 1e-2)
|
||||||
=== isEqualNormal) {
|
=== isEqualNormal) {
|
||||||
unionList.push(pl);
|
unionList.push(pl);
|
||||||
intersectionList.push(pl);
|
intersectionList.push(pl);
|
||||||
@@ -23079,10 +23079,10 @@ function GetMaxAreaFn(rects) {
|
|||||||
return Max(rects, (t1, t2) => t2[0] > t1[0]);
|
return Max(rects, (t1, t2) => t2[0] > t1[0]);
|
||||||
}
|
}
|
||||||
function GetMaxWidthFn(rects) {
|
function GetMaxWidthFn(rects) {
|
||||||
return Max(rects, (t1, t2) => t2[5] > t1[5]);
|
return Max(rects, (t1, t2) => t2[5] === t1[5] ? t2[6] > t1[6] : t2[5] > t1[5]);
|
||||||
}
|
}
|
||||||
function GetMaxHeightFn(rects) {
|
function GetMaxHeightFn(rects) {
|
||||||
return Max(rects, (t1, t2) => t2[6] > t1[6]);
|
return Max(rects, (t1, t2) => t2[6] === t1[6] ? t2[6] > t1[6] : t2[5] > t1[5]);
|
||||||
}
|
}
|
||||||
//最大内接矩形
|
//最大内接矩形
|
||||||
//1.分析盒子
|
//1.分析盒子
|
||||||
@@ -23304,7 +23304,8 @@ class LargestInteriorRectangle {
|
|||||||
rects.push([area, down[i], j, xCount, yCount, width, height]);
|
rects.push([area, down[i], j, xCount, yCount, width, height]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (rects.length) {
|
// while (rects.length)
|
||||||
|
if (rects.length) {
|
||||||
let maxIndex = this.GetMaxRectIndexFn(rects);
|
let maxIndex = this.GetMaxRectIndexFn(rects);
|
||||||
let [area, maxXIndex, maxYIndex, xCount, yCount] = rects[maxIndex];
|
let [area, maxXIndex, maxYIndex, xCount, yCount] = rects[maxIndex];
|
||||||
let xMax = xs[maxXIndex];
|
let xMax = xs[maxXIndex];
|
||||||
@@ -23320,16 +23321,20 @@ class LargestInteriorRectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果有被标记的方块,则删除它
|
//如果有被标记的方块,则删除它
|
||||||
arrayRemoveIf(rects, rect => {
|
//某些情况不适合这个算法,移除了它,保证结果正确性
|
||||||
let [area, maxX, maxY, xCount, yCount] = rect;
|
// arrayRemoveIf(rects, rect =>
|
||||||
for (let i = 0; i < xCount; i++) {
|
// {
|
||||||
for (let j = 0; j < yCount; j++) {
|
// let [area, maxX, maxY, xCount, yCount] = rect;
|
||||||
if (!matrix[maxX - 1 - i][maxY - j])
|
// for (let i = 0; i < xCount; i++)
|
||||||
return true;
|
// {
|
||||||
}
|
// for (let j = 0; j < yCount; j++)
|
||||||
}
|
// {
|
||||||
return false;
|
// if (!matrix[maxX - 1 - i][maxY - j])
|
||||||
});
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let maxRects = [];
|
let maxRects = [];
|
||||||
|
File diff suppressed because one or more lines are too long
33
api.esm.js
33
api.esm.js
@@ -6363,7 +6363,7 @@ class Contour {
|
|||||||
hasEqualCus = fastEqualCurve(cu, pl, COMBINE_FUZZ);
|
hasEqualCus = fastEqualCurve(cu, pl, COMBINE_FUZZ);
|
||||||
if (hasEqualCus) {
|
if (hasEqualCus) {
|
||||||
//方向相同
|
//方向相同
|
||||||
if (equalv3(cu.GetFirstDeriv(cu.MidParam).normalize(), pl.GetFirstDeriv(pl.MidParam).normalize(), 1e-3)
|
if (equalv3(cu.GetFirstDeriv(cu.MidParam).normalize(), pl.GetFirstDeriv(pl.MidParam).normalize(), 1e-2)
|
||||||
=== isEqualNormal) {
|
=== isEqualNormal) {
|
||||||
unionList.push(pl);
|
unionList.push(pl);
|
||||||
intersectionList.push(pl);
|
intersectionList.push(pl);
|
||||||
@@ -23070,10 +23070,10 @@ function GetMaxAreaFn(rects) {
|
|||||||
return Max(rects, (t1, t2) => t2[0] > t1[0]);
|
return Max(rects, (t1, t2) => t2[0] > t1[0]);
|
||||||
}
|
}
|
||||||
function GetMaxWidthFn(rects) {
|
function GetMaxWidthFn(rects) {
|
||||||
return Max(rects, (t1, t2) => t2[5] > t1[5]);
|
return Max(rects, (t1, t2) => t2[5] === t1[5] ? t2[6] > t1[6] : t2[5] > t1[5]);
|
||||||
}
|
}
|
||||||
function GetMaxHeightFn(rects) {
|
function GetMaxHeightFn(rects) {
|
||||||
return Max(rects, (t1, t2) => t2[6] > t1[6]);
|
return Max(rects, (t1, t2) => t2[6] === t1[6] ? t2[6] > t1[6] : t2[5] > t1[5]);
|
||||||
}
|
}
|
||||||
//最大内接矩形
|
//最大内接矩形
|
||||||
//1.分析盒子
|
//1.分析盒子
|
||||||
@@ -23295,7 +23295,8 @@ class LargestInteriorRectangle {
|
|||||||
rects.push([area, down[i], j, xCount, yCount, width, height]);
|
rects.push([area, down[i], j, xCount, yCount, width, height]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (rects.length) {
|
// while (rects.length)
|
||||||
|
if (rects.length) {
|
||||||
let maxIndex = this.GetMaxRectIndexFn(rects);
|
let maxIndex = this.GetMaxRectIndexFn(rects);
|
||||||
let [area, maxXIndex, maxYIndex, xCount, yCount] = rects[maxIndex];
|
let [area, maxXIndex, maxYIndex, xCount, yCount] = rects[maxIndex];
|
||||||
let xMax = xs[maxXIndex];
|
let xMax = xs[maxXIndex];
|
||||||
@@ -23311,16 +23312,20 @@ class LargestInteriorRectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果有被标记的方块,则删除它
|
//如果有被标记的方块,则删除它
|
||||||
arrayRemoveIf(rects, rect => {
|
//某些情况不适合这个算法,移除了它,保证结果正确性
|
||||||
let [area, maxX, maxY, xCount, yCount] = rect;
|
// arrayRemoveIf(rects, rect =>
|
||||||
for (let i = 0; i < xCount; i++) {
|
// {
|
||||||
for (let j = 0; j < yCount; j++) {
|
// let [area, maxX, maxY, xCount, yCount] = rect;
|
||||||
if (!matrix[maxX - 1 - i][maxY - j])
|
// for (let i = 0; i < xCount; i++)
|
||||||
return true;
|
// {
|
||||||
}
|
// for (let j = 0; j < yCount; j++)
|
||||||
}
|
// {
|
||||||
return false;
|
// if (!matrix[maxX - 1 - i][maxY - j])
|
||||||
});
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let maxRects = [];
|
let maxRects = [];
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user