| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::PathTessellator::Cubic Struct Reference

`#include <path_tessellator.h>`

## Public Member Functions
Point | Last () const
Point | Solve (Scalar t) const
Scalar | SubdivisionCount (Scalar scale) const
std::optional< Vector2 > | GetStartDirection () const
std::optional< Vector2 > | GetEndDirection () const

## Public Attributes
const Point | p1
const Point | cp1
const Point | cp2
const Point | p2

## Detailed Description

Definition at line 141 of file path_tessellator.h.

## Member Function Documentation

## ◆ GetEndDirection()

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

Definition at line 174 of file path_tessellator.h.

174 {
175 if (p2 != cp2) {
176 return (p2 - cp2).Normalize();
177 }
178 if (p2 != cp1) {
179 return (p2 - cp1).Normalize();
180 }
181 if (p2 != p1) {
182 return (p2 - p1).Normalize();
183 }
184 return std::nullopt;
185 }
impeller::PathTessellator::Cubic::cp2
const Point cp2
Definition: path_tessellator.h:144
impeller::PathTessellator::Cubic::p2
const Point p2
Definition: path_tessellator.h:145
impeller::PathTessellator::Cubic::cp1
const Point cp1
Definition: path_tessellator.h:143
impeller::PathTessellator::Cubic::p1
const Point p1
Definition: path_tessellator.h:142

References cp1, cp2, p1, and p2.

## ◆ GetStartDirection()

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

Definition at line 161 of file path_tessellator.h.

161 {
162 if (p1 != cp1) {
163 return (p1 - cp1).Normalize();
164 }
165 if (p1 != cp2) {
166 return (p1 - cp2).Normalize();
167 }
168 if (p1 != p2) {
169 return (p1 - p2).Normalize();
170 }
171 return std::nullopt;
172 }

References cp1, cp2, p1, and p2.

## ◆ Last()

Point impeller::PathTessellator::Cubic::Last | ( |  | ) | const
| inline

Definition at line 147 of file path_tessellator.h.

147 { return p2; }

References p2.

## ◆ Solve()

Point impeller::PathTessellator::Cubic::Solve | ( | Scalar | t | ) | const
| inline

Definition at line 149 of file path_tessellator.h.

149 {
150 Scalar u = 1.0f - t;
151 return p1 * u * u * u + //
152 3 * cp1 * u * u * t + //
153 3 * cp2 * u * t * t + //
154 p2 * t * t * t;
155 }
impeller::Scalar
float Scalar
Definition: scalar.h:19

References cp1, cp2, p1, and p2.

## ◆ SubdivisionCount()

Scalar impeller::PathTessellator::Cubic::SubdivisionCount | ( | Scalar | scale | ) | const
| inline

Definition at line 157 of file path_tessellator.h.

157 {
158 return ComputeCubicSubdivisions(scale, p1, cp1, cp2, p2);
159 }
impeller::ComputeCubicSubdivisions
Scalar ComputeCubicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2, Point p3)
Definition: wangs_formula.cc:18

References impeller::ComputeCubicSubdivisions(), cp1, cp2, p1, and p2.

## Member Data Documentation

## ◆ cp1

const Point impeller::PathTessellator::Cubic::cp1

Definition at line 143 of file path_tessellator.h.

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

## ◆ cp2

const Point impeller::PathTessellator::Cubic::cp2

Definition at line 144 of file path_tessellator.h.

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

## ◆ p1

const Point impeller::PathTessellator::Cubic::p1

Definition at line 142 of file path_tessellator.h.

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

## ◆ p2

const Point impeller::PathTessellator::Cubic::p2

Definition at line 145 of file path_tessellator.h.

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

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

- impeller/tessellator/path_tessellator.h