74 if (stackPos == stackBase.
get())
76 if (source == path.data.
end())
81 if (! isMarker (type, Path::closeSubPathMarker))
86 if (isMarker (type, Path::quadMarker))
91 if (! isIdentityTransform)
94 else if (isMarker (type, Path::cubicMarker))
101 if (! isIdentityTransform)
106 if (! isIdentityTransform)
115 if (! isMarker (type, Path::closeSubPathMarker))
120 if (isMarker (type, Path::quadMarker))
125 else if (isMarker (type, Path::cubicMarker))
135 if (isMarker (type, Path::lineMarker))
140 && source != path.data.
end()
141 && isMarker (*source, Path::closeSubPathMarker)
148 if (isMarker (type, Path::quadMarker))
150 const size_t offset = (
size_t) (stackPos - stackBase);
152 if (offset >= stackSize - 10)
156 stackPos = stackBase + offset;
159 auto m1x = (
x1 +
x2) * 0.5f;
160 auto m1y = (
y1 +
y2) * 0.5f;
161 auto m2x = (
x2 + x3) * 0.5f;
162 auto m2y = (
y2 + y3) * 0.5f;
163 auto m3x = (m1x + m2x) * 0.5f;
164 auto m3y = (m1y + m2y) * 0.5f;
166 auto errorX = m3x -
x2;
167 auto errorY = m3y -
y2;
169 auto outsideTolerance = errorX * errorX + errorY * errorY > toleranceSquared;
173 if (outsideTolerance && canBeSubdivided)
179 *stackPos++ = Path::quadMarker;
185 *stackPos++ = Path::quadMarker;
191 *stackPos++ = Path::lineMarker;
195 *stackPos++ = Path::lineMarker;
198 jassert (stackPos < stackBase + stackSize);
200 else if (isMarker (type, Path::cubicMarker))
202 const size_t offset = (
size_t) (stackPos - stackBase);
204 if (offset >= stackSize - 16)
208 stackPos = stackBase + offset;
211 auto m1x = (
x1 +
x2) * 0.5f;
212 auto m1y = (
y1 +
y2) * 0.5f;
213 auto m2x = (x3 +
x2) * 0.5f;
214 auto m2y = (y3 +
y2) * 0.5f;
215 auto m3x = (x3 + x4) * 0.5f;
216 auto m3y = (y3 + y4) * 0.5f;
217 auto m4x = (m1x + m2x) * 0.5f;
218 auto m4y = (m1y + m2y) * 0.5f;
219 auto m5x = (m3x + m2x) * 0.5f;
220 auto m5y = (m3y + m2y) * 0.5f;
222 auto error1X = m4x -
x2;
223 auto error1Y = m4y -
y2;
224 auto error2X = m5x - x3;
225 auto error2Y = m5y - y3;
227 auto outsideTolerance = error1X * error1X + error1Y * error1Y > toleranceSquared
228 || error2X * error2X + error2Y * error2Y > toleranceSquared;
234 if (outsideTolerance && canBeSubdivided)
242 *stackPos++ = Path::cubicMarker;
244 *stackPos++ = (m4y + m5y) * 0.5f;
245 *stackPos++ = (m4x + m5x) * 0.5f;
250 *stackPos++ = Path::cubicMarker;
256 *stackPos++ = Path::lineMarker;
260 *stackPos++ = Path::lineMarker;
264 *stackPos++ = Path::lineMarker;
267 else if (isMarker (type, Path::closeSubPathMarker))
282 jassert (isMarker (type, Path::moveMarker));
285 subPathCloseX =
x1 =
x2;
286 subPathCloseY =
y1 =
y2;
constexpr bool approximatelyEqual(Type a, Type b, Tolerance< Type > tolerance=Tolerance< Type >{} .withAbsolute(std::numeric_limits< Type >::min()) .withRelative(std::numeric_limits< Type >::epsilon()))
Returns true if the two floating-point numbers are approximately equal.