|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
import { Line } from "../../src/DatabaseServices/Line";
|
|
|
|
|
import { Vector3 } from "three";
|
|
|
|
|
import { IntersectLineAndLine, Intersect } from "../../src/GraphicsSystem/IntersectWith"
|
|
|
|
|
import { Vector3 } from 'three';
|
|
|
|
|
|
|
|
|
|
import { Line } from '../../src/DatabaseServices/Line';
|
|
|
|
|
import { IntersectLineAndLine, IntersectOption } from '../../src/GraphicsSystem/IntersectWith';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -11,16 +12,16 @@ test('直线相交,共线', () =>
|
|
|
|
|
let l2 = new Line(new Vector3(10, 0, 0), new Vector3(15, 0, 0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let pts = IntersectLineAndLine(l1, l2, Intersect.ExtendThis);
|
|
|
|
|
let pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendThis);
|
|
|
|
|
expect(pts.length).toBe(0);
|
|
|
|
|
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, Intersect.OnBothOperands);
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, IntersectOption.OnBothOperands);
|
|
|
|
|
expect(pts.length).toBe(0);
|
|
|
|
|
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, Intersect.ExtendArg);
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendArg);
|
|
|
|
|
expect(pts.length).toBe(1);
|
|
|
|
|
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, Intersect.ExtendBoth);
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendBoth);
|
|
|
|
|
expect(pts.length).toBe(1);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -31,15 +32,15 @@ test('直线相交', () =>
|
|
|
|
|
let l2 = new Line(new Vector3(5, 0, 0), new Vector3(0, 5, 0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let pts = IntersectLineAndLine(l1, l2, Intersect.ExtendThis);
|
|
|
|
|
let pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendThis);
|
|
|
|
|
expect(pts.length).toBe(1);
|
|
|
|
|
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, Intersect.OnBothOperands);
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, IntersectOption.OnBothOperands);
|
|
|
|
|
expect(pts.length).toBe(1);
|
|
|
|
|
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, Intersect.ExtendArg);
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendArg);
|
|
|
|
|
expect(pts.length).toBe(1);
|
|
|
|
|
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, Intersect.ExtendBoth);
|
|
|
|
|
pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendBoth);
|
|
|
|
|
expect(pts.length).toBe(1);
|
|
|
|
|
});
|
|
|
|
|