Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
MathUtils.h File Reference

Mathematical utility functions for 3D graphics and physics. More...

#include <glm/glm.hpp>
#include <vector>
#include <optional>
#include "graphics/core/IPickable.h"
Include dependency graph for MathUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Math::HitResult
 Represents the result of a ray-object intersection test. More...
 

Namespaces

namespace  Math
 Mathematical and geometric utility functions.
 

Functions

std::optional< float > Math::intersectTriangle (const Ray &ray, const glm::vec3 &v0, const glm::vec3 &v1, const glm::vec3 &v2)
 Tests ray-triangle intersection using Möller-Trumbore algorithm.
 
glm::vec3 Math::screenToWorldRayDirection (double mouseX, double mouseY, int fbWidth, int fbHeight, const glm::mat4 &view, const glm::mat4 &projection)
 Converts screen coordinates to a world-space ray direction.
 
std::optional< HitResultMath::findFirstHit (const std::vector< IPickable * > &objects, const Ray &ray, IPickable *priority=nullptr)
 Finds the first object intersected by a ray.
 

Detailed Description

Mathematical utility functions for 3D graphics and physics.

Provides ray-object intersection tests, coordinate transformations, and geometric utility functions used throughout the rendering and physics systems.

Definition in file MathUtils.h.


Data Structure Documentation

◆ Math::HitResult

struct Math::HitResult

Represents the result of a ray-object intersection test.

Contains information about which object was hit by a ray and the distance from the ray origin to the intersection point.

Definition at line 146 of file MathUtils.h.

Collaboration diagram for Math::HitResult:
[legend]
Data Fields
float distance Distance from the ray origin to the intersection point. Infinity if no hit.
IPickable * object Pointer to the hit object, or nullptr if no intersection.