Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
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 19 of file path_component.h.

Constructor & Destructor Documentation

◆ LinearPathComponent() [1/2]

impeller::LinearPathComponent::LinearPathComponent ( )
inline

Definition at line 23 of file path_component.h.

23{}

◆ LinearPathComponent() [2/2]

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

Definition at line 25 of file path_component.h.

Member Function Documentation

◆ AppendPolylinePoints()

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

Definition at line 64 of file path_component.cc.

65 {
66 if (points.size() == 0 || points.back() != p2) {
67 points.push_back(p2);
68 }
69}
static const int points[]

◆ Extrema()

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

Definition at line 71 of file path_component.cc.

71 {
72 return {p1, p2};
73}

◆ GetEndDirection()

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

Definition at line 82 of file path_component.cc.

82 {
83 if (p1 == p2) {
84 return std::nullopt;
85 }
86 return (p2 - p1).Normalize();
87}

◆ GetStartDirection()

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

Definition at line 75 of file path_component.cc.

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

◆ operator==()

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

Definition at line 33 of file path_component.h.

33 {
34 return p1 == other.p1 && p2 == other.p2;
35 }

◆ Solve()

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

Definition at line 57 of file path_component.cc.

57 {
58 return {
59 LinearSolve(time, p1.x, p2.x), // x
60 LinearSolve(time, p1.y, p2.y), // y
61 };
62}
static Scalar LinearSolve(Scalar t, Scalar p0, Scalar p1)

Member Data Documentation

◆ p1

Point impeller::LinearPathComponent::p1

Definition at line 20 of file path_component.h.

◆ p2

Point impeller::LinearPathComponent::p2

Definition at line 21 of file path_component.h.


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