User Tools

Site Tools


raycasting_line_intersections

This is an old revision of the document!


Raycasting Namespace

The Raycasting namespace provides functions for testing ray intersections with various shapes.

—- Functions —-

Raycasting::Raycast(const Sphere& a, const Ray& ray)

Tests if a ray intersects a sphere.

Parameters:

  1. a : Sphere - The sphere to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Raycast(const AABB& aabb, const Ray& ray)

Tests if a ray intersects an axis-aligned bounding box (AABB).

Parameters:

  1. aabb : AABB - The AABB to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Raycast(const OrientedBox& obb, const Ray& ray)

Tests if a ray intersects an oriented bounding box (OBB).

Parameters:

  1. obb : OrientedBox - The OBB to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Raycast(const Plane& plane, const Ray& ray)

Tests if a ray intersects a plane.

Parameters:

  1. plane : Plane - The plane to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Raycast(const Triangle& triangle, const Ray& ray)

Tests if a ray intersects a triangle.

Parameters:

  1. triangle : Triangle - The triangle to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Raycast(const Mesh& mesh, const Ray& ray)

Tests if a ray intersects a mesh.

Parameters:

  1. mesh : Mesh - The mesh to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Raycast(const Entity& entity, const Ray& ray)

Tests if a ray intersects an entity.

Parameters:

  1. entity : Entity - The entity to test.
  2. ray : Ray - The ray to test.

Returns:

  1. float - The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.

Raycasting::Linetest(const Sphere& sphere, const Line& line)

Tests if a line intersects a sphere.

Parameters:

  1. sphere : Sphere - The sphere to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the sphere, false otherwise.

Raycasting::Linetest(const AABB& aabb, const Line& line)

Tests if a line intersects an axis-aligned bounding box (AABB).

Parameters:

  1. aabb : AABB - The AABB to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the AABB, false otherwise.

Raycasting::Linetest(const OrientedBox& obb, const Line& line)

Tests if a line intersects an oriented bounding box (OBB).

Parameters:

  1. obb : OrientedBox - The OBB to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the OBB, false otherwise.

Raycasting::Linetest(const Plane& plane, const Line& line)

Tests if a line intersects a plane.

Parameters:

  1. plane : Plane - The plane to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the plane, false otherwise.

Raycasting::Linetest(const Triangle& triangle, const Line& line)

Tests if a line intersects a triangle.

Parameters:

  1. triangle : Triangle - The triangle to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the triangle, false otherwise.

Raycasting::Linetest(const Mesh& mesh, const Line& line)

Tests if a line intersects a mesh.

Parameters:

  1. mesh : Mesh - The mesh to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the mesh, false otherwise.

Raycasting::Linetest(const Entity& entity, const Line& line)

Tests if a line intersects an entity.

Parameters:

  1. entity : Entity - The entity to test.
  2. line : Line - The line to test.

Returns:

  1. bool - true if the line intersects the entity, false otherwise.

—- Support —-

Raycasting::Barycentric(const Point& p, const Triangle& t)

Calculates the barycentric coordinates of a point in relation to a triangle.

Parameters:

  1. p : Point - The point for which to calculate barycentric coordinates.
  2. t : Triangle - The triangle to use for the calculation.

Returns:

  1. Vector3 - The barycentric coordinates of the point in relation to the triangle.
raycasting_line_intersections.1681416188.txt.gz · Last modified: 2023/04/13 20:03 by max