https://github.com/bugthesystem/polygon-utils
Ray-casting algorithm to determine if point is inside a polygon
https://github.com/bugthesystem/polygon-utils
Last synced: 7 months ago
JSON representation
Ray-casting algorithm to determine if point is inside a polygon
- Host: GitHub
- URL: https://github.com/bugthesystem/polygon-utils
- Owner: bugthesystem
- License: mit
- Created: 2017-06-21T14:40:56.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-21T14:50:28.000Z (almost 9 years ago)
- Last Synced: 2025-02-14T13:06:23.697Z (over 1 year ago)
- Language: Scala
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# polygon-utils
Ray-casting algorithm to determine if point is inside a polygon
## Sample Code
```scala
var polygon = Array(Array( 1.0, 1.0 ), Array( 1.0, 2.0 ), Array( 2.0, 2.0 ), Array( 2.0, 1.0 ) )
println(PolygonUtils.inside(Array( 1.5, 1.5 ), polygon))
println(PolygonUtils.inside(Array(4.9, 1.2), polygon))
println(PolygonUtils.inside(Array(1.8, 1.1), polygon))
// True, False, True
```