|
|
|
@ -2,6 +2,7 @@ import { Vector2, Vector3 } from 'three';
|
|
|
|
|
|
|
|
|
|
import { IsPointInPolyLine } from '../../src/DatabaseServices/PointInPolyline';
|
|
|
|
|
import { Polyline } from '../../src/DatabaseServices/Polyline';
|
|
|
|
|
import { CADFile } from '../../src/DatabaseServices/CADFile';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('点在多段线内', () =>
|
|
|
|
@ -141,4 +142,26 @@ describe("", () =>
|
|
|
|
|
|
|
|
|
|
expect(IsPointInPolyLine(pl, new Vector3(5, 2))).toBeTruthy();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('点在曲线外精度问题', () =>
|
|
|
|
|
{
|
|
|
|
|
let plData = [["Polyline", 1, 1, 4317, false, 3, -1,
|
|
|
|
|
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
|
|
|
2, 5,
|
|
|
|
|
[-3, 3.6739403974420594e-16], 0.9999999999999999,
|
|
|
|
|
[3, 3.6739403974420594e-16], 0, [3, 10], 0.9999999999999999,
|
|
|
|
|
[-3, 10], 0, [-3, -3.6739403974420594e-16], 0,
|
|
|
|
|
false]];
|
|
|
|
|
|
|
|
|
|
let f = new CADFile();
|
|
|
|
|
f.Data = plData;
|
|
|
|
|
let pl = f.ReadObject(undefined) as Polyline;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let p = new Vector3(-3, -0.16000000000000014, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(pl.PtInCurve(p)).toBeFalsy();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|