https://github.com/forsaken1/collider.cr
Library with implementation of Separating Axis Theorem for collisions calculations
https://github.com/forsaken1/collider.cr
2d geometry library
Last synced: over 1 year ago
JSON representation
Library with implementation of Separating Axis Theorem for collisions calculations
- Host: GitHub
- URL: https://github.com/forsaken1/collider.cr
- Owner: forsaken1
- License: mit
- Created: 2016-10-22T17:03:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-25T18:29:09.000Z (over 8 years ago)
- Last Synced: 2025-02-05T21:59:00.348Z (over 1 year ago)
- Topics: 2d, geometry, library
- Language: Crystal
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Collider
# Code status
[](https://github.com/forsaken1/collider.cr)
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
collider:
github: forsaken1/collider.cr
```
## Usage
```crystal
require "collider"
...
# check rectangles collisions (for two rectangles)
# three parameters:
# angle of reference system from base reference system of first rectangle (radians, Float64),
# angle of reference system from base reference system of second rectangle (radians, Float64),
# rectangle coordinates in format: [x1, y1, x2, y2, ..., x8, y8] : Array(Float64)
Collider.separating_axis_theorem_for_rectangles 0.to_rad, 50.to_rad,
Collider.rectangle_points(fx, fy, fw) +
Collider.rectangle_points_rotate(50.to_rad, Collider.rectangle_points(ox, oy, ow))
```
## Contributing
1. Fork it ( https://github.com/forsaken1/collider.cr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [forsaken1](https://github.com/forsaken1) forsaken1 - creator, maintainer