namespace
LiteralsMath literals.
Literals for easy construction of angle and color values.
This library is built as part of Magnum by default. To use this library with CMake, find the Magnum
package and link to the Magnum::Magnum
target:
find_package(Magnum REQUIRED) # ... target_link_libraries(your-app PRIVATE Magnum::Magnum)
See Downloading and building, Usage with CMake and Math type system for more information.
Functions
- auto operator""_deg(long double value) -> Deg<Double> constexpr
- Double-precision degree value literal.
- auto operator""_degf(long double value) -> Deg<Float> constexpr
- Single-precision degree value literal.
- auto operator""_rad(long double value) -> Rad<Double> constexpr
- Double-precision radian value literal.
- auto operator""_radf(long double value) -> Rad<Float> constexpr
- Single-precision radian value literal.
- auto operator""_rgb(unsigned long long value) -> Color3<UnsignedByte> constexpr
- 8bit-per-channel linear RGB literal
- auto operator""_srgb(unsigned long long value) -> Vector3<UnsignedByte> constexpr
- 8bit-per-channel sRGB literal
- auto operator""_rgba(unsigned long long value) -> Color4<UnsignedByte> constexpr
- 8bit-per-channel linear RGBA literal
- auto operator""_srgba(unsigned long long value) -> Vector4<UnsignedByte> constexpr
- 8bit-per-channel sRGB + alpha literal
- auto operator""_rgbf(unsigned long long value) -> Color3<Float>
- Float linear RGB literal.
- auto operator""_srgbf(unsigned long long value) -> Color3<Float>
- Float sRGB literal.
- auto operator""_rgbaf(unsigned long long value) -> Color4<Float>
- Float linear RGBA literal.
- auto operator""_srgbaf(unsigned long long value) -> Color4<Float>
- Float sRGB + alpha literal.
- auto operator""_h(long double value) -> Half
- Half-float literal.
Function documentation
Deg<Double> Magnum:: Math:: Literals:: operator""_deg(long double value) constexpr
#include <Magnum/Math/Angle.h>
Double-precision degree value literal.
Example usage:
using namespace Math::Literals; Double cos1 = Math::cos(60.0_deg); // cos1 = 0.5 Double cos2 = Math::cos(1.047_rad); // cos2 = 0.5
Deg<Float> Magnum:: Math:: Literals:: operator""_degf(long double value) constexpr
#include <Magnum/Math/Angle.h>
Single-precision degree value literal.
Example usage:
using namespace Math::Literals; Float tan1 = Math::tan(60.0_degf); // tan1 = 1.732f Float tan2 = Math::tan(1.047_radf); // tan2 = 1.732f
Rad<Double> Magnum:: Math:: Literals:: operator""_rad(long double value) constexpr
#include <Magnum/Math/Angle.h>
Double-precision radian value literal.
See operator""_
Rad<Float> Magnum:: Math:: Literals:: operator""_radf(long double value) constexpr
#include <Magnum/Math/Angle.h>
Single-precision radian value literal.
See operator""_
Color3<UnsignedByte> Magnum:: Math:: Literals:: operator""_rgb(unsigned long long value) constexpr
#include <Magnum/Math/Color.h>
8bit-per-channel linear RGB literal
Unpacks the literal into three 8-bit values. Example usage:
using namespace Math::Literals; Color3ub a = 0x33b27f_rgb; // {0x33, 0xb2, 0x7f}
Vector3<UnsignedByte> Magnum:: Math:: Literals:: operator""_srgb(unsigned long long value) constexpr
#include <Magnum/Math/Color.h>
8bit-per-channel sRGB literal
Unpacks the literal into three 8-bit values without any colorspace conversion. Behaves identically to operator""_
using namespace Math::Literals; Vector3ub a = 0x33b27f_srgb; // {0x33, 0xb2, 0x7f}
Color4<UnsignedByte> Magnum:: Math:: Literals:: operator""_rgba(unsigned long long value) constexpr
#include <Magnum/Math/Color.h>
8bit-per-channel linear RGBA literal
Unpacks the literal into four 8-bit values. Example usage:
using namespace Math::Literals; Color4ub a = 0x33b27fcc_rgba; // {0x33, 0xb2, 0x7f, 0xcc}
Vector4<UnsignedByte> Magnum:: Math:: Literals:: operator""_srgba(unsigned long long value) constexpr
#include <Magnum/Math/Color.h>
8bit-per-channel sRGB + alpha literal
Unpacks the literal into four 8-bit values without any colorspace conversion. Behaves identically to operator""_
using namespace Math::Literals; Vector4ub a = 0x33b27fcc_srgba; // {0x33, 0xb2, 0x7f, 0xcc}
Color3<Float> Magnum:: Math:: Literals:: operator""_rgbf(unsigned long long value)
#include <Magnum/Math/Color.h>
Float linear RGB literal.
Unpacks the 8-bit values into three floats. Example usage:
using namespace Math::Literals; Color3 a = 0x33b27f_rgbf; // {0.2f, 0.698039f, 0.498039f}
Color3<Float> Magnum:: Math:: Literals:: operator""_srgbf(unsigned long long value)
#include <Magnum/Math/Color.h>
Float sRGB literal.
Calls Color3::
using namespace Math::Literals; Color3 a = 0x33b27f_srgbf; // {0.0331048f, 0.445201f, 0.212231f}
Color4<Float> Magnum:: Math:: Literals:: operator""_rgbaf(unsigned long long value)
#include <Magnum/Math/Color.h>
Float linear RGBA literal.
Unpacks the 8-bit values into four floats. Example usage:
using namespace Math::Literals; Color4 a = 0x33b27fcc_rgbaf; // {0.2f, 0.698039f, 0.498039f, 0.8f}
Color4<Float> Magnum:: Math:: Literals:: operator""_srgbaf(unsigned long long value)
#include <Magnum/Math/Color.h>
Float sRGB + alpha literal.
Calls Color4::
using namespace Math::Literals; Color4 a = 0x33b27fcc_srgbaf; // {0.0331048f, 0.445201f, 0.212231f, 0.8f}
Half Magnum:: Math:: Literals:: operator""_h(long double value)
#include <Magnum/Math/Half.h>
Half-float literal.
See Half for more information.