|
|
|
@ -2,6 +2,7 @@ import { Vector2, Vector3 } from 'three';
|
|
|
|
|
|
|
|
|
|
import { Polyline } from '../../src/DatabaseServices/Polyline';
|
|
|
|
|
import { equal, equaln } from '../../src/Geometry/GeUtils';
|
|
|
|
|
import { CADFile } from '../../src/DatabaseServices/CADFile';
|
|
|
|
|
|
|
|
|
|
test("多段线点获取参数", () =>
|
|
|
|
|
{
|
|
|
|
@ -470,3 +471,19 @@ describe('多段线', () =>
|
|
|
|
|
expect(pl.StartPoint).toEqual(new Vector3(0, 10, 0))
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('最近点参数刚好在端点上', () =>
|
|
|
|
|
{
|
|
|
|
|
let f = new CADFile();
|
|
|
|
|
f.Data = [1, ["Polyline", 1, 1, 11, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 15.725529745042493, -3.9968028886505635e-15, 0, 1], 2, 3, [13.07875354107649, 3.8181303116147296], 0, [18.159206798866855, 3.8181303116147296], 0.664293193717279, [18.159206798866855, -1.4844192634560907], -0.10977222864644352, false]];
|
|
|
|
|
f.Read();
|
|
|
|
|
|
|
|
|
|
let pl = f.ReadObject() as Polyline;
|
|
|
|
|
let p = new Vector3(33.88473654390935, 3.8181303116147256, 0);
|
|
|
|
|
|
|
|
|
|
let cp = pl.GetClosestPointTo(p, false);
|
|
|
|
|
|
|
|
|
|
let param = pl.GetParamAtPoint(cp);
|
|
|
|
|
|
|
|
|
|
expect(equaln(param, 1)).toBeTruthy();
|
|
|
|
|
});
|
|
|
|
|