Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 694 Bytes

File metadata and controls

37 lines (24 loc) · 694 Bytes

Install

npm install @lunit/is-intersection

API

isIntersection(a: [number, number], b: [number, number], c: [number, number], d: [number, number]): boolean

Sample Codes

Tests

__tests__/isIntersection.test.ts

import { isIntersection } from '@lunit/is-intersection';

describe('isIntersection()', () => {
  test('ab와 cd는 교차한다', () => {
    expect(isIntersection([0, 0], [10, 10], [10, 0], [0, 10])).toBeTruthy();
  });

  test('ab와 cd는 교차하지 않는다', () => {
    expect(isIntersection([0, 0], [10, 0], [0, 10], [10, 10])).toBeFalsy();
  });
});