You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/__test__/Polyline/offset.test.ts

40 lines
1.1 KiB

import { Factory } from "../../src/DatabaseServices/CADFactory";
import { CADFile } from "../../src/DatabaseServices/CADFile";
import { Polyline } from "../../src/DatabaseServices/Polyline";
Factory(Polyline);
test('IKKGK圆与直线补圆弧', () =>
{
let f = new CADFile();
f.Data =
[1, ["Polyline", 1, 1, 5, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -47.808747539346534, 10.92028558763661, 0, 1], 2, 3, [-0.906131771640112, 6.969061295372345], 3.7897716494829594, [4.660056657223795, 6.487252124645892], 0, [18.466397865202012, 17.128892766521286], 0, false]]
f.Read();
let pl = f.ReadObject() as Polyline;
//负1 左边. 禁止补圆弧
let cus = pl.GetOffsetCurves(-1);
f.Data = [];
f.Write(cus.length);
cus.forEach(c => f.WriteObject(c));
expect(f.Data).toMatchSnapshot();
//翻转曲线后测试
pl.Reverse();
cus = pl.GetOffsetCurves(1);
f.Data = [];
f.Write(cus.length);
cus.forEach(c => f.WriteObject(c));
expect(f.Data).toMatchSnapshot();
6 years ago
//圆丢失的问题
cus = pl.GetOffsetCurves(-1.926388985025112);
expect(cus.length).toBe(1);
});