Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 804 Bytes

README.md

File metadata and controls

31 lines (24 loc) · 804 Bytes

Swinging door compression

This base on https://github.com/Dymerz/swingingpy/

Algorithm: Swing Door Compression Algorithm https://www.youtube.com/watch?v=89hg2mme7S0&ab_channel=AVEVAPISystemLearning

Example:

import { CPoint, SwingDoor } from "swing-door-compressor";

const compDev = 1;
const compMax = 5;
const original = new CPoint(1, 2);
const snapshot = new CPoint(2, 2);
const swing = new SwingDoor(compDev, compMax, original, snapshot);

const points = [
  new CPoint(3, 2),
  new CPoint(4, 1),
  new CPoint(5, 3),
  new CPoint(6, 5),
];

points.forEach((p) => {
    if (swing.check(p)) {
        console.log(p)
    }
})