更新测试代码和测试轮廓显示

pull/68/head
ChenX_AMD 6 years ago
parent 4c254809ef
commit 31f62c6280

@ -10,7 +10,8 @@ function loadFile(data)
let file = new CADFile();
file.Data = data;
let cus: Curve[] = [];
for (let i = 0; i < file.Data.length; i++)
let count = file.Read();
for (let i = 0; i < count; i++)
{
cus.push(file.ReadObject(undefined) as Curve);
}
@ -57,8 +58,8 @@ test('IKKGK圆与直线补圆弧', () =>
test('多段线偏移测试1', () =>
{
let data = [["Polyline", 1, 1, 3, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [6.059716713881022, 3.983456090651555], 1.1217395195062214, [6.383002832861191, 4.064022662889515], 0, [4.929178470254959, 8.399433427762037], 1.2642365052895204, [5.750708215297452, 4.050991501416427], 0.7171789779484218, true]];
let data =
[1, ["Polyline", 1, 1, 3, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [6.059716713881022, 3.983456090651555], 1.1217395195062214, [6.383002832861191, 4.064022662889515], 0, [4.929178470254959, 8.399433427762037], 1.2642365052895204, [5.750708215297452, 4.050991501416427], 0.7171789779484218, true]]
let cus = loadFile(data);
for (let i = 0; i < 10; i += 0.01)
{
@ -75,7 +76,8 @@ test('多段线偏移测试1', () =>
})
test('多段线偏移测试2', () =>
{
let data = [["Polyline", 1, 1, 734, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [8.176442643449754, 4.003694129881114], 0.6482011490054378, [8.554554536583165, 4.090460859042256], 0, [7.7292787370841225, 8.733182129315965], 0, [7.8227800907745895, 4.037582052934876], 1.223388515290821, true]];
let data =
[1, ["Polyline", 1, 1, 734, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [8.176442643449754, 4.003694129881114], 0.6482011490054378, [8.554554536583165, 4.090460859042256], 0, [7.7292787370841225, 8.733182129315965], 0, [7.8227800907745895, 4.037582052934876], 1.223388515290821, true]]
let cus = loadFile(data);
expect(cus[0].GetOffsetCurves(-0.1799).length).toBe(2);
@ -99,7 +101,8 @@ test('多段线偏移测试2', () =>
})
test('多段线偏移测试3', () =>
{
let data = [["Polyline", 1, 1, 1172, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [12.52535684411379, 4.512623511896158], 0.39558516940595195, [13.121416971132648, 4.487590129452889], 0, [12.414545456418505, 8.796498405316765], 0, [12.015990240675425, 8.743859037199755], 0, [12.015990240675425, 4.4951100391838885], 0.8508932598252141, true]];
let data =
[1, ["Polyline", 1, 1, 1172, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 5, [12.52535684411379, 4.512623511896158], 0.39558516940595195, [13.121416971132648, 4.487590129452889], 0, [12.414545456418505, 8.796498405316765], 0, [12.015990240675425, 8.743859037199755], 0, [12.015990240675425, 4.4951100391838885], 0.8508932598252141, true]]
let cus = loadFile(data);
for (let i = 0; i < 10; i += 1)

@ -1,12 +1,12 @@
import { Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { arrayLast, arrayRemoveIf, arraySortByNumber } from "../../Common/ArrayExt";
import { Circle } from "../../DatabaseServices/Circle";
import { Contour } from "../../DatabaseServices/Contour";
import { Curve } from "../../DatabaseServices/Curve";
import { Polyline } from "../../DatabaseServices/Polyline";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { arraySortByNumber, arrayLast, arrayRemoveIf } from "../../Common/ArrayExt";
import { equaln } from "../../Geometry/GeUtils";
import { IsPtsAllOutOrOnReg } from "../../GraphicsSystem/BoolOperateUtils";

@ -12,7 +12,6 @@ import { equal, equaln } from "../Geometry/GeUtils";
import { EBox, SortEntityByBox } from "../Geometry/SortEntityByBox";
import { IsPtsAllOutOrOnReg } from "./BoolOperateUtils";
import { IntersectOption } from "./IntersectWith";
import { testContours } from "../Add-on/testEntity/TestCurve";
interface offestRes
{
@ -53,7 +52,7 @@ export class PolyOffestUtil
// console.time("join")
this.TrimAndBuildContour(offres);
// console.timeEnd("join")
testContours(this.m_Contours);
// testContours(this.m_Contours);
//裁剪
let { boxCurves, outputCus } = this.trimByContours(this.m_RetCurves);
// // 优化裁剪后的曲线
@ -64,6 +63,9 @@ export class PolyOffestUtil
// // 如果源线段闭合只保留闭合的部分
// if (this.m_Polyline.IsClose)
// return this.m_RetCurves.filter(c => c.IsClose);
this.m_Contours.forEach(c => { c.Outline.ColorIndex = 2 });
this.m_RetCurves.push(...this.m_Contours.map(c => c.Outline))
return this.m_RetCurves;
}

Loading…
Cancel
Save