Flutter Impeller
impeller::LinearPathComponent Struct Reference

#include <path_component.h>

Public Member Functions

 LinearPathComponent ()
 
 LinearPathComponent (Point ap1, Point ap2)
 
Point Solve (Scalar time) const
 
std::vector< PointCreatePolyline () 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 27 of file path_component.h.

Constructor & Destructor Documentation

◆ LinearPathComponent() [1/2]

impeller::LinearPathComponent::LinearPathComponent ( )
inline

Definition at line 31 of file path_component.h.

31 {}

◆ LinearPathComponent() [2/2]

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

Definition at line 33 of file path_component.h.

33 : p1(ap1), p2(ap2) {}

Member Function Documentation

◆ CreatePolyline()

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

Definition at line 62 of file path_component.cc.

62  {
63  return {p2};
64 }

References p2.

◆ Extrema()

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

Definition at line 66 of file path_component.cc.

66  {
67  return {p1, p2};
68 }

References p1, and p2.

◆ GetEndDirection()

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

Definition at line 77 of file path_component.cc.

77  {
78  if (p1 == p2) {
79  return std::nullopt;
80  }
81  return (p2 - p1).Normalize();
82 }

References p1, and p2.

Referenced by impeller::PathComponentEndDirectionVisitor::operator()().

◆ GetStartDirection()

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

Definition at line 70 of file path_component.cc.

70  {
71  if (p1 == p2) {
72  return std::nullopt;
73  }
74  return (p1 - p2).Normalize();
75 }

References p1, and p2.

Referenced by impeller::PathComponentStartDirectionVisitor::operator()().

◆ operator==()

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

Definition at line 41 of file path_component.h.

41  {
42  return p1 == other.p1 && p2 == other.p2;
43  }

References p1, and p2.

◆ Solve()

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

Definition at line 55 of file path_component.cc.

55  {
56  return {
57  LinearSolve(time, p1.x, p2.x), // x
58  LinearSolve(time, p1.y, p2.y), // y
59  };
60 }

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:
impeller::TPoint::y
Type y
Definition: point.h:24
impeller::LinearPathComponent::p2
Point p2
Definition: path_component.h:29
impeller::LinearPathComponent::p1
Point p1
Definition: path_component.h:28
impeller::TPoint::x
Type x
Definition: point.h:23
impeller::LinearSolve
static Scalar LinearSolve(Scalar t, Scalar p0, Scalar p1)
Definition: path_component.cc:15