12 constexpr circle(
circle const &other)
noexcept =
default;
14 constexpr circle &operator=(
circle const &other)
noexcept =
default;
15 constexpr circle &operator=(
circle &&other)
noexcept =
default;
17 constexpr circle() noexcept : _v()
19 hi_axiom(holds_invariant());
22 [[nodiscard]]
constexpr explicit circle(
f32x4 v) noexcept : _v(v)
24 hi_axiom(holds_invariant());
27 [[nodiscard]]
constexpr explicit operator f32x4()
const noexcept
32 [[nodiscard]]
constexpr circle(
point3 point,
float radius) noexcept :
36 hi_axiom(holds_invariant());
41 auto square_ =
f32x4{square};
44 _v = (addsub<0b0011>(square_.zwzw(), square_.xyxy()) * 0.5f).xy0w();
45 hi_axiom(holds_invariant());
48 [[nodiscard]]
constexpr bool empty()
const noexcept
50 return _v.w() == 0.0f;
53 [[nodiscard]]
explicit operator bool ()
const noexcept
58 [[nodiscard]]
constexpr float radius()
const noexcept
68 [[nodiscard]]
constexpr friend circle operator+(
circle const &lhs,
float rhs)
noexcept
73 [[nodiscard]]
constexpr friend circle operator-(
circle const &lhs,
float rhs)
noexcept
78 [[nodiscard]]
constexpr friend circle operator*(
circle const &lhs,
float rhs)
noexcept
80 return circle{lhs._v * insert<3>(f32x4::broadcast(1.0f), rhs)};
83 [[nodiscard]]
constexpr friend point3 midpoint(
circle const &rhs)
noexcept
85 return point3{rhs.center()};
88 [[nodiscard]]
constexpr friend aarectangle bounding_rectangle(
circle const &rhs)
noexcept
90 auto p = rhs._v.xyxy();
91 auto r = neg<0b0011>(rhs._v.wwww());
99 [[nodiscard]]
constexpr bool holds_invariant()
const noexcept
101 return _v.w() >= 0.0f;