10 : bounds_(bounds), include_center_(include_center) {
44 const Arc::Iteration Arc::ComputeCircleArcIterations(
size_t step_count) {
65 Degrees end_angle = start_angle + sweep_;
67 FML_DCHECK(end_angle > start_angle && end_angle.
degrees < 720);
79 if (include_center_) {
80 extrema[count++] = {0, 0};
84 int cur_axis = std::floor(start_angle.
degrees / 90.0f);
86 int end_axis = std::ceil(end_angle.
degrees / 90.0f);
87 while (++cur_axis < end_axis) {
91 FML_DCHECK(count <= 7);
96 for (
int i = 0; i < count; i++) {
97 extrema[i] = center + extrema[i] * radii;
103 bool simplify_360)
const {
108 FML_DCHECK(sweep_.
degrees >= 0);
110 if (simplify_360 && sweep_.
degrees >= 360) {
111 return ComputeCircleArcIterations(step_count);
113 FML_DCHECK(sweep_.
degrees < 720);
117 FML_DCHECK(
start.degrees >= 0.0f &&
start.degrees < 360.0f);
119 FML_DCHECK(
end.degrees <
start.degrees + (simplify_360 ? 360.0f : 720.0f));
130 if ((
start + nudge) >= (
end - nudge)) {
136 static_cast<int>(std::floor((
start + nudge).degrees / 90.0f));
138 static_cast<int>(std::floor((
end - nudge).degrees / 90.0f));
139 FML_DCHECK(cur_quadrant >= 0 &&
141 FML_DCHECK(end_quadrant >= cur_quadrant &&
142 end_quadrant <= cur_quadrant + 8);
143 FML_DCHECK(cur_quadrant * 90 <= (
start + nudge).degrees);
144 FML_DCHECK(end_quadrant * 90 + 90 >= (
end - nudge).degrees);
146 auto next_step = [step_count](
Degrees angle,
int quadrant) ->
size_t {
148 return static_cast<size_t>(std::ceil(quadrant_fract * step_count));
154 next_step(
start + nudge, cur_quadrant),
160 while (cur_quadrant < end_quadrant) {
170 next_step(
end - nudge, cur_quadrant);
static constexpr impeller::Vector2 kQuadrantAxes[4]
size_t GetPointCount() const
size_t GetPointCount() const
Iteration ComputeIterations(size_t step_count, bool simplify_360=true) const
Arc(const Rect &bounds, Degrees start, Degrees sweep, bool include_center)
Rect GetTightArcBounds() const
constexpr bool IsFullCircle() const
constexpr bool IsFinite() const
constexpr Degrees GetPositive() const
static Vector2 CosSin(Radians radians)
constexpr static std::optional< TRect > MakePointBounds(const U &value)
constexpr TSize< Type > GetSize() const
Returns the size of the rectangle which may be negative in either width or height and may have been c...
IsFinite() const
Returns true if all of the fields of this floating point rectangle are finite.
constexpr Point GetCenter() const
Get the center point as a |Point|.