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__/Geometry/intersect.test.ts

31 lines
768 B

import * as THREE from 'three';
import { IntersectLAndL } from '../../src/GraphicsSystem/IntersectWith';
test('相交测试', () =>
{
let p1 = new THREE.Vector3(0, 0, 0);
let p2 = new THREE.Vector3(1, 0, 0);
let p3 = new THREE.Vector3(0.5, 0.5, 0);
let p4 = new THREE.Vector3(0.5, 1, 0);
let p5 = new THREE.Vector3(3, 0, 0);
let p6 = new THREE.Vector3(6, 0, 0);
let res = IntersectLAndL(p1, p2, p3, p4);/*?*/
expect(res).toMatchSnapshot();
res = IntersectLAndL(p1, p2, p5, p6);/*?*/
expect(res).toMatchSnapshot();
let ins = IntersectLAndL(
new THREE.Vector3(0, 5),
new THREE.Vector3(5, 5),
new THREE.Vector3(0.5, 1),
new THREE.Vector3(0.5, 8));
expect(ins).toMatchSnapshot();
}
)