Geometry
Geometry Module
Accessing the Module
local GEOMETRY <const> = exports.boii_utils:get("modules.geometry")Shared
distance_2d(p1, p2)
Parameters
Name
Type
Description
Example
local d = GEOMETRY.distance_2d({x = 0, y = 0}, {x = 3, y = 4})
-- d = 5distance_3d(p1, p2)
Parameters
Name
Type
Description
Example
midpoint(p1, p2)
Parameters
Name
Type
Description
Example
is_point_in_rect(point, rect)
Parameters
Name
Type
Description
Example
is_point_in_box(point, box)
Parameters
Name
Type
Description
Example
is_point_on_line_segment(point, line_start, line_end)
Parameters
Name
Type
Description
Example
project_point_on_line(p, p1, p2)
Parameters
Name
Type
Description
Example
calculate_slope(p1, p2)
Parameters
Name
Type
Description
Example
angle_between_points(p1, p2)
Parameters
Name
Type
Description
Example
angle_between_3_points(p1, p2, p3)
Parameters
Name
Type
Description
Example
do_circles_intersect(c1_center, c1_radius, c2_center, c2_radius)
Parameters
Name
Type
Description
Example
is_point_in_circle(point, circle_center, circle_radius)
Parameters
Name
Type
Description
Example
do_lines_intersect(l1_start, l1_end, l2_start, l2_end)
Parameters
Name
Type
Description
Example
line_intersects_circle(line_start, line_end, circle_center, circle_radius)
Parameters
Name
Type
Description
Example
does_rect_intersect_line(rect, line_start, line_end)
Parameters
Name
Type
Description
Example
closest_point_on_line_segment(point, line_start, line_end)
Parameters
Name
Type
Description
Example
triangle_area_3d(p1, p2, p3)
Parameters
Name
Type
Description
Example
is_point_in_sphere(point, sphere_center, sphere_radius)
Parameters
Name
Type
Description
Example
do_spheres_intersect(s1_center, s1_radius, s2_center, s2_radius)
Parameters
Name
Type
Description
Example
is_point_in_convex_polygon(point, polygon)
Parameters
Name
Type
Description
Example
rotate_point_around_point_2d(point, pivot, angle_degrees)
Parameters
Name
Type
Description
Example
distance_point_to_plane(point, plane_point, plane_normal)
Parameters
Name
Type
Description
Example
rotation_to_direction(rotation)
Parameters
Name
Type
Description
Example
rotate_box(center, width, length, heading)
Parameters
Name
Type
Description
Example
calculate_rotation_matrix(heading, pitch, roll)
Parameters
Name
Type
Description
Example
translate_point_to_local_space(point, box_origin, rot_matrix)
Parameters
Name
Type
Description
Example
is_point_in_oriented_box(point, box)
Parameters
Name
Type
Description
Example
Last updated