Flutter Impeller
impeller::LinearPathComponent Struct Reference

#include <path_component.h>

Public Member Functions

 LinearPathComponent ()
 
 LinearPathComponent (Point ap1, Point ap2)
 
Point Solve (Scalar time) const
 
void AppendPolylinePoints (std::vector< Point > &points) const
 
std::vector< PointExtrema () const
 
bool operator== (const LinearPathComponent &other) const
 
std::optional< Vector2GetStartDirection () const
 
std::optional< Vector2GetEndDirection () const
 

Public Attributes

Point p1
 
Point p2
 

Detailed Description

Definition at line 111 of file path_component.h.

Constructor & Destructor Documentation

◆ LinearPathComponent() [1/2]

impeller::LinearPathComponent::LinearPathComponent ( )
inline

Definition at line 115 of file path_component.h.

115 {}

◆ LinearPathComponent() [2/2]

impeller::LinearPathComponent::LinearPathComponent ( Point  ap1,
Point  ap2 
)
inline

Definition at line 117 of file path_component.h.

Member Function Documentation

◆ AppendPolylinePoints()

void impeller::LinearPathComponent::AppendPolylinePoints ( std::vector< Point > &  points) const

Definition at line 230 of file path_component.cc.

231  {
232  if (points.size() == 0 || points.back() != p2) {
233  points.push_back(p2);
234  }
235 }

References p2.

Referenced by impeller::Path::CreatePolyline().

◆ Extrema()

std::vector< Point > impeller::LinearPathComponent::Extrema ( ) const

Definition at line 237 of file path_component.cc.

237  {
238  return {p1, p2};
239 }

References p1, and p2.

◆ GetEndDirection()

std::optional< Vector2 > impeller::LinearPathComponent::GetEndDirection ( ) const

Definition at line 248 of file path_component.cc.

248  {
249  if (p1 == p2) {
250  return std::nullopt;
251  }
252  return (p2 - p1).Normalize();
253 }

References p1, and p2.

Referenced by impeller::Path::EndContour().

◆ GetStartDirection()

std::optional< Vector2 > impeller::LinearPathComponent::GetStartDirection ( ) const

Definition at line 241 of file path_component.cc.

241  {
242  if (p1 == p2) {
243  return std::nullopt;
244  }
245  return (p1 - p2).Normalize();
246 }

References p1, and p2.

◆ operator==()

bool impeller::LinearPathComponent::operator== ( const LinearPathComponent other) const
inline

Definition at line 125 of file path_component.h.

125  {
126  return p1 == other.p1 && p2 == other.p2;
127  }

References p1, and p2.

◆ Solve()

Point impeller::LinearPathComponent::Solve ( Scalar  time) const

Definition at line 223 of file path_component.cc.

223  {
224  return {
225  LinearSolve(time, p1.x, p2.x), // x
226  LinearSolve(time, p1.y, p2.y), // y
227  };
228 }
static Scalar LinearSolve(Scalar t, Scalar p0, Scalar p1)

References impeller::LinearSolve(), p1, p2, impeller::TPoint< T >::x, and impeller::TPoint< T >::y.

Member Data Documentation

◆ p1

◆ p2


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