Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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< TypeMakeXY (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 ( )
constexprdefault

◆ TPoint() [2/4]

template<class T >
template<class U >
constexpr impeller::TPoint< T >::TPoint ( const TPoint< U > &  other)
inlineexplicitconstexpr

Definition at line 37 of file point.h.

38 : TPoint(static_cast<Type>(other.x), static_cast<Type>(other.y)) {}
constexpr TPoint()=default

◆ TPoint() [3/4]

template<class T >
template<class U >
constexpr impeller::TPoint< T >::TPoint ( const TSize< U > &  other)
inlineexplicitconstexpr

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 
)
inlineconstexpr

Definition at line 45 of file point.h.

45: x(x), y(y) {}

Member Function Documentation

◆ Abs()

template<class T >
constexpr TPoint impeller::TPoint< T >::Abs ( ) const
inlineconstexpr

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.

◆ AngleTo()

template<class T >
constexpr Radians impeller::TPoint< T >::AngleTo ( const TPoint< T > &  p) const
inlineconstexpr

Definition at line 330 of file point.h.

330 {
331 return Radians{std::atan2(this->Cross(p), this->Dot(p))};
332 }
constexpr Type Cross(const TPoint &p) const
Definition point.h:295
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().

◆ Ceil()

template<class T >
constexpr TPoint impeller::TPoint< T >::Ceil ( ) const
inlineconstexpr

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.

◆ Cross() [1/2]

template<class T >
constexpr Type impeller::TPoint< T >::Cross ( const TPoint< T > &  p) const
inlineconstexpr

◆ 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 
)
inlinestaticconstexpr

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 }

◆ Dot()

template<class T >
constexpr Type impeller::TPoint< T >::Dot ( const TPoint< T > &  p) const
inlineconstexpr

◆ Floor()

template<class T >
constexpr TPoint impeller::TPoint< T >::Floor ( ) const
inlineconstexpr

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.

◆ GetDistance()

template<class T >
constexpr Type impeller::TPoint< T >::GetDistance ( const TPoint< T > &  p) const
inlineconstexpr

Definition at line 201 of file point.h.

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

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

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

◆ GetDistanceSquared()

template<class T >
constexpr Type impeller::TPoint< T >::GetDistanceSquared ( const TPoint< T > &  p) const
inlineconstexpr

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
inlineconstexpr

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 }
Type GetDistanceToSegmentSquared(TPoint p0, TPoint p1) const
Definition point.h:218

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

◆ 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 }
float Scalar
Definition scalar.h:19

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

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

◆ GetLength()

template<class T >
constexpr Type impeller::TPoint< T >::GetLength ( ) const
inlineconstexpr

◆ GetLengthSquared()

template<class T >
constexpr Type impeller::TPoint< T >::GetLengthSquared ( ) const
inlineconstexpr

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.

Referenced by flutter::DlPath::WithOffset().

◆ IsZero()

template<class T >
constexpr bool impeller::TPoint< T >::IsZero ( ) const
inlineconstexpr

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(), and flutter::DlPath::WithOffset().

◆ Lerp()

template<class T >
constexpr TPoint impeller::TPoint< T >::Lerp ( const TPoint< T > &  p,
Scalar  t 
) const
inlineconstexpr

Definition at line 334 of file point.h.

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

◆ MakeXY()

template<class T >
static constexpr TPoint< Type > impeller::TPoint< T >::MakeXY ( Type  x,
Type  y 
)
inlinestaticconstexpr

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
inlineconstexpr

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().

◆ Min()

template<class T >
constexpr TPoint impeller::TPoint< T >::Min ( const TPoint< T > &  p) const
inlineconstexpr

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().

◆ Normalize()

template<class T >
constexpr TPoint impeller::TPoint< T >::Normalize ( ) const
inlineconstexpr

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 }
size_t length
constexpr Type GetLength() const
Definition point.h:209

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

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

◆ operator!=()

template<class T >
constexpr bool impeller::TPoint< T >::operator!= ( const TPoint< T > &  p) const
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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* ( scale) const
inlineconstexpr

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*= ( 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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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/ ( d) const
inlineconstexpr

Definition at line 168 of file point.h.

168 {
169 return {static_cast<Type>(x / d), static_cast<Type>(y / d)};
170 }
auto & d
Definition main.cc:28

References d, 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/= ( 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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

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
inlineconstexpr

Definition at line 310 of file point.h.

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

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

◆ Rotate()

template<class T >
constexpr TPoint impeller::TPoint< T >::Rotate ( const Radians angle) const
inlineconstexpr

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.

◆ Round() [1/2]

template<class T >
constexpr TPoint impeller::TPoint< T >::Round ( ) const
inlineconstexpr

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)
inlinestaticconstexpr

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().

Member Data Documentation

◆ x

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

Definition at line 31 of file point.h.

31{};

Referenced by impeller::TPoint< T >::Abs(), flutter::AccumulationRect::accumulate(), flutter::TranslateEntry::apply(), flutter::testing::BM_DrawArc(), flutter::testing::BM_DrawImage(), flutter::testing::BM_DrawImageNine(), flutter::testing::BM_DrawImageRect(), flutter::testing::BM_DrawOval(), flutter::testing::BM_DrawRect(), impeller::LineContents::CalculatePerVertex(), impeller::TPoint< T >::Ceil(), impeller::TextFrame::ComputeSubpixelPosition(), impeller::TextContents::ComputeVertexData(), impeller::SolidRRectLikeBlurContents::Concat(), flutter::DlPathBuilder::ConicCurveTo(), flutter::DlPath::Contains(), impeller::TRect< T >::Contains(), flutter::testing::containsInclusive(), impeller::TRect< T >::ContainsInclusive(), impeller::CornerContains(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), impeller::TPoint< T >::Cross(), flutter::DlPathBuilder::CubicCurveTo(), FLUTTER_ASSERT_ARC::CGPathReceiver::CubicTo(), flutter::DisplayListLayer::DisplayListLayer(), impeller::testing::DoGradientOvalStrokeMaskBlur(), impeller::TPoint< T >::Dot(), impeller::DrawGlyph(), flutter::DlSkCanvasAdapter::DrawImage(), flutter::DlSkCanvasDispatcher::drawImage(), impeller::DlDispatcherBase::drawImage(), 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(), flutter::testing::GetTestPoints(), flutter::DlImageFilter::inset_device_bounds(), impeller::TPoint< T >::IsFinite(), impeller::TPoint< T >::IsZero(), impeller::LerpHackKernelSamples(), FLUTTER_ASSERT_ARC::CGPathReceiver::LineTo(), flutter::DlPathBuilder::LineTo(), 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::TPoint< T >::Max(), impeller::TPoint< T >::Min(), FLUTTER_ASSERT_ARC::CGPathReceiver::MoveTo(), flutter::DlPathBuilder::MoveTo(), impeller::TPoint< T >::Normalize(), impeller::GoldenPlaygroundTest::OpenPlaygroundHere(), impeller::TPoint< T >::operator!=(), impeller::Matrix::operator*(), impeller::TPoint< T >::operator*(), impeller::operator*(), impeller::TPoint< T >::operator*(), impeller::Trig::operator*(), impeller::TPoint< T >::operator*(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator+(), impeller::operator+(), impeller::TPoint< T >::operator+(), impeller::TPoint< T >::operator+=(), impeller::TPoint< T >::operator+=(), impeller::TPoint< T >::operator-(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-=(), impeller::TPoint< T >::operator-=(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::operator/(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::TPoint< T >::operator/=(), impeller::TPoint< T >::operator/=(), impeller::TPoint< T >::operator/=(), std::operator<<(), impeller::TPoint< T >::operator==(), flutter::DlImageFilter::outset_device_bounds(), flutter::testing::BoundsTolerance::overflows(), flutter::DisplayListLayer::Paint(), flutter::OpacityLayer::Paint(), impeller::TPoint< T >::PerpendicularLeft(), impeller::TPoint< T >::PerpendicularRight(), PointNear(), flutter::DlPathBuilder::QuadraticCurveTo(), FLUTTER_ASSERT_ARC::CGPathReceiver::QuadTo(), impeller::StrokePathSegmentReceiver::RecordArc(), impeller::SolidRRectLikeBlurContents::Render(), flutter::testing::RenderTextInCanvasSkia(), impeller::TPoint< T >::Rotate(), impeller::TPoint< T >::Round(), impeller::TPoint< T >::Round(), flutter::testing::BoundsTolerance::Scale(), impeller::TRect< T >::Scale(), impeller::TRect< T >::Shift(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::ToSk(), impeller::interop::ToSkiaType(), impeller::Matrix::TransformDirection(), impeller::Matrix::TransformHomogenous(), flutter::LayerStateStack::MutatorContext::translate(), impeller::interop::DisplayListBuilder::Translate(), and flutter::DlPath::WithOffset().

◆ y

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

Definition at line 32 of file point.h.

32{};

Referenced by impeller::TPoint< T >::Abs(), flutter::AccumulationRect::accumulate(), flutter::TranslateEntry::apply(), flutter::testing::BM_DrawArc(), flutter::testing::BM_DrawImage(), flutter::testing::BM_DrawImageNine(), flutter::testing::BM_DrawImageRect(), flutter::testing::BM_DrawOval(), flutter::testing::BM_DrawRect(), impeller::LineContents::CalculatePerVertex(), impeller::TPoint< T >::Ceil(), impeller::TextFrame::ComputeSubpixelPosition(), impeller::TextContents::ComputeVertexData(), impeller::SolidRRectLikeBlurContents::Concat(), flutter::DlPathBuilder::ConicCurveTo(), flutter::DlPath::Contains(), impeller::TRect< T >::Contains(), flutter::testing::containsInclusive(), impeller::TRect< T >::ContainsInclusive(), impeller::CornerContains(), impeller::Paint::MaskBlurDescriptor::CreateMaskBlur(), impeller::TPoint< T >::Cross(), flutter::DlPathBuilder::CubicCurveTo(), FLUTTER_ASSERT_ARC::CGPathReceiver::CubicTo(), flutter::DisplayListLayer::DisplayListLayer(), impeller::testing::DoGradientOvalStrokeMaskBlur(), impeller::TPoint< T >::Dot(), impeller::DrawGlyph(), flutter::DlSkCanvasAdapter::DrawImage(), flutter::DlSkCanvasDispatcher::drawImage(), impeller::DlDispatcherBase::drawImage(), 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(), flutter::testing::GetTestPoints(), flutter::DlImageFilter::inset_device_bounds(), impeller::TPoint< T >::IsFinite(), impeller::TPoint< T >::IsZero(), impeller::LerpHackKernelSamples(), FLUTTER_ASSERT_ARC::CGPathReceiver::LineTo(), flutter::DlPathBuilder::LineTo(), 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::TPoint< T >::Max(), impeller::TPoint< T >::Min(), FLUTTER_ASSERT_ARC::CGPathReceiver::MoveTo(), flutter::DlPathBuilder::MoveTo(), impeller::TPoint< T >::Normalize(), impeller::GoldenPlaygroundTest::OpenPlaygroundHere(), impeller::TPoint< T >::operator!=(), impeller::Matrix::operator*(), impeller::TPoint< T >::operator*(), impeller::operator*(), impeller::TPoint< T >::operator*(), impeller::Trig::operator*(), impeller::TPoint< T >::operator*(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator*=(), impeller::TPoint< T >::operator+(), impeller::operator+(), impeller::TPoint< T >::operator+(), impeller::TPoint< T >::operator+=(), impeller::TPoint< T >::operator+=(), impeller::TPoint< T >::operator-(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-(), impeller::operator-(), impeller::TPoint< T >::operator-=(), impeller::TPoint< T >::operator-=(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::operator/(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::TPoint< T >::operator/(), impeller::operator/(), impeller::TPoint< T >::operator/=(), impeller::TPoint< T >::operator/=(), impeller::TPoint< T >::operator/=(), std::operator<<(), impeller::TPoint< T >::operator==(), flutter::DlImageFilter::outset_device_bounds(), flutter::testing::BoundsTolerance::overflows(), flutter::DisplayListLayer::Paint(), flutter::OpacityLayer::Paint(), impeller::TPoint< T >::PerpendicularLeft(), impeller::TPoint< T >::PerpendicularRight(), PointNear(), flutter::DlPathBuilder::QuadraticCurveTo(), FLUTTER_ASSERT_ARC::CGPathReceiver::QuadTo(), impeller::StrokePathSegmentReceiver::RecordArc(), impeller::SolidRRectLikeBlurContents::Render(), flutter::testing::RenderTextInCanvasSkia(), impeller::TPoint< T >::Rotate(), impeller::TPoint< T >::Round(), impeller::TPoint< T >::Round(), flutter::testing::BoundsTolerance::Scale(), impeller::TRect< T >::Scale(), impeller::TRect< T >::Shift(), flutter::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), impeller::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::testing::TEST_P(), flutter::ToSk(), impeller::interop::ToSkiaType(), impeller::Matrix::TransformDirection(), impeller::Matrix::TransformHomogenous(), flutter::LayerStateStack::MutatorContext::translate(), impeller::interop::DisplayListBuilder::Translate(), and flutter::DlPath::WithOffset().


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