11#include "translate2.hpp"
15#include "transform_fwd.hpp"
16#include "../macros.hpp"
19namespace hi {
inline namespace v1 {
38 hilet a = f32x4::broadcast(1.0f);
55 hi_axiom(holds_invariant());
71 hi_axiom(holds_invariant());
82 _col2(
f32x4{0.0f, 0.0f, 1.0f, 0.0f}),
83 _col3(
f32x4{0.0f, 0.0f, 0.0f, 1.0f})
85 hi_axiom(holds_invariant());
113 _col0(
c0r0,
c0r1,
c0r2, 0.0f), _col1(
c1r0,
c1r1,
c1r2, 0.0f), _col2(
c2r0,
c2r1,
c2r2, 0.0f), _col3(0.0f, 0.0f, 0.0f, 1.0f)
115 hi_axiom(holds_invariant());
157 _col0(
c0r0,
c0r1,
c0r2,
c0r3), _col1(
c1r0,
c1r1,
c1r2,
c1r3), _col2(
c2r0,
c2r1,
c2r2,
c2r3), _col3(
c3r0,
c3r1,
c3r2,
c3r3)
159 hi_axiom(holds_invariant());
164 hilet
ones = f32x4::broadcast(1.0f);
166 _col1 =
ones._0y00();
167 _col2 =
ones._00z0();
173 _col0 =
f32x4{rhs}.x000();
174 _col1 =
f32x4{rhs}._0y00();
175 _col2 =
f32x4{rhs}._00z0();
176 _col3 =
f32x4{rhs}._000w();
199 auto twos =
f32x4{-2.0f, 2.0f, 2.0f, 0.0f};
200 auto one =
f32x4{1.0f, 0.0f, 0.0f, 0.0f};
215 hi_axiom(holds_invariant());
216 return {_col0, _col1, _col2, _col3};
245 if constexpr (I == 0) {
247 }
else if constexpr (I == 1) {
249 }
else if constexpr (I == 2) {
251 }
else if constexpr (I == 3) {
254 hi_static_no_default();
266 if constexpr (I == 0) {
268 }
else if constexpr (I == 1) {
270 }
else if constexpr (I == 2) {
272 }
else if constexpr (I == 3) {
275 hi_static_no_default();
281 return _col0.z() == 0.0f
and _col0.w() == 0.0f
and _col1.z() == 0.0f
and _col1.w() == 0.0f
and _col2.x() == 0.0f
and
282 _col2.y() == 0.0f
and _col2.z() == 1.0f
and _col2.w() == 0.0f
and _col3.z() == 0.0f
and _col3.w() == 1.0f;
292 return {_col0 * rhs.xxxx() + _col1 * rhs.yyyy() + _col2 * rhs.zzzz() + _col3 * rhs.wwww()};
299 auto tmp =
transpose(rhs._col0, rhs._col1, rhs._col2, rhs._col3);
336 template<
char DstX,
char DstY,
char DstZ,
char DstW = 'w'>
349 return equal(lhs._col0, rhs._col0)
and equal(lhs._col1, rhs._col1)
and equal(lhs._col3, rhs._col3);
361 hilet
s0c0 = _col0 * _col1.yxwz();
367 hilet
s1c1 = _col0 * _col2.yxwz();
374 hilet
s2c2 = _col0 * _col3.yxwz();
380 hilet
s3c3 = _col1 * _col2.yxwz();
387 hilet
s4c4 = _col1 * _col3.yxwz();
393 hilet
s5c5 = _col2 * _col3.yxwz();
415 if (det.x() == 0.0f) {
472 if constexpr (
Axis ==
'x') {
473 return f32x4{1.0f, 0.0f, 0.0f, 0.0f};
474 }
else if constexpr (
Axis ==
'X') {
475 return f32x4{-1.0f, 0.0f, 0.0f, 0.0f};
476 }
else if constexpr (
Axis ==
'y') {
477 return f32x4{0.0f, 1.0f, 0.0f, 0.0f};
478 }
else if constexpr (
Axis ==
'Y') {
479 return f32x4{0.0f, -1.0f, 0.0f, 0.0f};
480 }
else if constexpr (
Axis ==
'z') {
481 return f32x4{0.0f, 0.0f, 1.0f, 0.0f};
482 }
else if constexpr (
Axis ==
'Z') {
483 return f32x4{0.0f, 0.0f, -1.0f, 0.0f};
484 }
else if constexpr (
Axis ==
'w') {
485 return f32x4{0.0f, 0.0f, 0.0f, 1.0f};
486 }
else if constexpr (
Axis ==
'W') {
487 return f32x4{0.0f, 0.0f, 0.0f, -1.0f};
489 hi_static_no_default();
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
@ one
The number was one, and this means something in the current language.
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:29
Horizontal/Vertical alignment combination.
Definition alignment.hpp:242
A 2D or 3D homogenius matrix for transforming homogenious vectors and points.
Definition matrix2.hpp:27
constexpr matrix2(rotate2 const &rhs) noexcept
Convert quaternion to matrix.
Definition matrix2.hpp:182
constexpr matrix2(float c0r0, float c1r0, float c2r0, float c0r1, float c1r1, float c2r1, float c0r2, float c1r2, float c2r2) noexcept
Construct a 3x3 matrix from scalar values.
Definition matrix2.hpp:103
constexpr friend bool operator==(matrix2 const &lhs, matrix2 const &rhs) noexcept
Compare two matrices potentially of different dimensions.
Definition matrix2.hpp:347
constexpr matrix2(vector3 col0, vector3 col1, vector3 col2, vector3 col3=vector3{}) noexcept
Construct a matrix from four vectors.
Definition matrix2.hpp:65
friend constexpr f32x4 & get(matrix2 &rhs) noexcept
Get a column.
Definition matrix2.hpp:264
constexpr matrix2(float c0r0, float c1r0, float c2r0, float c3r0, float c0r1, float c1r1, float c2r1, float c3r1, float c0r2, float c1r2, float c2r2, float c3r2, float c0r3, float c1r3, float c2r3, float c3r3) noexcept
Construct a 4x4 matrix from scalar values.
Definition matrix2.hpp:140
constexpr f32x4 operator*(f32x4 const &rhs) const noexcept
Transform a f32x4 numeric array by the matrix.
Definition matrix2.hpp:290
static constexpr matrix2 uniform(aarectangle src_rectangle, aarectangle dst_rectangle, alignment alignment) noexcept
Create a transformation matrix to translate and uniformly-scale a src_rectangle to a dst_rectangle.
Definition matrix2.hpp:229
friend constexpr matrix2 transpose(matrix2 const &rhs) noexcept
Matrix transpose.
Definition matrix2.hpp:297
constexpr matrix2 operator~() const
Invert matrix.
Definition matrix2.hpp:354
constexpr matrix2(f32x4 col0, f32x4 col1, f32x4 col2, f32x4 col3=f32x4{0.0f, 0.0f, 0.0f, 1.0f}) noexcept
Construct a matrix from four columns.
Definition matrix2.hpp:52
constexpr matrix2(vector2 col0, vector2 col1) noexcept
Construct a matrix from two vectors.
Definition matrix2.hpp:79
constexpr matrix2() noexcept
Constructs an identity matrix.
Definition matrix2.hpp:36
friend constexpr matrix2 reflect(matrix2 const &rhs) noexcept
Reflect axis of a matrix.
Definition matrix2.hpp:337
friend constexpr f32x4 const & get(matrix2 const &rhs) noexcept
Get a column.
Definition matrix2.hpp:243
Definition rotate2.hpp:10
static constexpr scale2 uniform(extent2 src_extent, extent2 dst_extent) noexcept
Get a uniform-scale-transform to scale an extent to another extent.
Definition scale2.hpp:46
Definition translate2.hpp:14
static constexpr translate2 align(aarectangle src_rectangle, aarectangle dst_rectangle, alignment alignment) noexcept
Align a rectangle within another rectangle.
Definition translate2.hpp:80
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector2.hpp:19
A high-level geometric vector Part of the high-level vector, point, mat and color types.
Definition vector3.hpp:20