Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rectangle-overlap

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rectangle-overlap

Computes the area of the intersection of two rectangles.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rectangle-overlap

TypeScript support License

Fastly compute the intersection of two rectangles.

Usage

const intersection = require("rectangle-overlap");

let rect1 = {x: 0, y: 0, width: 10, height: 10};
let rect2 = {x: 2, y: 3, width: 42, height: 42};

const overlap = intersection(rect1, rect2);

if (overlap) {
  console.log(`The rectangles overlap over an area of ${overlap.area}`);
  console.log(
    `Intersection coordinates: x=${overlap.x}, y=${overlap.y}, width=${overlap.width}, height=${overlap.height}`,
  )
} else {
  console.log("The rectangles do not overlap");
}

Keywords

FAQs

Package last updated on 27 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc