blueprint.js 378 B

12345678910111213141516171819202122
  1. //IMUS Laboratory Blue Print Drag Drop Interface
  2. //Developed for Home Dynamic System, 2017
  3. class Point {
  4. constructor(x, y) {
  5. this.x = x;
  6. this.y = y;
  7. }
  8. static distance(a, b) {
  9. const dx = a.x - b.x;
  10. const dy = a.y - b.y;
  11. return Math.hypot(dx, dy);
  12. }
  13. }
  14. const p1 = new Point(5, 5);
  15. const p2 = new Point(10, 10);
  16. console.log(Point.distance(p1, p2));