|
| LineQuadraticIntersections (const SkDQuad &q, const SkDLine &l, SkIntersections *i) |
|
| LineQuadraticIntersections (const SkDQuad &q) |
|
void | allowNear (bool allow) |
|
void | checkCoincident () |
|
int | intersectRay (double roots[2]) |
|
int | intersect () |
|
int | horizontalIntersect (double axisIntercept, double roots[2]) |
|
int | horizontalIntersect (double axisIntercept, double left, double right, bool flipped) |
|
bool | uniqueAnswer (double quadT, const SkDPoint &pt) |
|
int | verticalIntersect (double axisIntercept, double roots[2]) |
|
int | verticalIntersect (double axisIntercept, double top, double bottom, bool flipped) |
|
|
void | addExactEndPoints () |
|
void | addNearEndPoints () |
|
void | addLineNearEndPoints () |
|
void | addExactHorizontalEndPoints (double left, double right, double y) |
|
void | addNearHorizontalEndPoints (double left, double right, double y) |
|
void | addExactVerticalEndPoints (double top, double bottom, double x) |
|
void | addNearVerticalEndPoints (double top, double bottom, double x) |
|
double | findLineT (double t) |
|
bool | pinTs (double *quadT, double *lineT, SkDPoint *pt, PinTPoint ptSet) |
|
Definition at line 98 of file SkDQuadLineIntersection.cpp.
◆ PinTPoint
◆ LineQuadraticIntersections() [1/2]
◆ LineQuadraticIntersections() [2/2]
LineQuadraticIntersections::LineQuadraticIntersections |
( |
const SkDQuad & |
q | ) |
|
|
inline |
◆ addExactEndPoints()
void LineQuadraticIntersections::addExactEndPoints |
( |
| ) |
|
|
inlineprotected |
Definition at line 286 of file SkDQuadLineIntersection.cpp.
286 {
287 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
288 double lineT = fLine->
exactPoint(fQuad[qIndex]);
289 if (lineT < 0) {
290 continue;
291 }
292 double quadT = (double) (qIndex >> 1);
293 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
294 }
295 }
int insert(double one, double two, const SkDPoint &pt)
double exactPoint(const SkDPoint &xy) const
◆ addExactHorizontalEndPoints()
void LineQuadraticIntersections::addExactHorizontalEndPoints |
( |
double |
left, |
|
|
double |
right, |
|
|
double |
y |
|
) |
| |
|
inlineprotected |
Definition at line 327 of file SkDQuadLineIntersection.cpp.
327 {
328 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
330 if (lineT < 0) {
331 continue;
332 }
333 double quadT = (double) (qIndex >> 1);
334 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
335 }
336 }
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static double ExactPointH(const SkDPoint &xy, double left, double right, double y)
◆ addExactVerticalEndPoints()
void LineQuadraticIntersections::addExactVerticalEndPoints |
( |
double |
top, |
|
|
double |
bottom, |
|
|
double |
x |
|
) |
| |
|
inlineprotected |
Definition at line 353 of file SkDQuadLineIntersection.cpp.
353 {
354 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
356 if (lineT < 0) {
357 continue;
358 }
359 double quadT = (double) (qIndex >> 1);
360 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
361 }
362 }
static double ExactPointV(const SkDPoint &xy, double top, double bottom, double x)
◆ addLineNearEndPoints()
void LineQuadraticIntersections::addLineNearEndPoints |
( |
| ) |
|
|
inlineprotected |
Definition at line 312 of file SkDQuadLineIntersection.cpp.
312 {
313 for (int lIndex = 0; lIndex < 2; ++lIndex) {
314 double lineT = (double) lIndex;
315 if (fIntersections->
hasOppT(lineT)) {
316 continue;
317 }
319 (*fLine)[lIndex], (*fLine)[!lIndex]);
320 if (quadT < 0) {
321 continue;
322 }
323 fIntersections->
insert(quadT, lineT, (*fLine)[lIndex]);
324 }
325 }
bool hasOppT(double t) const
◆ addNearEndPoints()
void LineQuadraticIntersections::addNearEndPoints |
( |
| ) |
|
|
inlineprotected |
Definition at line 297 of file SkDQuadLineIntersection.cpp.
297 {
298 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
299 double quadT = (double) (qIndex >> 1);
300 if (fIntersections->
hasT(quadT)) {
301 continue;
302 }
303 double lineT = fLine->
nearPoint(fQuad[qIndex],
nullptr);
304 if (lineT < 0) {
305 continue;
306 }
307 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
308 }
310 }
void addLineNearEndPoints()
bool hasT(double t) const
double nearPoint(const SkDPoint &xy, bool *unequal) const
◆ addNearHorizontalEndPoints()
void LineQuadraticIntersections::addNearHorizontalEndPoints |
( |
double |
left, |
|
|
double |
right, |
|
|
double |
y |
|
) |
| |
|
inlineprotected |
Definition at line 338 of file SkDQuadLineIntersection.cpp.
338 {
339 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
340 double quadT = (double) (qIndex >> 1);
341 if (fIntersections->
hasT(quadT)) {
342 continue;
343 }
345 if (lineT < 0) {
346 continue;
347 }
348 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
349 }
351 }
static double NearPointH(const SkDPoint &xy, double left, double right, double y)
◆ addNearVerticalEndPoints()
void LineQuadraticIntersections::addNearVerticalEndPoints |
( |
double |
top, |
|
|
double |
bottom, |
|
|
double |
x |
|
) |
| |
|
inlineprotected |
Definition at line 364 of file SkDQuadLineIntersection.cpp.
364 {
365 for (int qIndex = 0; qIndex < 3; qIndex += 2) {
366 double quadT = (double) (qIndex >> 1);
367 if (fIntersections->
hasT(quadT)) {
368 continue;
369 }
371 if (lineT < 0) {
372 continue;
373 }
374 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
375 }
377 }
static double NearPointV(const SkDPoint &xy, double top, double bottom, double x)
◆ allowNear()
void LineQuadraticIntersections::allowNear |
( |
bool |
allow | ) |
|
|
inline |
◆ checkCoincident()
void LineQuadraticIntersections::checkCoincident |
( |
| ) |
|
|
inline |
Definition at line 124 of file SkDQuadLineIntersection.cpp.
124 {
125 int last = fIntersections->
used() - 1;
126 for (int index = 0; index < last; ) {
127 double quadMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
129 double t = fLine->
nearPoint(quadMidPt,
nullptr);
130 if (t < 0) {
131 ++index;
132 continue;
133 }
136 --last;
139 --last;
140 } else {
142 }
144 }
145 }
void removeOne(int index)
void setCoincident(int index)
bool isCoincident(int index)
SkDPoint ptAtT(double t) const
◆ findLineT()
double LineQuadraticIntersections::findLineT |
( |
double |
t | ) |
|
|
inlineprotected |
Definition at line 379 of file SkDQuadLineIntersection.cpp.
379 {
381 double dx = (*fLine)[1].fX - (*fLine)[0].fX;
382 double dy = (*fLine)[1].fY - (*fLine)[0].fY;
383 if (fabs(
dx) > fabs(dy)) {
384 return (xy.
fX - (*fLine)[0].fX) /
dx;
385 }
386 return (xy.
fY - (*fLine)[0].fY) / dy;
387 }
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
◆ horizontalIntersect() [1/2]
int LineQuadraticIntersections::horizontalIntersect |
( |
double |
axisIntercept, |
|
|
double |
left, |
|
|
double |
right, |
|
|
bool |
flipped |
|
) |
| |
|
inline |
Definition at line 206 of file SkDQuadLineIntersection.cpp.
206 {
208 if (fAllowNear) {
210 }
211 double rootVals[2];
213 for (
int index = 0; index <
roots; ++index) {
214 double quadT = rootVals[index];
218 fIntersections->
insert(quadT, lineT, pt);
219 }
220 }
221 if (flipped) {
222 fIntersections->
flip();
223 }
225 return fIntersections->
used();
226 }
void addExactHorizontalEndPoints(double left, double right, double y)
void addNearHorizontalEndPoints(double left, double right, double y)
bool uniqueAnswer(double quadT, const SkDPoint &pt)
int horizontalIntersect(double axisIntercept, double roots[2])
bool pinTs(double *quadT, double *lineT, SkDPoint *pt, PinTPoint ptSet)
◆ horizontalIntersect() [2/2]
int LineQuadraticIntersections::horizontalIntersect |
( |
double |
axisIntercept, |
|
|
double |
roots[2] |
|
) |
| |
|
inline |
Definition at line 196 of file SkDQuadLineIntersection.cpp.
196 {
197 double D = fQuad[2].fY;
198 double E = fQuad[1].fY;
199 double F = fQuad[0].fY;
204 }
static int RootsValidT(const double A, const double B, const double C, double s[2])
◆ intersect()
int LineQuadraticIntersections::intersect |
( |
| ) |
|
|
inline |
Definition at line 177 of file SkDQuadLineIntersection.cpp.
177 {
179 if (fAllowNear) {
181 }
182 double rootVals[2];
184 for (
int index = 0; index <
roots; ++index) {
185 double quadT = rootVals[index];
189 fIntersections->
insert(quadT, lineT, pt);
190 }
191 }
193 return fIntersections->
used();
194 }
int intersectRay(double roots[2])
double findLineT(double t)
◆ intersectRay()
int LineQuadraticIntersections::intersectRay |
( |
double |
roots[2] | ) |
|
|
inline |
Definition at line 147 of file SkDQuadLineIntersection.cpp.
147 {
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163 double adj = (*fLine)[1].fX - (*fLine)[0].fX;
164 double opp = (*fLine)[1].fY - (*fLine)[0].fY;
165 double r[3];
166 for (int n = 0; n < 3; ++n) {
167 r[n] = (fQuad[n].fY - (*fLine)[0].fY) * adj - (fQuad[n].fX - (*fLine)[0].fX) * opp;
168 }
175 }
◆ pinTs()
bool LineQuadraticIntersections::pinTs |
( |
double * |
quadT, |
|
|
double * |
lineT, |
|
|
SkDPoint * |
pt, |
|
|
PinTPoint |
ptSet |
|
) |
| |
|
inlineprotected |
Definition at line 389 of file SkDQuadLineIntersection.cpp.
389 {
391 return false;
392 }
394 return false;
395 }
396 double qT = *quadT =
SkPinT(*quadT);
397 double lT = *lineT =
SkPinT(*lineT);
399 *pt = (*fLine).ptAtT(lT);
401 *pt = fQuad.
ptAtT(qT);
402 }
405 *pt = (*fLine)[0];
406 *lineT = 0;
408 *pt = (*fLine)[1];
409 *lineT = 1;
410 }
412 return false;
413 }
414 if (gridPt == fQuad[0].asSkPoint()) {
415 *pt = fQuad[0];
416 *quadT = 0;
417 } else if (gridPt == fQuad[2].asSkPoint()) {
418 *pt = fQuad[2];
419 *quadT = 1;
420 }
421 return true;
422 }
bool approximately_equal(double x, double y)
bool approximately_one_or_less_double(double x)
bool approximately_zero_or_more_double(double x)
SkPoint asSkPoint() const
static bool ApproximatelyEqual(const SkPoint &a, const SkPoint &b)
◆ uniqueAnswer()
bool LineQuadraticIntersections::uniqueAnswer |
( |
double |
quadT, |
|
|
const SkDPoint & |
pt |
|
) |
| |
|
inline |
Definition at line 228 of file SkDQuadLineIntersection.cpp.
228 {
229 for (
int inner = 0; inner < fIntersections->
used(); ++inner) {
230 if (fIntersections->
pt(inner) != pt) {
231 continue;
232 }
233 double existingQuadT = (*fIntersections)[0][inner];
234 if (quadT == existingQuadT) {
235 return false;
236 }
237
238 double quadMidT = (existingQuadT + quadT) / 2;
241 return false;
242 }
243 }
244#if ONE_OFF_DEBUG
246 SkDebugf(
"%s pt=(%1.9g,%1.9g) cPt=(%1.9g,%1.9g)\n", __FUNCTION__, pt.
fX, pt.
fY,
248#endif
249 return true;
250 }
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const SkDPoint & pt(int index) const
bool approximatelyEqual(const SkDPoint &a) const
◆ verticalIntersect() [1/2]
int LineQuadraticIntersections::verticalIntersect |
( |
double |
axisIntercept, |
|
|
double |
roots[2] |
|
) |
| |
|
inline |
◆ verticalIntersect() [2/2]
int LineQuadraticIntersections::verticalIntersect |
( |
double |
axisIntercept, |
|
|
double |
top, |
|
|
double |
bottom, |
|
|
bool |
flipped |
|
) |
| |
|
inline |
Definition at line 262 of file SkDQuadLineIntersection.cpp.
262 {
264 if (fAllowNear) {
266 }
267 double rootVals[2];
269 for (
int index = 0; index <
roots; ++index) {
270 double quadT = rootVals[index];
272 double lineT = (pt.
fY - top) / (bottom - top);
274 fIntersections->
insert(quadT, lineT, pt);
275 }
276 }
277 if (flipped) {
278 fIntersections->
flip();
279 }
281 return fIntersections->
used();
282 }
int verticalIntersect(double axisIntercept, double roots[2])
void addExactVerticalEndPoints(double top, double bottom, double x)
void addNearVerticalEndPoints(double top, double bottom, double x)
The documentation for this class was generated from the following file: