33 lines
739 B
C++
33 lines
739 B
C++
#pragma once
|
|
|
|
#include <compare>
|
|
|
|
namespace math
|
|
{
|
|
|
|
template<typename T>
|
|
struct ray3
|
|
{
|
|
typedef T value_t;
|
|
typedef ray3<T> this_t;
|
|
|
|
constexpr ray3() noexcept = default;
|
|
constexpr ray3(const vec3<T>& start, const vec3<T>& direction) noexcept;
|
|
constexpr ray3(const ray3<T>&) noexcept = default;
|
|
|
|
constexpr auto operator<=>(const this_t&) const noexcept = default;
|
|
constexpr bool operator==(const this_t&) const noexcept = default;
|
|
|
|
constexpr ray3<T>& operator=(const ray3<T>&) noexcept = default;
|
|
|
|
constexpr bool is_valid() const noexcept;
|
|
constexpr vec3<T> get_point(T distance) const noexcept;
|
|
constexpr void translate(const vec3<T>& offset) noexcept;
|
|
|
|
|
|
vec3<T> origin;
|
|
vec3<T> direction;
|
|
};
|
|
|
|
}
|