| Flutter Impeller |

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
impeller::TPoint< T > Struct Template Reference

`#include <point.h>`

## Public Types
using | Type = T

## Public Member Functions
constexpr | TPoint ()=default
template<class U >
constexpr | TPoint (const TPoint< U > &other)
template<class U >
constexpr | TPoint (const TSize< U > &other)
constexpr | TPoint (Type x, Type y)
constexpr bool | operator== (const TPoint &p) const
constexpr bool | operator!= (const TPoint &p) const
template<class U >
TPoint | operator+= (const TPoint< U > &p)
template<class U >
TPoint | operator+= (const TSize< U > &s)
template<class U >
TPoint | operator-= (const TPoint< U > &p)
template<class U >
TPoint | operator-= (const TSize< U > &s)
template<class U >
TPoint | operator*= (const TPoint< U > &p)
template<class U >
TPoint | operator*= (const TSize< U > &s)
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
TPoint | operator*= (U scale)
template<class U >
TPoint | operator/= (const TPoint< U > &p)
template<class U >
TPoint | operator/= (const TSize< U > &s)
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
TPoint | operator/= (U scale)
constexpr TPoint | operator- () const
constexpr TPoint | operator+ (const TPoint &p) const
template<class U >
constexpr TPoint | operator+ (const TSize< U > &s) const
constexpr TPoint | operator- (const TPoint &p) const
template<class U >
constexpr TPoint | operator- (const TSize< U > &s) const
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint | operator* (U scale) const
constexpr TPoint | operator* (const TPoint &p) const
template<class U >
constexpr TPoint | operator* (const TSize< U > &s) const
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>
constexpr TPoint | operator/ (U d) const
constexpr TPoint | operator/ (const TPoint &p) const
template<class U >
constexpr TPoint | operator/ (const TSize< U > &s) const
constexpr Type | GetDistanceSquared (const TPoint &p) const
constexpr TPoint | Min (const TPoint &p) const
constexpr TPoint | Max (const TPoint &p) const
constexpr TPoint | Floor () const
constexpr TPoint | Ceil () const
constexpr TPoint | Round () const
constexpr Type | GetDistance (const TPoint &p) const
constexpr Type | GetLengthSquared () const
constexpr Type | GetLength () const
Type | GetDistanceToSegmentSquared (TPoint p0, TPoint p1) const
constexpr Type | GetDistanceToSegment (TPoint p0, TPoint p1) const
constexpr TPoint | Normalize () const
constexpr TPoint | Abs () const
constexpr Type | Cross (const TPoint &p) const
constexpr Type | Dot (const TPoint &p) const
constexpr TPoint | Reflect (const TPoint &axis) const
constexpr TPoint | Rotate (const Radians &angle) const
constexpr TPoint | PerpendicularRight () const
constexpr TPoint | PerpendicularLeft () const
constexpr Radians | AngleTo (const TPoint &p) const
constexpr TPoint | Lerp (const TPoint &p, Scalar t) const
constexpr bool | IsZero () const
| IsFinite () const

## Static Public Member Functions
static constexpr TPoint< Type > | MakeXY (Type x, Type y)
template<class U >
static constexpr TPoint | Round (const TPoint< U > &other)
static constexpr Type | Cross (const TPoint &p0, const TPoint &p1, const TPoint &p2)

## Public Attributes
Type | x = {}
Type | y = {}

## Detailed Description

### template<class T>
struct impeller::TPoint< T >

Definition at line 28 of file point.h.

## Member Typedef Documentation

## ◆ Type

template<class T >

using impeller::TPoint< T >::Type = T

Definition at line 29 of file point.h.

## Constructor & Destructor Documentation

## ◆ TPoint() [1/4]

template<class T >

constexpr impeller::TPoint< T >::TPoint | ( |  | ) |
| constexpr default

## ◆ TPoint() [2/4]

template<class T >
template<class U >

constexpr impeller::TPoint< T >::TPoint | ( | const TPoint< U > & | other | ) |
| inline explicit constexpr

Definition at line 37 of file point.h.

38 : TPoint(static_cast<Type>(other.x), static_cast<Type>(other.y)) {}
impeller::TPoint::Type
T Type
Definition: point.h:29
impeller::TPoint::TPoint
constexpr TPoint()=default

## ◆ TPoint() [3/4]

template<class T >
template<class U >

constexpr impeller::TPoint< T >::TPoint | ( | const TSize< U > & | other | ) |
| inline explicit constexpr

Definition at line 41 of file point.h.

42 : TPoint(static_cast<Type>(other.width),
43 static_cast<Type>(other.height)) {}

## ◆ TPoint() [4/4]

template<class T >

constexpr impeller::TPoint< T >::TPoint | ( | Type | x,
|  | Type | y
| ) |  |
| inline constexpr

Definition at line 45 of file point.h.

45 : x(x), y(y) {}
impeller::TPoint::y
Type y
Definition: point.h:32
impeller::TPoint::x
Type x
Definition: point.h:31

## Member Function Documentation

## ◆ Abs()

template<class T >

constexpr TPoint impeller::TPoint< T >::Abs | ( |  | ) | const
| inline constexpr

Definition at line 293 of file point.h.

293 { return {std::fabs(x), std::fabs(y)}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ AngleTo()

template<class T >

constexpr Radians impeller::TPoint< T >::AngleTo | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 330 of file point.h.

330 {
331 return Radians{std::atan2(this->Cross(p), this->Dot(p))};
332 }
impeller::TPoint::Cross
constexpr Type Cross(const TPoint &p) const
Definition: point.h:295
impeller::TPoint::Dot
constexpr Type Dot(const TPoint &p) const
Definition: point.h:308

References impeller::TPoint< T >::Cross(), and impeller::TPoint< T >::Dot().

Referenced by impeller::SeparatedVector2::AngleTo(), and impeller::testing::TEST().

## ◆ Ceil()

template<class T >

constexpr TPoint impeller::TPoint< T >::Ceil | ( |  | ) | const
| inline constexpr

Definition at line 197 of file point.h.

197 { return {std::ceil(x), std::ceil(y)}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ Cross() [1/2]

template<class T >

constexpr Type impeller::TPoint< T >::Cross | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 295 of file point.h.

295 { return (x * p.y) - (y * p.x); }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::TPoint< T >::AngleTo(), impeller::SeparatedVector2::Cross(), impeller::TPoint< T >::GetDistanceToSegmentSquared(), and impeller::testing::TEST().

## ◆ Cross() [2/2]

template<class T >

static constexpr Type impeller::TPoint< T >::Cross | ( | const TPoint< T > & | p0,
|  | const TPoint< T > & | p1,
|  | const TPoint< T > & | p2
| ) |  |
| inline static constexpr

Return the cross product representing the sign (turning direction) and magnitude (sin of the angle) of the angle from p1 to p2 as viewed from p0.

Equivalent to ((p1 - p0).Cross(p2 - p0)).

Definition at line 302 of file point.h.

304 {
305 return (p1 - p0).Cross(p2 - p0);
306 }
p2
Point p2
Definition: round_superellipse_param.cc:317
p1
Point p1
Definition: round_superellipse_param.cc:313

References p1, and p2.

## ◆ Dot()

template<class T >

constexpr Type impeller::TPoint< T >::Dot | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 308 of file point.h.

308 { return (x * p.x) + (y * p.y); }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::TPoint< T >::AngleTo(), impeller::ComputeConicSubdivisions(), impeller::SeparatedVector2::GetAlignment(), impeller::TPoint< T >::GetDistanceToSegmentSquared(), impeller::TPoint< T >::Reflect(), and impeller::testing::TEST().

## ◆ Floor()

template<class T >

constexpr TPoint impeller::TPoint< T >::Floor | ( |  | ) | const
| inline constexpr

Definition at line 195 of file point.h.

195 { return {std::floor(x), std::floor(y)}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST().

## ◆ GetDistance()

template<class T >

constexpr Type impeller::TPoint< T >::GetDistance | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 201 of file point.h.

201 {
202 return sqrt(GetDistanceSquared(p));
203 }
impeller::TPoint::GetDistanceSquared
constexpr Type GetDistanceSquared(const TPoint &p) const
Definition: point.h:181

References impeller::TPoint< T >::GetDistanceSquared().

Referenced by impeller::DashedLinePathSource::Dispatch(), impeller::Canvas::DrawDashedLine(), impeller::DrawPlaygroundPoint(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ GetDistanceSquared()

template<class T >

constexpr Type impeller::TPoint< T >::GetDistanceSquared | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 181 of file point.h.

181 {
182 double dx = p.x - x;
183 double dy = p.y - y;
184 return dx * dx + dy * dy;
185 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::TPoint< T >::GetDistance(), and impeller::TPoint< T >::GetDistanceToSegmentSquared().

## ◆ GetDistanceToSegment()

template<class T >

constexpr Type impeller::TPoint< T >::GetDistanceToSegment | ( | TPoint< T > | p0,
|  | TPoint< T > | p1
| ) |  | const
| inline constexpr

Returns the distance from this point to the closest point on the line segment p0 -> p1.

If the projection of this point onto the line defined by the two points is between them, the distance to that point is returned. Otherwise, we return the distance to the endpoint that is closer to the projected point.

Definition at line 281 of file point.h.

281 {
282 return std::sqrt(GetDistanceToSegmentSquared(p0, p1));
283 }
impeller::TPoint::GetDistanceToSegmentSquared
Type GetDistanceToSegmentSquared(TPoint p0, TPoint p1) const
Definition: point.h:218

References impeller::TPoint< T >::GetDistanceToSegmentSquared(), and p1.

## ◆ GetDistanceToSegmentSquared()

template<class T >

Type impeller::TPoint< T >::GetDistanceToSegmentSquared | ( | TPoint< T > | p0,
|  | TPoint< T > | p1
| ) |  | const
| inline

Returns the distance (squared) from this point to the closest point on the line segment p0 -> p1.

If the projection of this point onto the line defined by the two points is between them, the distance (squared) to that point is returned. Otherwise, we return the distance (squared) to the endpoint that is closer to the projected point.

Definition at line 218 of file point.h.

218 {
219 // Compute relative vectors to one endpoint of the segment (p0)
220 TPoint u = p1 - p0;
221 TPoint v = *this - p0;
222
223 // Compute the projection of (this point) onto p0->p1.
224 Scalar dot = u.Dot(v);
225 if (dot <= 0) {
226 // The projection lands outside the segment on the p0 side.
227 // The result is the (square of the) distance to p0 (length of v).
228 return v.GetLengthSquared();
229 }
230
231 // The dot product is the product of the length of the two vectors
232 // ||u|| and ||v|| and the cosine of the angle between them. The length
233 // of the v vector times the cosine is the same as the length of
234 // the projection of the v vector onto the u vector (consider a right
235 // triangle [(0,0), v, v_projected], the length of v multipled by the
236 // cosine is the length of v_projected).
237 //
238 // Thus the dot product is also the product of the u vector and the
239 // projected shadow of the v vector onto the u vector.
240 //
241 // So, if the dot product is larger than the square of the length of
242 // the u vector, then the v vector was projected onto the line beyond
243 // the end of the u vector and so we can use the distance formula to
244 // that endpoint as our result.
245 Scalar uLengthSquared = u.GetLengthSquared();
246 if (dot >= uLengthSquared) {
247 // The projection lands outside the segment on the p1 side.
248 // The result is the (square of the) distance to p1.
249 return GetDistanceSquared(p1);
250 }
251
252 // We must now compute the distance from this point to its projection
253 // on to the segment.
254 //
255 // We compute the cross product of the two vectors u and v which
256 // gives us the area of the parallelogram [(0,0), u, u+v, v]. That
257 // parallelogram area is also the product of the length of one of its
258 // sides and the height perpendicular to that side. We have the length
259 // of one side which is the length of the segment itself (squared) as
260 // uLengthSquared, so if we divide the parallelogram area (squared)
261 // by uLengthSquared then we will get its height (squared) relative to u.
262 //
263 // That height is also the distance from this point to the line segment.
264 Scalar cross = u.Cross(v);
265 // The cross product may currently be signed, but we will square it later.
266
267 // To get our height (squared), we want to compute:
268 // result^2 == h^2 == (cross * cross / uLengthSquared)
269 //
270 // We reorder the equation slightly to avoid infinities:
271 return (cross / uLengthSquared) * cross;
272 }
impeller::Scalar
float Scalar
Definition: scalar.h:19

References impeller::TPoint< T >::Cross(), impeller::TPoint< T >::Dot(), impeller::TPoint< T >::GetDistanceSquared(), impeller::TPoint< T >::GetLengthSquared(), and p1.

Referenced by impeller::TPoint< T >::GetDistanceToSegment().

## ◆ GetLength()

template<class T >

constexpr Type impeller::TPoint< T >::GetLength | ( |  | ) | const
| inline constexpr

Definition at line 209 of file point.h.

209 { return std::sqrt(GetLengthSquared()); }
impeller::TPoint::GetLengthSquared
constexpr Type GetLengthSquared() const
Definition: point.h:205

References impeller::TPoint< T >::GetLengthSquared().

Referenced by impeller::LineContents::CalculatePerVertex(), impeller::LineGeometry::ComputeAlongVector(), impeller::TPoint< T >::Normalize(), impeller::Tessellator::RoundCapLine(), and impeller::testing::TEST().

## ◆ GetLengthSquared()

template<class T >

constexpr Type impeller::TPoint< T >::GetLengthSquared | ( |  | ) | const
| inline constexpr

Definition at line 205 of file point.h.

205 {
206 return static_cast<double>(x) * x + static_cast<double>(y) * y;
207 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::ComputeCubicSubdivisions(), impeller::CornerContains(), impeller::TPoint< T >::GetDistanceToSegmentSquared(), and impeller::TPoint< T >::GetLength().

## ◆ IsFinite()

template<class T >

impeller::TPoint< T >::IsFinite | ( |  | ) | const
| inline

Definition at line 341 of file point.h.

341 { return std::isfinite(x) && std::isfinite(y); }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ IsZero()

template<class T >

constexpr bool impeller::TPoint< T >::IsZero | ( |  | ) | const
| inline constexpr

Definition at line 338 of file point.h.

338 { return x == 0 && y == 0; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::DirectionalMorphologyFilterContents::SetDirection().

## ◆ Lerp()

template<class T >

constexpr TPoint impeller::TPoint< T >::Lerp | ( | const TPoint< T > & | p,
|  | Scalar | t
| ) |  | const
| inline constexpr

Definition at line 334 of file point.h.

334 {
335 return *this + (p - *this) * t;
336 }

Referenced by impeller::testing::TEST().

## ◆ MakeXY()

template<class T >

static constexpr TPoint<Type> impeller::TPoint< T >::MakeXY | ( | Type | x,
|  | Type | y
| ) |  |
| inline static constexpr

Definition at line 47 of file point.h.

47 { return {x, y}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ Max()

template<class T >

constexpr TPoint impeller::TPoint< T >::Max | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 191 of file point.h.

191 {
192 return {std::max<Type>(x, p.x), std::max<Type>(y, p.y)};
193 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::ComputeConicSubdivisions(), and impeller::testing::TEST().

## ◆ Min()

template<class T >

constexpr TPoint impeller::TPoint< T >::Min | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 187 of file point.h.

187 {
188 return {std::min<Type>(x, p.x), std::min<Type>(y, p.y)};
189 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::ComputeConicSubdivisions(), and impeller::testing::TEST().

## ◆ Normalize()

template<class T >

constexpr TPoint impeller::TPoint< T >::Normalize | ( |  | ) | const
| inline constexpr

Definition at line 285 of file point.h.

285 {
286 const auto length = GetLength();
287 if (length == 0) {
288 return {1, 0};
289 }
290 return {x / length, y / length};
291 }
impeller::TPoint::GetLength
constexpr Type GetLength() const
Definition: point.h:209

References impeller::TPoint< T >::GetLength(), impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::DirectionalMorphologyFilterContents::SetDirection(), and impeller::testing::TEST().

## ◆ operator!=()

template<class T >

constexpr bool impeller::TPoint< T >::operator!= | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 59 of file point.h.

59 {
60 return p.x != x || p.y != y;
61 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*() [1/3]

template<class T >

constexpr TPoint impeller::TPoint< T >::operator* | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 158 of file point.h.

158 {
159 return {x * p.x, y * p.y};
160 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*() [2/3]

template<class T >
template<class U >

constexpr TPoint impeller::TPoint< T >::operator* | ( | const TSize< U > & | s | ) | const
| inline constexpr

Definition at line 163 of file point.h.

163 {
164 return {x * static_cast<Type>(s.width), y * static_cast<Type>(s.height)};
165 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*() [3/3]

template<class T >
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr TPoint impeller::TPoint< T >::operator* | ( | U | scale | ) | const
| inline constexpr

Definition at line 154 of file point.h.

154 {
155 return {static_cast<Type>(x * scale), static_cast<Type>(y * scale)};
156 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*=() [1/3]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator*= | ( | const TPoint< U > & | p | ) |
| inline

Definition at line 92 of file point.h.

92 {
93 x *= static_cast<Type>(p.x);
94 y *= static_cast<Type>(p.y);
95 return *this;
96 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*=() [2/3]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator*= | ( | const TSize< U > & | s | ) |
| inline

Definition at line 99 of file point.h.

99 {
100 x *= static_cast<Type>(s.width);
101 y *= static_cast<Type>(s.height);
102 return *this;
103 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator*=() [3/3]

template<class T >
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

TPoint impeller::TPoint< T >::operator*= | ( | U | scale | ) |
| inline

Definition at line 106 of file point.h.

106 {
107 x *= static_cast<Type>(scale);
108 y *= static_cast<Type>(scale);
109 return *this;
110 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator+() [1/2]

template<class T >

constexpr TPoint impeller::TPoint< T >::operator+ | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 135 of file point.h.

135 {
136 return {x + p.x, y + p.y};
137 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator+() [2/2]

template<class T >
template<class U >

constexpr TPoint impeller::TPoint< T >::operator+ | ( | const TSize< U > & | s | ) | const
| inline constexpr

Definition at line 140 of file point.h.

140 {
141 return {x + static_cast<Type>(s.width), y + static_cast<Type>(s.height)};
142 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator+=() [1/2]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator+= | ( | const TPoint< U > & | p | ) |
| inline

Definition at line 64 of file point.h.

64 {
65 x += static_cast<Type>(p.x);
66 y += static_cast<Type>(p.y);
67 return *this;
68 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator+=() [2/2]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator+= | ( | const TSize< U > & | s | ) |
| inline

Definition at line 71 of file point.h.

71 {
72 x += static_cast<Type>(s.width);
73 y += static_cast<Type>(s.height);
74 return *this;
75 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [1/3]

template<class T >

constexpr TPoint impeller::TPoint< T >::operator- | ( |  | ) | const
| inline constexpr

Definition at line 133 of file point.h.

133 { return {-x, -y}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [2/3]

template<class T >

constexpr TPoint impeller::TPoint< T >::operator- | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 144 of file point.h.

144 {
145 return {x - p.x, y - p.y};
146 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-() [3/3]

template<class T >
template<class U >

constexpr TPoint impeller::TPoint< T >::operator- | ( | const TSize< U > & | s | ) | const
| inline constexpr

Definition at line 149 of file point.h.

149 {
150 return {x - static_cast<Type>(s.width), y - static_cast<Type>(s.height)};
151 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-=() [1/2]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator-= | ( | const TPoint< U > & | p | ) |
| inline

Definition at line 78 of file point.h.

78 {
79 x -= static_cast<Type>(p.x);
80 y -= static_cast<Type>(p.y);
81 return *this;
82 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator-=() [2/2]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator-= | ( | const TSize< U > & | s | ) |
| inline

Definition at line 85 of file point.h.

85 {
86 x -= static_cast<Type>(s.width);
87 y -= static_cast<Type>(s.height);
88 return *this;
89 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [1/3]

template<class T >

constexpr TPoint impeller::TPoint< T >::operator/ | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 172 of file point.h.

172 {
173 return {x / p.x, y / p.y};
174 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [2/3]

template<class T >
template<class U >

constexpr TPoint impeller::TPoint< T >::operator/ | ( | const TSize< U > & | s | ) | const
| inline constexpr

Definition at line 177 of file point.h.

177 {
178 return {x / static_cast<Type>(s.width), y / static_cast<Type>(s.height)};
179 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/() [3/3]

template<class T >
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

constexpr TPoint impeller::TPoint< T >::operator/ | ( | U | d | ) | const
| inline constexpr

Definition at line 168 of file point.h.

168 {
169 return {static_cast<Type>(x / d), static_cast<Type>(y / d)};
170 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/=() [1/3]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator/= | ( | const TPoint< U > & | p | ) |
| inline

Definition at line 113 of file point.h.

113 {
114 x /= static_cast<Type>(p.x);
115 y /= static_cast<Type>(p.y);
116 return *this;
117 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/=() [2/3]

template<class T >
template<class U >

TPoint impeller::TPoint< T >::operator/= | ( | const TSize< U > & | s | ) |
| inline

Definition at line 120 of file point.h.

120 {
121 x /= static_cast<Type>(s.width);
122 y /= static_cast<Type>(s.height);
123 return *this;
124 }

References impeller::TSize< T >::height, impeller::TSize< T >::width, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator/=() [3/3]

template<class T >
template<class U , class = std::enable_if_t<std::is_arithmetic_v<U>>>

TPoint impeller::TPoint< T >::operator/= | ( | U | scale | ) |
| inline

Definition at line 127 of file point.h.

127 {
128 x /= static_cast<Type>(scale);
129 y /= static_cast<Type>(scale);
130 return *this;
131 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ operator==()

template<class T >

constexpr bool impeller::TPoint< T >::operator== | ( | const TPoint< T > & | p | ) | const
| inline constexpr

Definition at line 55 of file point.h.

55 {
56 return p.x == x && p.y == y;
57 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ PerpendicularLeft()

template<class T >

constexpr TPoint impeller::TPoint< T >::PerpendicularLeft | ( |  | ) | const
| inline constexpr

Return the perpendicular vector turning to the left (Counterclockwise) in the logical coordinate system where X increases to the right and Y increases downward.

Definition at line 328 of file point.h.

328 { return {y, -x}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ PerpendicularRight()

template<class T >

constexpr TPoint impeller::TPoint< T >::PerpendicularRight | ( |  | ) | const
| inline constexpr

Return the perpendicular vector turning to the right (Clockwise) in the logical coordinate system where X increases to the right and Y increases downward.

Definition at line 323 of file point.h.

323 { return {-y, x}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ Reflect()

template<class T >

constexpr TPoint impeller::TPoint< T >::Reflect | ( | const TPoint< T > & | axis | ) | const
| inline constexpr

Definition at line 310 of file point.h.

310 {
311 return *this - axis * this->Dot(axis) * 2;
312 }

References impeller::TPoint< T >::Dot().

Referenced by impeller::testing::TEST().

## ◆ Rotate()

template<class T >

constexpr TPoint impeller::TPoint< T >::Rotate | ( | const Radians & | angle | ) | const
| inline constexpr

Definition at line 314 of file point.h.

314 {
315 const auto cos_a = std::cosf(angle.radians);
316 const auto sin_a = std::sinf(angle.radians);
317 return {x * cos_a - y * sin_a, x * sin_a + y * cos_a};
318 }

References impeller::Radians::radians, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::testing::TEST(), impeller::testing::TEST_P(), and flutter::testing::TEST_P().

## ◆ Round() [1/2]

template<class T >

constexpr TPoint impeller::TPoint< T >::Round | ( |  | ) | const
| inline constexpr

Definition at line 199 of file point.h.

199 { return {std::round(x), std::round(y)}; }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

## ◆ Round() [2/2]

template<class T >
template<class U >

static constexpr TPoint impeller::TPoint< T >::Round | ( | const TPoint< U > & | other | ) |
| inline static constexpr

Definition at line 50 of file point.h.

50 {
51 return TPoint{static_cast<Type>(std::round(other.x)),
52 static_cast<Type>(std::round(other.y))};
53 }

References impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Referenced by impeller::TextContents::ComputeVertexData(), and impeller::testing::TEST().

## Member Data Documentation

## ◆ x

template<class T >

Type impeller::TPoint< T >::x = {}

Definition at line 31 of file point.h.

Referenced by impeller::TPoint< T >::Abs(), impeller::LineContents::CalculatePerVertex(), impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::TPoint< T >::Ceil(), impeller::TextFrame::ComputeSubpixelPosition(), impeller::TextContents::ComputeVertexData(), impeller::SolidRRectLikeBlurContents::Concat(), impeller::TRect< T >::Contains(), impeller::TRect< T >::ContainsInclusive(), impeller::CornerContains(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), impeller::TPoint< T >::Cross(), impeller::EllipsePathSource::Dispatch(), impeller::testing::DoGradientOvalStrokeMaskBlur(), impeller::TPoint< T >::Dot(), impeller::Canvas::DrawCircle(), impeller::DrawGlyph(), impeller::interop::DisplayListBuilder::DrawParagraph(), impeller::DrawPlaygroundPoint(), impeller::eccentricity(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::TRect< T >::Expand(), impeller::TPoint< T >::Floor(), impeller::DashedLinePathSource::GetBounds(), impeller::PlaygroundImpl::GetContentScale(), impeller::PointFieldGeometry::GetCoverage(), impeller::TPoint< T >::GetDistanceSquared(), impeller::GaussianBlurFilterContents::GetFilterSourceCoverage(), impeller::TPoint< T >::GetLengthSquared(), impeller::GaussianBlurFilterContents::GetSigmaX(), impeller::TPoint< T >::IsFinite(), impeller::TPoint< T >::IsZero(), impeller::LerpHackKernelSamples(), impeller::RSTransform::Make(), impeller::TRect< T >::MakeOriginSize(), impeller::Matrix::MakeRotation(), impeller::Matrix::MakeRotationX(), impeller::Matrix::MakeRotationY(), impeller::Matrix::MakeRotationZ(), impeller::Matrix::MakeScale(), impeller::GoldenPlaygroundTest::MakeScreenshot(), impeller::MakeTextFrameFromTextBlobSkia(), impeller::TPoint< T >::MakeXY(), impeller::testing::MaskBlurVariantTest(), impeller::TPoint< T >::Max(), impeller::TPoint< T >::Min(), impeller::TPoint< T >::Normalize(), impeller::GoldenPlaygroundTest::OpenPlaygroundHere(), impeller::TPoint< T >::operator!=(), impeller::Matrix::operator*(), impeller::operator*(), impeller::Trig::operator*(), impeller::TPoint< T >::operator*(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator+(), impeller::operator+(), impeller::TPoint< T >::operator+=(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-=(), impeller::operator/(), impeller::TPoint< T >::operator/(), impeller::TPoint< T >::operator/=(), std::operator<<(), impeller::TPoint< T >::operator==(), impeller::TPoint< T >::PerpendicularLeft(), impeller::TPoint< T >::PerpendicularRight(), PointNear(), impeller::StrokePathSegmentReceiver::RecordArc(), impeller::SolidRRectLikeBlurContents::Render(), impeller::TPoint< T >::Rotate(), impeller::TPoint< T >::Round(), impeller::TRect< T >::Scale(), impeller::TRect< T >::Shift(), impeller::testing::swap_nan(), impeller::testing::TEST(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), impeller::interop::ToSkiaType(), impeller::Matrix::TransformDirection(), impeller::Matrix::TransformHomogenous(), and impeller::interop::DisplayListBuilder::Translate().

## ◆ y

template<class T >

Type impeller::TPoint< T >::y = {}

Definition at line 32 of file point.h.

Referenced by impeller::TPoint< T >::Abs(), impeller::LineContents::CalculatePerVertex(), impeller::testing::CanRenderConicalGradientWithDithering(), impeller::testing::CanRenderSweepGradientWithDithering(), impeller::TPoint< T >::Ceil(), impeller::TextFrame::ComputeSubpixelPosition(), impeller::TextContents::ComputeVertexData(), impeller::SolidRRectLikeBlurContents::Concat(), impeller::TRect< T >::Contains(), impeller::TRect< T >::ContainsInclusive(), impeller::CornerContains(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), impeller::TPoint< T >::Cross(), impeller::EllipsePathSource::Dispatch(), impeller::testing::DoGradientOvalStrokeMaskBlur(), impeller::TPoint< T >::Dot(), impeller::Canvas::DrawCircle(), impeller::DrawGlyph(), impeller::interop::DisplayListBuilder::DrawParagraph(), impeller::DrawPlaygroundPoint(), impeller::eccentricity(), impeller::BlitCopyTextureToTextureCommandGLES::Encode(), impeller::TRect< T >::Expand(), impeller::TPoint< T >::Floor(), impeller::DashedLinePathSource::GetBounds(), impeller::PlaygroundImpl::GetContentScale(), impeller::PointFieldGeometry::GetCoverage(), impeller::TPoint< T >::GetDistanceSquared(), impeller::GaussianBlurFilterContents::GetFilterSourceCoverage(), impeller::TPoint< T >::GetLengthSquared(), impeller::GaussianBlurFilterContents::GetSigmaY(), impeller::TPoint< T >::IsFinite(), impeller::TPoint< T >::IsZero(), impeller::LerpHackKernelSamples(), impeller::RSTransform::Make(), impeller::TRect< T >::MakeOriginSize(), impeller::Matrix::MakeRotation(), impeller::Matrix::MakeRotationX(), impeller::Matrix::MakeRotationY(), impeller::Matrix::MakeRotationZ(), impeller::Matrix::MakeScale(), impeller::GoldenPlaygroundTest::MakeScreenshot(), impeller::TPoint< T >::MakeXY(), impeller::testing::MaskBlurVariantTest(), impeller::TPoint< T >::Max(), impeller::TPoint< T >::Min(), impeller::TPoint< T >::Normalize(), impeller::GoldenPlaygroundTest::OpenPlaygroundHere(), impeller::TPoint< T >::operator!=(), impeller::Matrix::operator*(), impeller::operator*(), impeller::Trig::operator*(), impeller::TPoint< T >::operator*(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator+(), impeller::operator+(), impeller::TPoint< T >::operator+=(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-=(), impeller::operator/(), impeller::TPoint< T >::operator/(), impeller::TPoint< T >::operator/=(), std::operator<<(), impeller::TPoint< T >::operator==(), impeller::TPoint< T >::PerpendicularLeft(), impeller::TPoint< T >::PerpendicularRight(), PointNear(), impeller::StrokePathSegmentReceiver::RecordArc(), impeller::SolidRRectLikeBlurContents::Render(), impeller::TPoint< T >::Rotate(), impeller::TPoint< T >::Round(), impeller::TRect< T >::Scale(), impeller::TRect< T >::Shift(), impeller::testing::swap_nan(), impeller::testing::TEST(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), impeller::interop::ToSkiaType(), impeller::Matrix::TransformDirection(), impeller::Matrix::TransformHomogenous(), and impeller::interop::DisplayListBuilder::Translate().

The documentation for this struct was generated from the following file:

- impeller/geometry/point.h