47 value_type x, y, z, r;
58 value{0.0, 0.0, 0.0, -1.0} {}
61 value{s[0], s[1], s[2], s[3]} {}
67 value{
static_cast<value_type
>(s[0]),
static_cast<value_type
>(s[1]),
static_cast<value_type
>(s[2]),
static_cast<value_type
>(s[3])} {}
71 value{
static_cast<value_type
>(c.x),
static_cast<value_type
>(c.y),
static_cast<value_type
>(c.z), rad} {}
74 constexpr t_sphere(R sx, R sy, R sz, R sd) :
75 value{sx, sy, sz, sd} {}
77 constexpr std::size_t size()
const {
return 4; }
79 value_type& operator[](std::size_t i) {
return value[i]; }
80 value_type operator[](std::size_t i)
const {
return value[i]; }
85 value[0] =
static_cast<value_type
>(rhs[0]);
86 value[1] =
static_cast<value_type
>(rhs[1]);
87 value[2] =
static_cast<value_type
>(rhs[2]);
88 value[3] =
static_cast<value_type
>(rhs[3]);
92 void set(value_type in_x, value_type in_y, value_type in_z, value_type in_r)
103 x =
static_cast<value_type
>(c.x);
104 y =
static_cast<value_type
>(c.y);
105 z =
static_cast<value_type
>(c.z);
109 bool valid()
const {
return radius >= 0.0; }
111 explicit operator bool()
const noexcept {
return valid(); }
113 T* data() {
return value; }
114 const T* data()
const {
return value; }
118 center.set(0.0, 0.0, 0.0);