Iros
 
Loading...
Searching...
No Matches
point.h
Go to the documentation of this file.
1#pragma once
2
4#include "di/types/floats.h"
5#include "di/types/integers.h"
6#include "di/util/get.h"
7
8namespace gfx {
9struct PointTag {
10 using Type = f32;
11 constexpr static auto extent = 2ZU;
12
13 struct Mixin {
15
16 constexpr auto x() const { return di::get<0>(as_self()); }
17 constexpr auto x() -> f32& { return di::get<0>(as_self()); }
18
19 constexpr auto y() const { return di::get<1>(as_self()); }
20 constexpr auto y() -> f32& { return di::get<1>(as_self()); }
21
22 constexpr auto with_x(Type x) const { return Self { x, y() }; }
23 constexpr auto with_y(Type y) const { return Self { x(), y }; }
24
25 private:
26 constexpr auto as_self() const -> Self const& { return static_cast<Self const&>(*this); }
27 constexpr auto as_self() -> Self& { return static_cast<Self&>(*this); }
28 };
29};
30
32}
Definition vec.h:55
float f32
Definition floats.h:4
constexpr auto get(T &&value) -> decltype(auto)
Definition get.h:8
Definition bitmap.h:14
di::math::linalg::Vec< PointTag > Point
Definition point.h:31
Definition point.h:13
constexpr auto y() -> f32 &
Definition point.h:20
constexpr auto x() -> f32 &
Definition point.h:17
constexpr auto x() const
Definition point.h:16
constexpr auto with_y(Type y) const
Definition point.h:23
di::math::linalg::Vec< PointTag > Self
Definition point.h:14
constexpr auto with_x(Type x) const
Definition point.h:22
constexpr auto y() const
Definition point.h:19
Definition point.h:9
f32 Type
Definition point.h:10
static constexpr auto extent
Definition point.h:11