-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e6a0d5
commit 3436bab
Showing
1 changed file
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,61 @@ | ||
# iShape-js | ||
Polygon Bool operations for js | ||
|
||
<p align="center"> | ||
<img src="https://github.com/iShape-Rust/iShape-js/blob/main/Readme/balloons.svg" width="250"/> | ||
</p> | ||
The iShape-js is a poly-bool library that supports main operations such as union, intersection, difference, xor, and self-intersection by the even-odd rule. This algorithm is based on Vatti clipping ideas but is an original implementation. | ||
|
||
## [Demo](https://ishape-rust.github.io/iShape-js/demo/stars_demo.html) | ||
Try out i_overlay with an interactive demo. The demo covers operations like union, intersection, and difference. | ||
[Demo](https://ishape-rust.github.io/iShape-js/demo/stars_demo.html) | ||
|
||
|
||
## Features | ||
|
||
- Supports all basic set operations such as union, intersection, difference, exclusion and self-intersection. | ||
- Capable of handling various types of polygons, including self-intersecting polygons, multiple paths and polygons with holes. | ||
- Optimizes by removing unnecessary vertices and merging parallel edges. | ||
- Effectively handles an arbitrary number of overlaps, resolving them using the even-odd rule. | ||
- Employs integer arithmetic for computations. | ||
|
||
|
||
|
||
## Working Range and Precision | ||
The i_overlay library operates within the following ranges and precision levels: | ||
|
||
Extended Range: From -1,000,000 to 1,000,000 with a precision of 0.001. | ||
Recommended Range: From -100,000 to 100,000 with a precision of 0.01 for more accurate results. | ||
Utilizing the library within the recommended range ensures optimal accuracy in computations and is advised for most use cases. | ||
|
||
|
||
|
||
## Basic Usage | ||
|
||
Add the following imports: | ||
```rust | ||
|
||
``` | ||
|
||
### Union | ||
<p align="center"> | ||
<img src="https://github.com/iShape-Rust/iShape-js/blob/main/Readme/union.svg" width="400"/> | ||
</p> | ||
|
||
### Difference | ||
<p align="center"> | ||
<img src="https://github.com/iShape-Rust/iShape-js/blob/main/Readme/difference.svg" width="400"/> | ||
</p> | ||
|
||
### Intersection | ||
<p align="center"> | ||
<img src="https://github.com/iShape-Rust/iShape-js/blob/main/Readme/intersection.svg" width="400"/> | ||
</p> | ||
|
||
### Exclusion (xor) | ||
<p align="center"> | ||
<img src="https://github.com/iShape-Rust/iShape-js/blob/main/Readme/exclusion.svg" width="400"/> | ||
</p> | ||
|
||
### Self-intersection | ||
<p align="center"> | ||
<img src="https://github.com/iShape-Rust/iShape-js/blob/main/Readme/self-intersecting.svg" width="400"/> |