Class intersect

Intersect.

menori.ml.intersect

Methods

intersect:ray_triangle (ray, triangle[, backface_cull=nil]) Tests intersection between a ray and a triangle.
intersect:ray_plane (ray, position, normal) Tests intersection between a ray and a plane.
intersect:ray_sphere (ray, center, radius) Tests intersection between a ray and a sphere.
intersect:ray_capsule (ray, p0, p1, radius) Tests intersection between a ray and a capsule.
intersect:ray_aabb (ray, aabb) Tests intersection between a ray and an axis-aligned bounding box (AABB).
intersect:sphere_sphere (a_center, a_radius, b_center, b_radius) Tests intersection between two spheres.
intersect:sphere_aabb (center, radius, aabb) Tests intersection between a sphere and an axis-aligned bounding box (AABB).
intersect:sphere_triangle (center, radius, triangle) Tests intersection between a sphere and a triangle.
intersect:capsule_sphere (p0, p1, capsule_radius, center, sphere_radius) Tests intersection between a capsule and a sphere.
intersect:capsule_capsule (a0, a1, a_radius, b0, b1, b_radius) Tests intersection between two capsules.
intersect:capsule_aabb (p0, p1, radius, aabb) Tests intersection between a sphere and an axis-aligned bounding box (AABB).
intersect:capsule_triangle (p0, p1, radius, triangle) Tests intersection between a capsule and a triangle.
intersect:aabb_aabb (a, b) Tests intersection between two AABBs.
intersect:point_in_triangle (point, normal, triangle) Checks if a point lies inside a triangle.
intersect:closest_point_on_triangle (point, triangle) Finds the closest point on a triangle to a given point.
intersect:closest_point_segment_segment (a1, a2, b1, b2) Finds the closest points between two line segments.


Methods

intersect:ray_triangle (ray, triangle[, backface_cull=nil])
Tests intersection between a ray and a triangle.

Parameters:

  • ray table Ray definition {origin=vec3|table, dir=vec3|table}
  • triangle table Triangle vertices {vec3|table, vec3|table, vec3|table}
  • backface_cull boolean If true, ignores back-facing triangles (default nil)

Returns:

    table or false Intersection data {point=vec3, normal=vec3, t=number} or false if no hit
intersect:ray_plane (ray, position, normal)
Tests intersection between a ray and a plane.

Parameters:

  • ray table Ray definition {origin=vec3|table, direction=vec3|table}
  • position vec3 or table A point on the plane
  • normal vec3 or table Plane normal

Returns:

    table or false Intersection data {point=vec3, normal=vec3, t=number} or false if no hit
intersect:ray_sphere (ray, center, radius)
Tests intersection between a ray and a sphere.

Parameters:

  • ray table Ray definition {origin=vec3|table, direction=vec3|table}
  • center vec3 or table Sphere center
  • radius number Sphere radius

Returns:

    table or false Intersection data {point=vec3, normal=vec3, t=number} or false if no hit
intersect:ray_capsule (ray, p0, p1, radius)
Tests intersection between a ray and a capsule.

Parameters:

  • ray table Ray definition {origin=vec3|table, direction=vec3|table}
  • p0 vec3 or table Capsule start point
  • p1 vec3 or table Capsule end point
  • radius number Capsule radius

Returns:

    table or false Intersection data {point=vec3, normal=vec3, t=number} or false if no hit
intersect:ray_aabb (ray, aabb)
Tests intersection between a ray and an axis-aligned bounding box (AABB).

Parameters:

  • ray table Ray definition {origin=vec3|table, direction=vec3|table}
  • aabb table AABB definition {min=vec3|table, max=vec3|table}

Returns:

    table or false Intersection data {point=vec3, normal=vec3, t=number} or false if no hit
intersect:sphere_sphere (a_center, a_radius, b_center, b_radius)
Tests intersection between two spheres.

Parameters:

  • a_center vec3 or table Center of first sphere
  • a_radius number Radius of first sphere
  • b_center vec3 or table Center of second sphere
  • b_radius number Radius of second sphere

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:sphere_aabb (center, radius, aabb)
Tests intersection between a sphere and an axis-aligned bounding box (AABB).

Parameters:

  • center vec3 or table Sphere center
  • radius number Sphere radius
  • aabb table AABB definition {min=vec3|table, max=vec3|table}

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:sphere_triangle (center, radius, triangle)
Tests intersection between a sphere and a triangle.

Parameters:

  • center vec3 or table Sphere center
  • radius number Sphere radius
  • triangle table Triangle vertices {vec3|table, vec3|table, vec3|table}

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:capsule_sphere (p0, p1, capsule_radius, center, sphere_radius)
Tests intersection between a capsule and a sphere.

Parameters:

  • p0 vec3 or table Capsule start point
  • p1 vec3 or table Capsule end point
  • capsule_radius number Capsule radius
  • center vec3 or table Sphere center
  • sphere_radius number Sphere radius

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:capsule_capsule (a0, a1, a_radius, b0, b1, b_radius)
Tests intersection between two capsules.

Parameters:

  • a0 vec3 or table First capsule start
  • a1 vec3 or table First capsule end
  • a_radius number First capsule radius
  • b0 vec3 or table Second capsule start
  • b1 vec3 or table Second capsule end
  • b_radius number Second capsule radius

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:capsule_aabb (p0, p1, radius, aabb)
Tests intersection between a sphere and an axis-aligned bounding box (AABB).

Parameters:

  • p0 vec3 or table Capsule start
  • p1 vec3 or table Capsule end
  • radius number Capsule radius
  • aabb table AABB definition {min=vec3|table, max=vec3|table}

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:capsule_triangle (p0, p1, radius, triangle)
Tests intersection between a capsule and a triangle.

Parameters:

  • p0 vec3 or table Capsule start
  • p1 vec3 or table Capsule end
  • radius number Capsule radius
  • triangle table Triangle vertices {vec3|table, vec3|table, vec3|table}

Returns:

    table or false Collision data {normal=vec3, depth=number, point=vec3} or false if no collision
intersect:aabb_aabb (a, b)
Tests intersection between two AABBs.

Parameters:

  • a table AABB {min=vec3, max=vec3}
  • b table AABB {min=vec3, max=vec3}

Returns:

    boolean True if intersecting, false otherwise
intersect:point_in_triangle (point, normal, triangle)
Checks if a point lies inside a triangle.

Parameters:

  • point vec3 or table The point
  • normal vec3 or table Triangle normal
  • triangle table Triangle vertices {vec3|table, vec3|table, vec3|table}

Returns:

    boolean True if point is inside triangle, false otherwise
intersect:closest_point_on_triangle (point, triangle)
Finds the closest point on a triangle to a given point.

Parameters:

  • point vec3 or table The point
  • triangle table Triangle vertices {vec3|table, vec3|table, vec3|table}

Returns:

    vec3 Closest point
intersect:closest_point_segment_segment (a1, a2, b1, b2)
Finds the closest points between two line segments.

Parameters:

Returns:

    vec3, vec3 Closest points
generated by LDoc 1.5.0 Last updated 2025-08-18 00:01:40