1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 12:05:07 +00:00
Commit graph

12 commits

Author SHA1 Message Date
Jelle Raaijmakers
16ca9ec762 LibGfx: Templatize VectorN::length()
This allows us to get a `float` length from an `IntVector3` without
needing to convert to `FloatVector3` first.
2022-09-11 22:45:49 +01:00
Jelle Raaijmakers
3279c25553 LibGfx: Allow non-const indexing into VectorN 2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
54a24fe45a LibGfx: Use AK::round_to for VectorN::to_rounded<U> 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
878111abf6 LibGfx: Add VectorN::to_type<T>() 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
dfe002cfd4 LibGfx: Use VectorN dot product of self for length()
No functional changes.
2022-05-09 21:49:48 +02:00
Andreas Kling
3a2118cc7d LibGfx: Fix Clang build failulres in VectorN
Clang didn't accept the friend declaration here, as the class has a
requires clause attached to it, and I couldn't immediately figure
out what it wants instead.

Add accessors for VectorN::m_data and use those where needed instead
for now.
2022-05-05 21:46:42 +02:00
Jelle Raaijmakers
7db68e118c LibGfx: Add Vector::to_rounded<T>() 2022-05-05 20:50:46 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Jelle Raaijmakers
870b835115 LibGfx+LibSoftGPU: Allow indexed reads into Gfx::Vector 2022-03-11 12:30:43 +01:00
Jelle Raaijmakers
62ffe67a9f LibGfx: Reimplement Vector::length() as a loop
This more generic loop supports arbitrary values of `N` and also gets
rid of that strange single argument `AK::hypot` invocation.
2022-03-07 11:00:45 +01:00
Jelle Raaijmakers
d75135663b LibGfx+LibSoftGPU: Add and use Vector.xy()
Also use `.xyz()` where appropriate.
2022-03-07 11:00:45 +01:00
Lenny Maiorani
d144da3a62 LibGfx: Refactor Vector[2,3,4] to VectorN with specializations
`Gfx::Vector[2,3,4]` are nearly identical implementations. This code
redundancy does not follow the DRY (Don't Repeat Yourself) principle
leading to possible out-of-sync errors between the classes.

Combining these classes into a class template which can be specialized
for each needed size makes the differences obvious through
`constexpr-if` blocks and `requires` clauses.
2022-03-04 12:56:05 +01:00