Flutter Engine
The Flutter Engine
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 39 of file path_component.h.

Constructor & Destructor Documentation

◆ LinearPathComponent() [1/2]

impeller::LinearPathComponent::LinearPathComponent ( )
inline

Definition at line 43 of file path_component.h.

43{}

◆ LinearPathComponent() [2/2]

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

Definition at line 45 of file path_component.h.

Member Function Documentation

◆ AppendPolylinePoints()

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

Definition at line 122 of file path_component.cc.

123 {
124 if (points.size() == 0 || points.back() != p2) {
125 points.push_back(p2);
126 }
127}
static const int points[]

◆ Extrema()

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

Definition at line 129 of file path_component.cc.

129 {
130 return {p1, p2};
131}

◆ GetEndDirection()

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

Definition at line 140 of file path_component.cc.

140 {
141 if (p1 == p2) {
142 return std::nullopt;
143 }
144 return (p2 - p1).Normalize();
145}

◆ GetStartDirection()

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

Definition at line 133 of file path_component.cc.

133 {
134 if (p1 == p2) {
135 return std::nullopt;
136 }
137 return (p1 - p2).Normalize();
138}

◆ operator==()

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

Definition at line 53 of file path_component.h.

53 {
54 return p1 == other.p1 && p2 == other.p2;
55 }

◆ Solve()

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

Definition at line 115 of file path_component.cc.

115 {
116 return {
117 LinearSolve(time, p1.x, p2.x), // x
118 LinearSolve(time, p1.y, p2.y), // y
119 };
120}
static Scalar LinearSolve(Scalar t, Scalar p0, Scalar p1)
static double time(int loops, Benchmark *bench, Target *target)
Definition: nanobench.cpp:394

Member Data Documentation

◆ p1

Point impeller::LinearPathComponent::p1

Definition at line 40 of file path_component.h.

◆ p2

Point impeller::LinearPathComponent::p2

Definition at line 41 of file path_component.h.


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