module Collider
Defined in:
collider.crcollider/version.cr
Constant Summary
-
VERSION =
"0.1.1"
Class Method Summary
-
.distance(x1, y1, x2, y2)
Get distance between (x1, y1) and (x2, y2)
- .min_max(args)
- .rectangle_only_x(points)
- .rectangle_only_y(points)
-
.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]
-
.rectangle_points_rotate(angle_rad, points)
enter: points = [x1, y1, x2, y2, x3, y3, x4, y4] return: points after rotating
- .rectangle_points_rotate_around_zero(angle_rad, points)
- .rectangles_colliding?(points)
- .rectangles_with_angle_colliding?(angle_rad, points)
-
.rotate_point(x, y, angle, x0 = 0.0, y0 = 0.0)
Rotate point (x, y) around point (x0, y0)
-
.rotate_x(x, y, angle, x0 = 0.0, y0 = 0.0)
Rotate x coordinate around point (x0, y0)
-
.rotate_y(x, y, angle, x0 = 0.0, y0 = 0.0)
Rotate y coordinate around point (x0, y0)
-
.segments_colliding?(min1, max1, min2, max2)
Check segments colliding
- .separating_axis_theorem_for_rectangles(angle1, angle2, rectangles_points)
Class Method Detail
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]
def self.rectangle_points_rotate(angle_rad, points)
#
enter: points = [x1, y1, x2, y2, x3, y3, x4, y4] return: points after rotating
Rotate point (x, y) around point (x0, y0)
Rotate x coordinate around point (x0, y0)
Rotate y coordinate around point (x0, y0)