Flutter Engine
 
Loading...
Searching...
No Matches
impeller::PathTessellator::Quad Struct Reference

#include <path_tessellator.h>

Public Member Functions

Point Last () const
 
Point Solve (Scalar t) const
 
Scalar SubdivisionCount (Scalar scale) const
 
std::optional< Vector2GetStartDirection () const
 
std::optional< Vector2GetEndDirection () const
 

Public Attributes

const Point p1
 
const Point cp
 
const Point p2
 

Detailed Description

Definition at line 61 of file path_tessellator.h.

Member Function Documentation

◆ GetEndDirection()

std::optional< Vector2 > impeller::PathTessellator::Quad::GetEndDirection ( ) const
inline

Definition at line 87 of file path_tessellator.h.

87 {
88 if (p2 != cp) {
89 return (p2 - cp).Normalize();
90 }
91 if (p2 != p1) {
92 return (p2 - p1).Normalize();
93 }
94 return std::nullopt;
95 }

References cp, p1, and p2.

◆ GetStartDirection()

std::optional< Vector2 > impeller::PathTessellator::Quad::GetStartDirection ( ) const
inline

Definition at line 77 of file path_tessellator.h.

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

References cp, p1, and p2.

◆ Last()

Point impeller::PathTessellator::Quad::Last ( ) const
inline

Definition at line 66 of file path_tessellator.h.

66{ return p2; }

References p2.

◆ Solve()

Point impeller::PathTessellator::Quad::Solve ( Scalar  t) const
inline

Definition at line 68 of file path_tessellator.h.

68 {
69 Scalar u = 1.0f - t;
70 return p1 * u * u + 2 * cp * u * t + p2 * t * t;
71 }
float Scalar
Definition scalar.h:19

References cp, p1, and p2.

◆ SubdivisionCount()

Scalar impeller::PathTessellator::Quad::SubdivisionCount ( Scalar  scale) const
inline

Definition at line 73 of file path_tessellator.h.

73 {
74 return ComputeQuadradicSubdivisions(scale, p1, cp, p2);
75 }
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2)

References impeller::ComputeQuadradicSubdivisions(), cp, p1, and p2.

Member Data Documentation

◆ cp

const Point impeller::PathTessellator::Quad::cp

Definition at line 63 of file path_tessellator.h.

Referenced by GetEndDirection(), GetStartDirection(), Solve(), and SubdivisionCount().

◆ p1

const Point impeller::PathTessellator::Quad::p1

Definition at line 62 of file path_tessellator.h.

Referenced by GetEndDirection(), GetStartDirection(), Solve(), and SubdivisionCount().

◆ p2

const Point impeller::PathTessellator::Quad::p2

Definition at line 64 of file path_tessellator.h.

Referenced by GetEndDirection(), GetStartDirection(), Last(), Solve(), and SubdivisionCount().


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