Package Exports
- @pelevesque/is-point-in
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pelevesque/is-point-in) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
is-point-in
Checks if a point is inside a shape.
Node Repository
https://www.npmjs.com/package/@pelevesque/is-point-in
Installation
npm install @pelevesque/is-point-in
Tests
| Command | Description |
|---|---|
npm test or npm run test |
All Tests Below |
npm run cover |
Standard Style |
npm run standard |
Coverage |
npm run unit |
Unit Tests |
Methods
rectangleChecks if a point is inside a rectangle.circleChecks if a point is inside a circle.
Usage
Initialization
Requiring the Entire Module
const IsPointIn = require('@pelevesque/is-point-in')Requiring a Specific Method
const IsPointInRectangle = require('@pelevesque/is-point-in').rectangleRectangle
// point
const x = 10
const y = 10
// rectangle
const x1 = 5
const y1 = 5
const x2 = 15
const y2 = 15
const result = IsPointIn.rectangle(x, y, x1, y1, x2, y2)
// result === trueCircle
// point
const x = -3.84
const y = 3.22
// circle
const cx = 0
const cy = 0
const cRadius = 5
const result = IsPointIn.circle(x, y, cx, cy, cRadius)
// result === false