5#ifndef FLUTTER_IMPELLER_GEOMETRY_VECTOR_H_
6#define FLUTTER_IMPELLER_GEOMETRY_VECTOR_H_
55 return ((
x * other.
x) + (
y * other.
y) + (
z * other.
z));
59 return {std::fabs(
x), std::fabs(
y), std::fabs(
z)};
64 (
y * other.
z) - (
z * other.
y),
65 (
z * other.
x) - (
x * other.
z),
66 (
x * other.
y) - (
y * other.
x)
91 return v.
x ==
x && v.
y ==
y && v.
z ==
z;
95 return v.
x !=
x || v.
y !=
y || v.
z !=
z;
119 template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
134 template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
164 template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
173 template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
179 return *
this + (v - *
this) * t;
197 aScale *
a.
x + bScale *
b.x,
198 aScale *
a.
y + bScale *
b.y,
199 aScale *
a.z + bScale *
b.z,
208template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
213template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
218template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
223template <
class U,
class = std::enable_if_t<std::is_arithmetic_v<U>>>
246 :
x(c.red),
y(c.green),
z(c.blue),
w(c.alpha) {}
260 return Vector4(
x * inverse,
y * inverse,
z * inverse,
w * inverse);
264 return (
x == v.
x) && (
y == v.
y) && (
z == v.
z) && (
w == v.
w);
268 return (
x != v.
x) || (
y != v.
y) || (
z != v.
z) || (
w != v.
w);
310 return *
this + (v - *
this) * t;
316static_assert(
sizeof(Vector3) == 3 *
sizeof(
Scalar));
317static_assert(
sizeof(Vector4) == 4 *
sizeof(
Scalar));
324 out <<
"(" <<
p.x <<
", " <<
p.y <<
", " <<
p.z <<
")";
329 out <<
"(" <<
p.x <<
", " <<
p.y <<
", " <<
p.z <<
", " <<
p.w <<
")";
static void round(SkPoint *p)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
constexpr Color operator-(T value, const Color &c)
constexpr Color operator/(T value, const Color &c)
constexpr Color operator+(T value, const Color &c)
constexpr Color operator*(T value, const Color &c)
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
SIN Vec< N, float > floor(const Vec< N, float > &x)
SIN Vec< N, float > ceil(const Vec< N, float > &x)
std::ostream & operator<<(std::ostream &out, const impeller::Color &c)
constexpr Vector3 operator-(const Vector3 &v) const
constexpr Vector3 Lerp(const Vector3 &v, Scalar t) const
constexpr Vector3 operator*=(U scale)
constexpr Vector3 operator*(U scale) const
constexpr Vector3 Cross(const Vector3 &other) const
constexpr Vector3(Scalar x, Scalar y, Scalar z)
constexpr Vector3 operator/(const Vector3 &v) const
constexpr Vector3 Normalize() const
constexpr Vector3 operator-() const
constexpr Vector3(const Color &c)
constexpr Vector3(Scalar x, Scalar y)
constexpr Vector3(const Size &s)
constexpr Vector3 operator+(const Vector3 &v) const
std::string ToString() const
constexpr Vector3 operator+=(const Vector3 &p)
constexpr Vector3 operator-(Scalar s) const
constexpr Vector3 operator/=(U scale)
constexpr bool operator==(const Vector3 &v) const
constexpr Vector3 operator+(Scalar s) const
constexpr Vector3 operator/=(const Vector3 &p)
constexpr Vector3 Max(const Vector3 &p) const
constexpr Vector3 Ceil() const
constexpr Vector3 operator/(U scale) const
constexpr Scalar Length() const
constexpr bool operator!=(const Vector3 &v) const
constexpr Vector3 Abs() const
constexpr Vector3 Round() const
static constexpr Vector3 Combine(const Vector3 &a, Scalar aScale, const Vector3 &b, Scalar bScale)
constexpr Vector3(const Point &p)
constexpr Scalar Dot(const Vector3 &other) const
constexpr Vector3 operator*=(const Vector3 &p)
constexpr Vector3 Floor() const
constexpr Vector3 operator*(const Vector3 &v) const
constexpr Vector3 operator-=(const Vector3 &p)
constexpr Vector3 Min(const Vector3 &p) const
constexpr Vector4(const Point &p)
constexpr Vector4 Ceil() const
constexpr Vector4 Min(const Vector4 &p) const
constexpr Vector4(Scalar x, Scalar y, Scalar z, Scalar w)
constexpr Vector4 Lerp(const Vector4 &v, Scalar t) const
Vector4 Normalize() const
constexpr Vector4 operator+(const Vector4 &v) const
std::string ToString() const
constexpr Vector4(std::array< Scalar, 4 > values)
constexpr Vector4 Floor() const
constexpr Vector4(const Color &c)
constexpr Vector4 Max(const Vector4 &p) const
constexpr bool operator!=(const Vector4 &v) const
constexpr Vector4 operator-(const Vector4 &v) const
constexpr Vector4 operator*(const Vector4 &v) const
constexpr Vector4(const Vector3 &v)
constexpr Vector4 operator*(Scalar f) const
constexpr bool operator==(const Vector4 &v) const
constexpr Vector4 Round() const