| Flutter Impeller |

Public Member Functions | Public Attributes | List of all members
impeller::PathTessellator::Conic 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 | cp
const Point | p2
const Scalar | weight

## Detailed Description

Definition at line 98 of file path_tessellator.h.

## Member Function Documentation

## ◆ GetEndDirection()

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

Definition at line 130 of file path_tessellator.h.

130 {
131 if (p2 != cp) {
132 return (p2 - cp).Normalize();
133 }
134 if (p2 != p1) {
135 return (p2 - p1).Normalize();
136 }
137 return std::nullopt;
138 }
impeller::PathTessellator::Conic::cp
const Point cp
Definition: path_tessellator.h:100
impeller::PathTessellator::Conic::p2
const Point p2
Definition: path_tessellator.h:101
impeller::PathTessellator::Conic::p1
const Point p1
Definition: path_tessellator.h:99

References cp, p1, and p2.

## ◆ GetStartDirection()

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

Definition at line 120 of file path_tessellator.h.

120 {
121 if (p1 != cp) {
122 return (p1 - cp).Normalize();
123 }
124 if (p1 != p2) {
125 return (p1 - p2).Normalize();
126 }
127 return std::nullopt;
128 }

References cp, p1, and p2.

## ◆ Last()

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

Definition at line 104 of file path_tessellator.h.

104 { return p2; }

References p2.

## ◆ Solve()

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

Definition at line 106 of file path_tessellator.h.

106 {
107 Scalar u = 1.0f - t;
108 Scalar coeff_1 = u * u;
109 Scalar coeff_c = 2 * u * t * weight;
110 Scalar coeff_2 = t * t;
111
112 return (p1 * coeff_1 + cp * coeff_c + p2 * coeff_2) /
113 (coeff_1 + coeff_c + coeff_2);
114 }
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::PathTessellator::Conic::weight
const Scalar weight
Definition: path_tessellator.h:102

References cp, p1, p2, and weight.

## ◆ SubdivisionCount()

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

Definition at line 116 of file path_tessellator.h.

116 {
117 return ComputeConicSubdivisions(scale, p1, cp, p2, weight);
118 }
impeller::ComputeConicSubdivisions
Scalar ComputeConicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2, Scalar w)
Definition: wangs_formula.cc:48

References impeller::ComputeConicSubdivisions(), cp, p1, p2, and weight.

## Member Data Documentation

## ◆ cp

const Point impeller::PathTessellator::Conic::cp

Definition at line 100 of file path_tessellator.h.

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

## ◆ p1

const Point impeller::PathTessellator::Conic::p1

Definition at line 99 of file path_tessellator.h.

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

## ◆ p2

const Point impeller::PathTessellator::Conic::p2

Definition at line 101 of file path_tessellator.h.

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

## ◆ weight

const Scalar impeller::PathTessellator::Conic::weight

Definition at line 102 of file path_tessellator.h.

Referenced by Solve(), and SubdivisionCount().

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

- impeller/tessellator/path_tessellator.h