Installations
npm install overlap-area
Score
99.6
Supply Chain
100
Quality
75.8
Maintenance
100
Vulnerability
100
License
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
14.15.4
NPM Version
7.24.2
Statistics
62 Stars
36 Commits
1 Forks
4 Watching
3 Branches
1 Contributors
Updated on 23 Oct 2024
Languages
TypeScript (76.85%)
HTML (18.49%)
JavaScript (4.66%)
Total Downloads
Cumulative downloads
Total Downloads
7,507,063
Last day
-30.5%
13,680
Compared to previous day
Last week
-9.9%
89,412
Compared to previous week
Last month
0.9%
393,666
Compared to previous month
Last year
71.8%
3,788,189
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Overlap Area
Find the Overlap Area.
Demo / API / Main Project
📄 API Documents
⚙️ Installation
1$ npm install overlap-area
1<script src="//daybrush.com/overlap-area/release/latest/dist/overlap-area.min.js"></script>
🚀 How to use
1import { isInside, getOverlapPoints, getOverlapSize } from "overlap-area"; 2 3const points1 = [ 4 [0, 0], 5 [100, 0], 6 [120, 100], 7 [0, 100], 8]; 9const points2 = [ 10 [100, 0], 11 [150, 0], 12 [150, 100], 13 [100, 100], 14]; 15 16// true 17console.log(isInside([50, 50], points1)); 18// false 19console.log(isInside([50, 50], points2)); 20 21// [100, 0], [120, 100], [100, 100] 22console.log(getOverlapPoints(points1, points2)); 23 24// 1000 25console.log(getOverlapSize(points1, points2));
User Overlap Areas
Get the areas of the overlapped part of two shapes.
1import { getOverlapAreas } from "overlap-area"; 2 3const points1 = [ 4 [150, 100], 5 [200, 50], 6 [250, 60], 7 [300, 100], 8 [250, 160], 9 [150, 150], 10 [200, 120], 11]; 12const points2 = [ 13 [250, 100], 14 [300, 50], 15 [350, 60], 16 [400, 100], 17 [350, 160], 18 [220, 150], 19 [300, 120], 20]; 21 22/* 23[ 24 [ 25 [272.2222222, 77.7777778], 26 [300, 100], 27 [287.5, 115], 28 [250, 100], 29 ], 30 [ 31 [275.7575758, 129.0909091], 32 [256.0240964, 152.7710843], 33 [220, 150], 34 ], 35] 36*/ 37console.log(getOverlapAreas(points1, points2));
User Unoverlap Areas
Get non-overlapping areas of two shapes based on points1.
1import { getUnoverlapAreas } from "overlap-area"; 2 3const points1 = [ 4 [150, 100], 5 [200, 50], 6 [250, 60], 7 [300, 100], 8 [250, 160], 9 [150, 150], 10 [200, 120], 11]; 12const points2 = [ 13 [250, 100], 14 [300, 50], 15 [350, 60], 16 [400, 100], 17 [350, 160], 18 [220, 150], 19 [300, 120], 20]; 21 22/* 23[ 24 [ 25 [150, 100], 26 [200, 50], 27 [250, 60], 28 [272.2222222, 77.7777778], 29 [250, 100], 30 [287.5, 115], 31 [275.7575758, 129.0909091], 32 [220, 150], 33 [256.0240964, 152.7710843], 34 [250, 160], 35 [150, 150], 36 [200, 120], 37 ], 38] 39*/ 40console.log(getUnoverlapAreas(points1, points2));
Calculate the overlap of elements
1import { getElementInfo } from "moveable"; 2import { getOverlapPoints, getOverlapSize } from "overlap-area"; 3 4function getPoints(info) { 5 const { left, top, pos1, pos2, pos3, pos4 } = info; 6 7 return [pos1, pos2, pos4, pos3].map(pos => [left + pos[0], top + pos[1]]); 8} 9 10const points1 = getPoints(getElementInfo(element1)); 11const points2 = getPoints(getElementInfo(element2)); 12 13// Points of the overlapped area 14getOverlapPoints(points1, points2); 15 16// Size of the overlapped area 17getOverlapSize(points1, points2);
⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
👏 Contributing
If you have any questions or requests or want to contribute to overlap-area
or other packages, please write the issue or give me a Pull Request freely.
🐞 Bug Report
If you find a bug, please report to us opening a new Issue on GitHub.
📝 License
This project is MIT licensed.
MIT License
Copyright (c) 2020 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
22 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9
- Warn: Project is vulnerable to: GHSA-6vfc-qv3f-vr6c
- Warn: Project is vulnerable to: GHSA-xf5p-87ch-gxw2
- Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj
- Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94
- Warn: Project is vulnerable to: GHSA-g36h-6r4f-3mqp
- Warn: Project is vulnerable to: GHSA-38h8-x697-gh8q
- Warn: Project is vulnerable to: GHSA-mxhp-79qh-mcx6
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More