@@ -54,7 +54,96 @@ console.log(getOverlapPoints(points1, points2));
5454// 1000
5555console .log (getOverlapSize (points1 , points2 ));
5656```
57+ ### User Overlap Areas
58+ Get the areas of the overlapped part of two shapes.
59+ ![ Overlap Areas] ( https://daybrush.com/overlap-area/images/overlap.png )
5760
61+ ``` js
62+ import { getOverlapAreas } from " overlap-area" ;
63+
64+ const points1 = [
65+ [150 , 100 ],
66+ [200 , 50 ],
67+ [250 , 60 ],
68+ [300 , 100 ],
69+ [250 , 160 ],
70+ [150 , 150 ],
71+ [200 , 120 ],
72+ ];
73+ const points2 = [
74+ [250 , 100 ],
75+ [300 , 50 ],
76+ [350 , 60 ],
77+ [400 , 100 ],
78+ [350 , 160 ],
79+ [220 , 150 ],
80+ [300 , 120 ],
81+ ];
82+
83+ /*
84+ [
85+ [
86+ [272.2222222, 77.7777778],
87+ [300, 100],
88+ [287.5, 115],
89+ [250, 100],
90+ ],
91+ [
92+ [275.7575758, 129.0909091],
93+ [256.0240964, 152.7710843],
94+ [220, 150],
95+ ],
96+ ]
97+ */
98+ console .log (getOverlapAreas (points1, points2));
99+ ```
100+ ### User Unoverlap Areas
101+ Get non-overlapping areas of two shapes based on points1.
102+
103+ ![ Unoverlap Areas] ( https://daybrush.com/overlap-area/images/unoverlap.png )
104+
105+ ``` js
106+ import { getUnoverlapAreas } from " overlap-area" ;
107+
108+ const points1 = [
109+ [150 , 100 ],
110+ [200 , 50 ],
111+ [250 , 60 ],
112+ [300 , 100 ],
113+ [250 , 160 ],
114+ [150 , 150 ],
115+ [200 , 120 ],
116+ ];
117+ const points2 = [
118+ [250 , 100 ],
119+ [300 , 50 ],
120+ [350 , 60 ],
121+ [400 , 100 ],
122+ [350 , 160 ],
123+ [220 , 150 ],
124+ [300 , 120 ],
125+ ];
126+
127+ /*
128+ [
129+ [
130+ [150, 100],
131+ [200, 50],
132+ [250, 60],
133+ [272.2222222, 77.7777778],
134+ [250, 100],
135+ [287.5, 115],
136+ [275.7575758, 129.0909091],
137+ [220, 150],
138+ [256.0240964, 152.7710843],
139+ [250, 160],
140+ [150, 150],
141+ [200, 120],
142+ ],
143+ ]
144+ */
145+ console .log (getUnoverlapAreas (points1, points2));
146+ ```
58147### Calculate the overlap of elements
59148``` js
60149import { getElementInfo } from " moveable" ;
0 commit comments