修复:封边对应错误,初始化testm间距200,多段线连接时尾部优先

pull/2290/MERGE
ChenX 1 year ago
parent e207cdce90
commit 45aabd7577

@ -162,10 +162,6 @@ CADDbBoard {
"H": 10,
"L": 179.17946854625225,
"Pts": Array [
Vector2 {
"x": -1.4210854715202004e-14,
"y": 89.58973427312614,
},
Vector2 {
"x": 179.17946854625222,
"y": 89.58973427312613,
@ -174,6 +170,10 @@ CADDbBoard {
"x": -1.4210854715202004e-14,
"y": 89.58973427312614,
},
Vector2 {
"x": 179.17946854625222,
"y": 89.58973427312613,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [
@ -195,10 +195,6 @@ CADDbBoard {
"H": 10,
"L": 139.17946854625225,
"Pts": Array [
Vector2 {
"x": -1.4210854715202004e-14,
"y": 69.58973427312614,
},
Vector2 {
"x": 139.17946854625222,
"y": 69.58973427312613,
@ -207,6 +203,10 @@ CADDbBoard {
"x": -1.4210854715202004e-14,
"y": 69.58973427312614,
},
Vector2 {
"x": 139.17946854625222,
"y": 69.58973427312613,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],
@ -323,10 +323,6 @@ CADDbBoard {
"H": 10,
"L": 116.79966683283226,
"Pts": Array [
Vector2 {
"x": 7.105427357601002e-15,
"y": 58.39983341641608,
},
Vector2 {
"x": 116.79966683283226,
"y": 58.39983341641607,
@ -335,6 +331,10 @@ CADDbBoard {
"x": 7.105427357601002e-15,
"y": 58.39983341641608,
},
Vector2 {
"x": 116.79966683283226,
"y": 58.39983341641607,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],
@ -394,10 +394,6 @@ CADDbBoard {
"H": 18,
"L": 4408.678960586129,
"Pts": Array [
Vector2 {
"x": 0,
"y": 2204.3394802930648,
},
Vector2 {
"x": 4408.678960586129,
"y": 2204.3394802930643,
@ -406,6 +402,10 @@ CADDbBoard {
"x": 0,
"y": 2204.3394802930648,
},
Vector2 {
"x": 4408.678960586129,
"y": 2204.3394802930643,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [
@ -427,10 +427,6 @@ CADDbBoard {
"H": 5,
"L": 633.2307692307686,
"Pts": Array [
Vector2 {
"x": 0,
"y": 316.61538461538436,
},
Vector2 {
"x": 633.2307692307686,
"y": 316.6153846153843,
@ -439,6 +435,10 @@ CADDbBoard {
"x": 0,
"y": 316.61538461538436,
},
Vector2 {
"x": 633.2307692307686,
"y": 316.6153846153843,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],
@ -477,10 +477,6 @@ CADDbBoard {
"H": 5,
"L": 557.8461538461524,
"Pts": Array [
Vector2 {
"x": 0,
"y": 278.9230769230763,
},
Vector2 {
"x": 557.8461538461524,
"y": 278.9230769230762,
@ -489,6 +485,10 @@ CADDbBoard {
"x": 0,
"y": 278.9230769230763,
},
Vector2 {
"x": 557.8461538461524,
"y": 278.9230769230762,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],
@ -771,10 +771,6 @@ CADDbBoard {
"H": 18,
"L": 189.0974955047293,
"Pts": Array [
Vector2 {
"x": -1.4210854715202004e-14,
"y": 94.54874775236478,
},
Vector2 {
"x": 189.0974955047293,
"y": 94.54874775236476,
@ -783,6 +779,10 @@ CADDbBoard {
"x": -1.4210854715202004e-14,
"y": 94.54874775236478,
},
Vector2 {
"x": 189.0974955047293,
"y": 94.54874775236476,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],
@ -985,10 +985,6 @@ CADDbBoard {
"H": 10,
"L": 179.17946854625225,
"Pts": Array [
Vector2 {
"x": -1.4210854715202004e-14,
"y": 89.58973427312614,
},
Vector2 {
"x": 179.17946854625222,
"y": 89.58973427312613,
@ -997,6 +993,10 @@ CADDbBoard {
"x": -1.4210854715202004e-14,
"y": 89.58973427312614,
},
Vector2 {
"x": 179.17946854625222,
"y": 89.58973427312613,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [
@ -1018,10 +1018,6 @@ CADDbBoard {
"H": 10,
"L": 139.17946854625225,
"Pts": Array [
Vector2 {
"x": -1.4210854715202004e-14,
"y": 69.58973427312614,
},
Vector2 {
"x": 139.17946854625222,
"y": 69.58973427312613,
@ -1030,6 +1026,10 @@ CADDbBoard {
"x": -1.4210854715202004e-14,
"y": 69.58973427312614,
},
Vector2 {
"x": 139.17946854625222,
"y": 69.58973427312613,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],
@ -1146,10 +1146,6 @@ CADDbBoard {
"H": 10,
"L": 116.79966683283226,
"Pts": Array [
Vector2 {
"x": 7.105427357601002e-15,
"y": 58.39983341641608,
},
Vector2 {
"x": 116.79966683283226,
"y": 58.39983341641607,
@ -1158,6 +1154,10 @@ CADDbBoard {
"x": 7.105427357601002e-15,
"y": 58.39983341641608,
},
Vector2 {
"x": 116.79966683283226,
"y": 58.39983341641607,
},
],
"SubBoardAssoc": null,
"SubBoardLocal": Array [],

@ -9,10 +9,10 @@ Array [
"size": 1,
},
Object {
"size": 0,
"size": 1,
},
Object {
"size": 1,
"size": 0,
},
Object {
"size": 1,

@ -176,7 +176,7 @@ exports[`点在多段线内 1`] = `1`;
exports[`点在多段线内 2`] = `"1589.94630"`;
exports[`简单图形因为点在线内算法错误导致的丢失 1`] = `8.675189454805244`;
exports[`简单图形因为点在线内算法错误导致的丢失 1`] = `8.675189454805246`;
exports[`简单图形因为点在线内算法错误导致的丢失 2`] = `8.252841733482933`;
@ -196,7 +196,7 @@ exports[`精度过高导致的曲线丢失 4`] = `"97661.61008"`;
exports[`精度过高导致直连失败 1`] = `1`;
exports[`精度过高导致直连失败 2`] = `"32040.01390"`;
exports[`精度过高导致直连失败 2`] = `"32040.01391"`;
exports[`精度过高导致直连失败 3`] = `1`;

@ -20,6 +20,6 @@ exports[`补充bug测试#IKWGF 9`] = `2.168984971098264`;
exports[`补充bug测试#IKWGF 10`] = `0.39474593983901435`;
exports[`补充bug测试#IKWGF 11`] = `10.69886845125427`;
exports[`补充bug测试#IKWGF 11`] = `10.698868451254269`;
exports[`补充bug测试#IKWGF 12`] = `1.0803374679586235`;

@ -80,44 +80,44 @@ exports[`顶线分段测试 闭合圆弧 8`] = `11360.440190078047`;
exports[`顶线分段测试 闭合圆弧 9`] = `4713.85413305274`;
exports[`顶线分段测试 闭合直线 1`] = `2152.655017660556`;
exports[`顶线分段测试 闭合直线 1`] = `1411.8807330899142`;
exports[`顶线分段测试 闭合直线 2`] = `1157.9339062625943`;
exports[`顶线分段测试 闭合直线 2`] = `2152.655017660556`;
exports[`顶线分段测试 闭合直线 3`] = `1049.373745402737`;
exports[`顶线分段测试 闭合直线 3`] = `1157.9339062625943`;
exports[`顶线分段测试 闭合直线 4`] = `1007.7933435525692`;
exports[`顶线分段测试 闭合直线 4`] = `1049.373745402737`;
exports[`顶线分段测试 闭合直线 5`] = `1867.3971281882991`;
exports[`顶线分段测试 闭合直线 5`] = `1007.7933435525692`;
exports[`顶线分段测试 闭合直线 6`] = `711.6950394345639`;
exports[`顶线分段测试 闭合直线 6`] = `1867.3971281882991`;
exports[`顶线分段测试 闭合直线 7`] = `1109.7095976240196`;
exports[`顶线分段测试 闭合直线 7`] = `711.6950394345639`;
exports[`顶线分段测试 闭合直线 8`] = `1099.4488714706863`;
exports[`顶线分段测试 闭合直线 8`] = `1109.7095976240196`;
exports[`顶线分段测试 闭合直线 9`] = `1411.8807330899142`;
exports[`顶线分段测试 闭合直线 9`] = `1099.4488714706863`;
exports[`顶线分段测试 闭合直线2 1`] = `1773.6483926638098`;
exports[`顶线分段测试 闭合直线2 1`] = `2378.824808973823`;
exports[`顶线分段测试 闭合直线2 2`] = `1327.0314994557618`;
exports[`顶线分段测试 闭合直线2 2`] = `1773.6483926638098`;
exports[`顶线分段测试 闭合直线2 3`] = `1593.058941817248`;
exports[`顶线分段测试 闭合直线2 3`] = `1327.0314994557618`;
exports[`顶线分段测试 闭合直线2 4`] = `1234.7942063629366`;
exports[`顶线分段测试 闭合直线2 4`] = `1593.058941817248`;
exports[`顶线分段测试 闭合直线2 5`] = `1657.0432133817048`;
exports[`顶线分段测试 闭合直线2 5`] = `1234.7942063629366`;
exports[`顶线分段测试 闭合直线2 6`] = `1812.9802996395224`;
exports[`顶线分段测试 闭合直线2 6`] = `1657.0432133817048`;
exports[`顶线分段测试 闭合直线2 7`] = `1366.7470210563024`;
exports[`顶线分段测试 闭合直线2 7`] = `1812.9802996395224`;
exports[`顶线分段测试 闭合直线2 8`] = `2149.6670549035985`;
exports[`顶线分段测试 闭合直线2 8`] = `1366.7470210563024`;
exports[`顶线分段测试 闭合直线2 9`] = `1980.1205315844518`;
exports[`顶线分段测试 闭合直线2 9`] = `2149.6670549035985`;
exports[`顶线分段测试 闭合直线2 10`] = `1613.0589418172485`;
exports[`顶线分段测试 闭合直线2 10`] = `1980.1205315844518`;
exports[`顶线分段测试 闭合直线2 11`] = `1665.8400676945942`;
exports[`顶线分段测试 闭合直线2 11`] = `1613.0589418172485`;
exports[`顶线分段测试 闭合直线2 12`] = `2378.824808973823`;
exports[`顶线分段测试 闭合直线2 12`] = `1665.8400676945942`;

@ -7,7 +7,7 @@ import { FixIndex } from '../../Common/Utils';
import { ObjectSnapMode } from '../../Editor/ObjectSnapMode';
import { Box3Ext } from '../../Geometry/Box';
import { CreatePolylinePath } from '../../Geometry/CreatePolylinePath';
import { AsVector2, AsVector3, equaln, equalv2, equalv3, MatrixIsIdentityCS } from '../../Geometry/GeUtils';
import { AsVector2, AsVector3, MatrixIsIdentityCS, equaln, equalv2, equalv3 } from '../../Geometry/GeUtils';
import { IntersectOption, IntersectPolylineAndCurve } from '../../GraphicsSystem/IntersectWith';
import { OffsetPolyline } from '../../GraphicsSystem/OffsetPolyline';
import { Factory } from '../CADFactory';
@ -897,6 +897,18 @@ export class Polyline extends Curve
let linkType = LinkType.None;
if (epspDisSq < minDis)
{
linkType = LinkType.EpSp;
minDis = epspDisSq;
}
if (epepDisSq < minDis)
{
linkType = LinkType.EpEp;
minDis = epepDisSq;
}
if (spspDisSq < minDis)
{
linkType = LinkType.SpSp;
@ -909,15 +921,6 @@ export class Polyline extends Curve
minDis = spepDisSq;
}
if (epspDisSq < minDis)
{
linkType = LinkType.EpSp;
minDis = epspDisSq;
}
if (epepDisSq < minDis)
linkType = LinkType.EpEp;
if (linkType === LinkType.None)
return Status.False;
@ -1050,12 +1053,14 @@ export class Polyline extends Curve
return pl;
}
/**首尾相连的曲线直接连接 */
static FastCombine(curves: Curve[], tolerance = 1e-5): Polyline | undefined
static FastCombine(curves: Curve[], tolerance = 1e-5, computOCS = true): Polyline | undefined
{
if (!curves || curves.length === 0) return;
let pl = new Polyline;
if (computOCS)
pl.OCS = ComputerCurvesNormalOCS(curves);
let ocsInv = pl.OCSInv;

@ -95,7 +95,7 @@ export class UserConfig implements IConfigStore
@observable isModifyMaterial: boolean = true;//右侧工具栏应用时覆盖新的材质
@observable isHighlightMaterial: boolean = true;//亮显材质球
@observable cabinetSpacing: number = 1000; //柜子移动到0点配置 柜子间距
@observable testModeSpacing = 50; //模拟走刀图形间距
@observable testModeSpacing = 200; //模拟走刀图形间距
@observable ConceptualEdgeColor = 7;//概念线框的颜色
ConceptualOpacity = 1;//概念透明的透明度

@ -286,6 +286,7 @@ class OffsetPolyline2 extends OffsetPolyline
/**
* ()()
* ()
* GetSealedBoardContour
*/
export function GetBoardContour(br: Board): ExtrudeContourCurve | undefined
{
@ -297,13 +298,20 @@ export function GetBoardContour(br: Board): ExtrudeContourCurve | undefined
if (curves.length === 1 && curves[0] instanceof Circle)
return curves[0];
let brContour = Polyline.Combine(curves, 1e-3);
let allCurvs: Curve[] = [];
for (let c of curves)
if (c instanceof Polyline)
allCurvs.push(...c.Explode());
else
allCurvs.push(c);
let brContour = Polyline.FastCombine(allCurvs, 1e-4, false);
return brContour;
}
/**
* ()()
* GetBoardContour
*/
export function GetSealedBoardContour(br: Board): BrSealedData | undefined
{
@ -324,9 +332,13 @@ export function GetSealedBoardContour(br: Board): BrSealedData | undefined
return res;
}
let brContour = new Polyline;
let allCurvs: Curve[] = [];
for (let c of curves)
brContour.Join(c);
if (c instanceof Polyline)
allCurvs.push(...c.Explode());
else
allCurvs.push(c);
let brContour = Polyline.FastCombine(allCurvs, 1e-4, false);
let dir = Math.sign(brContour.Area2);

Loading…
Cancel
Save