module Collider

Defined in:

collider.cr
collider/version.cr

Constant Summary

VERSION = "0.1.1"

Class Method Summary

Class Method Detail

def self.distance(x1, y1, x2, y2) #

Get distance between (x1, y1) and (x2, y2)


[View source]
def self.min_max(args) #

[View source]
def self.rectangle_only_x(points) #

[View source]
def self.rectangle_only_y(points) #

[View source]
def self.rectangle_points(center_x, center_y, half_width, half_height = half_width) #

enter: center point coords and half width and half height of rectangle return: [x1, y1, x2, y2, x3, y3, x4, y4]


[View source]
def self.rectangle_points_rotate(angle_rad, points) #

enter: points = [x1, y1, x2, y2, x3, y3, x4, y4] return: points after rotating


[View source]
def self.rectangle_points_rotate_around_zero(angle_rad, points) #

[View source]
def self.rectangles_colliding?(points) #

[View source]
def self.rectangles_with_angle_colliding?(angle_rad, points) #

[View source]
def self.rotate_point(x, y, angle, x0 = 0.0, y0 = 0.0) #

Rotate point (x, y) around point (x0, y0)


[View source]
def self.rotate_x(x, y, angle, x0 = 0.0, y0 = 0.0) #

Rotate x coordinate around point (x0, y0)


[View source]
def self.rotate_y(x, y, angle, x0 = 0.0, y0 = 0.0) #

Rotate y coordinate around point (x0, y0)


[View source]
def self.segments_colliding?(min1, max1, min2, max2) #

Check segments colliding


[View source]
def self.separating_axis_theorem_for_rectangles(angle1, angle2, rectangles_points) #

[View source]