collider.cr

Library with implementation of Separating Axis Theorem for collisions calculations

Collider

Code status

Build Status

Installation

Add this to your application's shard.yml:

dependencies:
  collider:
    github: forsaken1/collider.cr

Usage

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

Repository

collider.cr

Owner
Statistic
  • 1
  • 0
  • 0
  • 0
  • 0
  • almost 7 years ago
  • October 22, 2016
License

MIT License

Links
Synced at

Sun, 17 Nov 2024 18:41:57 GMT

Languages