Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
PhysicsMath Namespace Reference

Namespace containing mathematical utility functions for physics calculations. More...

Functions

float to_meters (float pixels, float ratio) noexcept
 Convert pixels to meters using the specified ratio.
 
float to_pixels (float meters, float ratio) noexcept
 Convert meters to pixels using the specified ratio.
 
float to_radians (float degrees) noexcept
 Convert degrees to radians.
 
float to_degrees (float radians) noexcept
 Convert radians to degrees.
 
float convert_box2d_angle_to_radians (float sine, float cosine) noexcept
 Convert Box2D angle representation (sine, cosine) to radians.
 
float convert_radians_to_box2d_sine (float radians) noexcept
 Convert radians to Box2D sine value.
 
float convert_radians_to_box2d_cosine (float radians) noexcept
 Convert radians to Box2D cosine value.
 
float distance_between_points (const Point &a, const Point &b) noexcept
 Calculate the distance between two 2D points.
 
float dx_between_points (const Point &a, const Point &b) noexcept
 Calculate the difference in x-coordinates between two 2D points.
 
float dy_between_points (const Point &a, const Point &b) noexcept
 Calculate the difference in y-coordinates between two 2D points.
 
Vector3 box2d_vec_to_pixel_vec3 (const Vector3 &v, bool to_pixels=true)
 Convert a Vector3 to Box2D vector representation.
 
Vector3 vec3_to_box2d_vec3 (const Vector3 &v, bool from_pixels=true)
 Convert a Box2D vector representation to Vector3.
 
float box2d_to_pixels (float length) noexcept
 Convert length from Box2D units to pixels.
 
float pixels_to_box2d (float length) noexcept
 Convert length from pixels to Box2D units.
 
Vector3 physics_vec3_to_transform_pixel_vec3 (const Vector3 &v, float width, float height) noexcept
 Convert physics Vector3 to transform pixel Vector3.
 

Detailed Description

Namespace containing mathematical utility functions for physics calculations.

This namespace provides functions to convert between different units (pixels to meters, degrees to radians, etc.) commonly used in physics simulations.

Function Documentation

◆ box2d_to_pixels()

float PhysicsMath::box2d_to_pixels ( float  length)
noexcept

Convert length from Box2D units to pixels.

◆ box2d_vec_to_pixel_vec3()

Vector3 PhysicsMath::box2d_vec_to_pixel_vec3 ( const Vector3 v,
bool  to_pixels = true 
)

Convert a Vector3 to Box2D vector representation.

◆ convert_box2d_angle_to_radians()

float PhysicsMath::convert_box2d_angle_to_radians ( float  sine,
float  cosine 
)
noexcept

Convert Box2D angle representation (sine, cosine) to radians.

◆ convert_radians_to_box2d_cosine()

float PhysicsMath::convert_radians_to_box2d_cosine ( float  radians)
noexcept

Convert radians to Box2D cosine value.

◆ convert_radians_to_box2d_sine()

float PhysicsMath::convert_radians_to_box2d_sine ( float  radians)
noexcept

Convert radians to Box2D sine value.

◆ distance_between_points()

float PhysicsMath::distance_between_points ( const Point a,
const Point b 
)
noexcept

Calculate the distance between two 2D points.

◆ dx_between_points()

float PhysicsMath::dx_between_points ( const Point a,
const Point b 
)
noexcept

Calculate the difference in x-coordinates between two 2D points.

◆ dy_between_points()

float PhysicsMath::dy_between_points ( const Point a,
const Point b 
)
noexcept

Calculate the difference in y-coordinates between two 2D points.

◆ physics_vec3_to_transform_pixel_vec3()

Vector3 PhysicsMath::physics_vec3_to_transform_pixel_vec3 ( const Vector3 v,
float  width,
float  height 
)
noexcept

Convert physics Vector3 to transform pixel Vector3.

◆ pixels_to_box2d()

float PhysicsMath::pixels_to_box2d ( float  length)
noexcept

Convert length from pixels to Box2D units.

◆ to_degrees()

float PhysicsMath::to_degrees ( float  radians)
noexcept

Convert radians to degrees.

◆ to_meters()

float PhysicsMath::to_meters ( float  pixels,
float  ratio 
)
noexcept

Convert pixels to meters using the specified ratio.

◆ to_pixels()

float PhysicsMath::to_pixels ( float  meters,
float  ratio 
)
noexcept

Convert meters to pixels using the specified ratio.

◆ to_radians()

float PhysicsMath::to_radians ( float  degrees)
noexcept

Convert degrees to radians.

◆ vec3_to_box2d_vec3()

Vector3 PhysicsMath::vec3_to_box2d_vec3 ( const Vector3 v,
bool  from_pixels = true 
)

Convert a Box2D vector representation to Vector3.