sandbox
Loading...
Searching...
No Matches
matrix_cast.hpp File Reference

Matrix casting and decomposition utilities. More...

#include <type_traits>
#include <concepts>
#include <utility>
#include <libsbx/math/concepts.hpp>
#include <libsbx/math/matrix.hpp>
#include <libsbx/math/matrix3x3.hpp>
#include <libsbx/math/matrix4x4.hpp>
#include <libsbx/math/quaternion.hpp>
#include <libsbx/math/matrix_cast.ipp>

Go to the source code of this file.

Classes

struct  sbx::math::decompose_result
 Result of matrix decomposition. More...
 

Namespaces

namespace  libsbx
 

Concepts

concept  sbx::math::dispatcher_for
 Concept describing a valid dispatcher implementation.
 

Functions

template<typename To , typename From >
requires (dispatcher_for<detail::matrix_cast_impl<To, std::remove_cvref_t<From>>, To, From>)
constexpr auto sbx::math::matrix_cast (const From &from) -> To
 Casts between matrix-related types. More...
 
auto sbx::math::decompose (const matrix4x4 &matrix) noexcept -> decompose_result
 Decomposes a transformation matrix into position, rotation, and scale. More...
 

Detailed Description

Matrix casting and decomposition utilities.

This header provides a generic, extensible mechanism for casting between different matrix representations, as well as helpers for extracting transformation components from matrices.

Supported conversions include:

  • 3x3 <-> 4x4 matrix casting
  • quaternion -> matrix casting
  • Matrix decomposition into position, rotation, and scale
Author
KAJ

Function Documentation

◆ decompose()

auto sbx::math::decompose ( const matrix4x4 matrix) -> decompose_result
noexcept

Decomposes a transformation matrix into position, rotation, and scale.

Parameters
matrixInput transformation matrix.
Returns
Decomposed transformation components.

◆ matrix_cast()

template<typename To , typename From >
requires (dispatcher_for<detail::matrix_cast_impl<To, std::remove_cvref_t<From>>, To, From>)
constexpr auto sbx::math::matrix_cast ( const From &  from) -> To
constexpr

Casts between matrix-related types.

Template Parameters
ToTarget type.
FromSource type.
Parameters
fromSource value.
Returns
Converted value.