|
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 *cubicT, double *lineT, SkDPoint *pt, PinTPoint ptSet) |
|
◆ PinTPoint
◆ LineCubicIntersections()
◆ addExactEndPoints()
void LineCubicIntersections::addExactEndPoints |
( |
| ) |
|
|
inlineprotected |
Definition at line 280 of file SkDCubicLineIntersection.cpp.
280 {
281 for (int cIndex = 0; cIndex < 4; cIndex += 3) {
282 double lineT = fLine.
exactPoint(fCubic[cIndex]);
283 if (lineT < 0) {
284 continue;
285 }
286 double cubicT = (double) (cIndex >> 1);
287 fIntersections->
insert(cubicT, lineT, fCubic[cIndex]);
288 }
289 }
int insert(double one, double two, const SkDPoint &pt)
double exactPoint(const SkDPoint &xy) const
◆ addExactHorizontalEndPoints()
void LineCubicIntersections::addExactHorizontalEndPoints |
( |
double |
left, |
|
|
double |
right, |
|
|
double |
y |
|
) |
| |
|
inlineprotected |
Definition at line 323 of file SkDCubicLineIntersection.cpp.
323 {
324 for (int cIndex = 0; cIndex < 4; cIndex += 3) {
326 if (lineT < 0) {
327 continue;
328 }
329 double cubicT = (double) (cIndex >> 1);
330 fIntersections->
insert(cubicT, lineT, fCubic[cIndex]);
331 }
332 }
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 LineCubicIntersections::addExactVerticalEndPoints |
( |
double |
top, |
|
|
double |
bottom, |
|
|
double |
x |
|
) |
| |
|
inlineprotected |
Definition at line 349 of file SkDCubicLineIntersection.cpp.
349 {
350 for (int cIndex = 0; cIndex < 4; cIndex += 3) {
352 if (lineT < 0) {
353 continue;
354 }
355 double cubicT = (double) (cIndex >> 1);
356 fIntersections->
insert(cubicT, lineT, fCubic[cIndex]);
357 }
358 }
static double ExactPointV(const SkDPoint &xy, double top, double bottom, double x)
◆ addLineNearEndPoints()
void LineCubicIntersections::addLineNearEndPoints |
( |
| ) |
|
|
inlineprotected |
Definition at line 308 of file SkDCubicLineIntersection.cpp.
308 {
309 for (int lIndex = 0; lIndex < 2; ++lIndex) {
310 double lineT = (double) lIndex;
311 if (fIntersections->
hasOppT(lineT)) {
312 continue;
313 }
314 double cubicT = ((
const SkDCurve*)&fCubic)
316 if (cubicT < 0) {
317 continue;
318 }
319 fIntersections->
insert(cubicT, lineT, fLine[lIndex]);
320 }
321 }
bool hasOppT(double t) const
◆ addNearEndPoints()
void LineCubicIntersections::addNearEndPoints |
( |
| ) |
|
|
inlineprotected |
Definition at line 293 of file SkDCubicLineIntersection.cpp.
293 {
294 for (int cIndex = 0; cIndex < 4; cIndex += 3) {
295 double cubicT = (double) (cIndex >> 1);
296 if (fIntersections->
hasT(cubicT)) {
297 continue;
298 }
299 double lineT = fLine.
nearPoint(fCubic[cIndex],
nullptr);
300 if (lineT < 0) {
301 continue;
302 }
303 fIntersections->
insert(cubicT, lineT, fCubic[cIndex]);
304 }
306 }
void addLineNearEndPoints()
bool hasT(double t) const
double nearPoint(const SkDPoint &xy, bool *unequal) const
◆ addNearHorizontalEndPoints()
void LineCubicIntersections::addNearHorizontalEndPoints |
( |
double |
left, |
|
|
double |
right, |
|
|
double |
y |
|
) |
| |
|
inlineprotected |
Definition at line 334 of file SkDCubicLineIntersection.cpp.
334 {
335 for (int cIndex = 0; cIndex < 4; cIndex += 3) {
336 double cubicT = (double) (cIndex >> 1);
337 if (fIntersections->
hasT(cubicT)) {
338 continue;
339 }
341 if (lineT < 0) {
342 continue;
343 }
344 fIntersections->
insert(cubicT, lineT, fCubic[cIndex]);
345 }
347 }
static double NearPointH(const SkDPoint &xy, double left, double right, double y)
◆ addNearVerticalEndPoints()
void LineCubicIntersections::addNearVerticalEndPoints |
( |
double |
top, |
|
|
double |
bottom, |
|
|
double |
x |
|
) |
| |
|
inlineprotected |
Definition at line 360 of file SkDCubicLineIntersection.cpp.
360 {
361 for (int cIndex = 0; cIndex < 4; cIndex += 3) {
362 double cubicT = (double) (cIndex >> 1);
363 if (fIntersections->
hasT(cubicT)) {
364 continue;
365 }
367 if (lineT < 0) {
368 continue;
369 }
370 fIntersections->
insert(cubicT, lineT, fCubic[cIndex]);
371 }
373 }
static double NearPointV(const SkDPoint &xy, double top, double bottom, double x)
◆ allowNear()
void LineCubicIntersections::allowNear |
( |
bool |
allow | ) |
|
|
inline |
◆ checkCoincident()
void LineCubicIntersections::checkCoincident |
( |
| ) |
|
|
inline |
Definition at line 106 of file SkDCubicLineIntersection.cpp.
106 {
107 int last = fIntersections->
used() - 1;
108 for (int index = 0; index < last; ) {
109 double cubicMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
111 double t = fLine.
nearPoint(cubicMidPt,
nullptr);
112 if (t < 0) {
113 ++index;
114 continue;
115 }
118 --last;
121 --last;
122 } else {
124 }
126 }
127 }
void removeOne(int index)
void setCoincident(int index)
bool isCoincident(int index)
SkDPoint ptAtT(double t) const
◆ findLineT()
double LineCubicIntersections::findLineT |
( |
double |
t | ) |
|
|
inlineprotected |
Definition at line 375 of file SkDCubicLineIntersection.cpp.
375 {
377 double dx = fLine[1].fX - fLine[0].fX;
378 double dy = fLine[1].fY - fLine[0].fY;
379 if (fabs(
dx) > fabs(dy)) {
380 return (xy.
fX - fLine[0].fX) /
dx;
381 }
382 return (xy.
fY - fLine[0].fY) / dy;
383 }
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
◆ HorizontalIntersect()
static int LineCubicIntersections::HorizontalIntersect |
( |
const SkDCubic & |
c, |
|
|
double |
axisIntercept, |
|
|
double |
roots[3] |
|
) |
| |
|
inlinestatic |
Definition at line 176 of file SkDCubicLineIntersection.cpp.
176 {
181 for (
int index = 0; index <
count; ++index) {
184 double extremeTs[6];
187 break;
188 }
189 }
191 }
bool approximately_equal(double x, double y)
static int FindExtrema(const double src[], double tValue[2])
static void Coefficients(const double *cubic, double *A, double *B, double *C, double *D)
int searchRoots(double extremes[6], int extrema, double axisIntercept, SearchAxis xAxis, double *validRoots) const
static int RootsValidT(const double A, const double B, const double C, double D, double s[3])
◆ horizontalIntersect()
int LineCubicIntersections::horizontalIntersect |
( |
double |
axisIntercept, |
|
|
double |
left, |
|
|
double |
right, |
|
|
bool |
flipped |
|
) |
| |
|
inline |
Definition at line 193 of file SkDCubicLineIntersection.cpp.
193 {
195 if (fAllowNear) {
197 }
200 for (
int index = 0; index <
count; ++index) {
201 double cubicT =
roots[index];
205 fIntersections->
insert(cubicT, lineT, pt);
206 }
207 }
208 if (flipped) {
209 fIntersections->
flip();
210 }
212 return fIntersections->
used();
213 }
void addNearHorizontalEndPoints(double left, double right, double y)
bool pinTs(double *cubicT, double *lineT, SkDPoint *pt, PinTPoint ptSet)
static int HorizontalIntersect(const SkDCubic &c, double axisIntercept, double roots[3])
void addExactHorizontalEndPoints(double left, double right, double y)
bool uniqueAnswer(double cubicT, const SkDPoint &pt)
◆ intersect()
int LineCubicIntersections::intersect |
( |
| ) |
|
|
inline |
Definition at line 157 of file SkDCubicLineIntersection.cpp.
157 {
159 if (fAllowNear) {
161 }
162 double rootVals[3];
164 for (
int index = 0; index <
roots; ++index) {
165 double cubicT = rootVals[index];
169 fIntersections->
insert(cubicT, lineT, pt);
170 }
171 }
173 return fIntersections->
used();
174 }
int intersectRay(double roots[3])
double findLineT(double t)
◆ intersectRay()
int LineCubicIntersections::intersectRay |
( |
double |
roots[3] | ) |
|
|
inline |
Definition at line 130 of file SkDCubicLineIntersection.cpp.
130 {
131 double adj = fLine[1].fX - fLine[0].fX;
132 double opp = fLine[1].fY - fLine[0].fY;
134 SkDEBUGCODE(c.fDebugGlobalState = fIntersections->globalState());
135 for (int n = 0; n < 4; ++n) {
136 c[n].fX = (fCubic[n].fY - fLine[0].fY) * adj - (fCubic[n].fX - fLine[0].fX) * opp;
137 }
141 for (
int index = 0; index <
count; ++index) {
144 for (int n = 0; n < 4; ++n) {
145 c[n].fY = (fCubic[n].fY - fLine[0].fY) * opp
146 + (fCubic[n].fX - fLine[0].fX) * adj;
147 }
148 double extremeTs[6];
151 break;
152 }
153 }
155 }
static bool approximately_zero(double x)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
◆ pinTs()
bool LineCubicIntersections::pinTs |
( |
double * |
cubicT, |
|
|
double * |
lineT, |
|
|
SkDPoint * |
pt, |
|
|
PinTPoint |
ptSet |
|
) |
| |
|
inlineprotected |
Definition at line 385 of file SkDCubicLineIntersection.cpp.
385 {
387 return false;
388 }
390 return false;
391 }
392 double cT = *cubicT =
SkPinT(*cubicT);
393 double lT = *lineT =
SkPinT(*lineT);
397 return false;
398 }
399
400
402 *pt = lPt;
404 *pt = cPt;
405 }
407 if (gridPt == fLine[0].asSkPoint()) {
408 *lineT = 0;
409 } else if (gridPt == fLine[1].asSkPoint()) {
410 *lineT = 1;
411 }
413 *cubicT = 0;
415 *cubicT = 1;
416 }
417 return true;
418 }
bool approximately_one_or_less(double x)
bool approximately_zero_or_more(double x)
SkDPoint ptAtT(double t) const
SkPoint asSkPoint() const
bool roughlyEqual(const SkDPoint &a) const
◆ uniqueAnswer()
bool LineCubicIntersections::uniqueAnswer |
( |
double |
cubicT, |
|
|
const SkDPoint & |
pt |
|
) |
| |
|
inline |
Definition at line 215 of file SkDCubicLineIntersection.cpp.
215 {
216 for (
int inner = 0; inner < fIntersections->
used(); ++inner) {
217 if (fIntersections->
pt(inner) != pt) {
218 continue;
219 }
220 double existingCubicT = (*fIntersections)[0][inner];
221 if (cubicT == existingCubicT) {
222 return false;
223 }
224
225 double cubicMidT = (existingCubicT + cubicT) / 2;
228 return false;
229 }
230 }
231#if ONE_OFF_DEBUG
233 SkDebugf(
"%s pt=(%1.9g,%1.9g) cPt=(%1.9g,%1.9g)\n", __FUNCTION__, pt.
fX, pt.
fY,
235#endif
236 return true;
237 }
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
const SkDPoint & pt(int index) const
bool approximatelyEqual(const SkDPoint &a) const
◆ VerticalIntersect()
static int LineCubicIntersections::VerticalIntersect |
( |
const SkDCubic & |
c, |
|
|
double |
axisIntercept, |
|
|
double |
roots[3] |
|
) |
| |
|
inlinestatic |
◆ verticalIntersect()
int LineCubicIntersections::verticalIntersect |
( |
double |
axisIntercept, |
|
|
double |
top, |
|
|
double |
bottom, |
|
|
bool |
flipped |
|
) |
| |
|
inline |
Definition at line 256 of file SkDCubicLineIntersection.cpp.
256 {
258 if (fAllowNear) {
260 }
263 for (
int index = 0; index <
count; ++index) {
264 double cubicT =
roots[index];
266 double lineT = (pt.
fY - top) / (bottom - top);
268 fIntersections->
insert(cubicT, lineT, pt);
269 }
270 }
271 if (flipped) {
272 fIntersections->
flip();
273 }
275 return fIntersections->
used();
276 }
void addExactVerticalEndPoints(double top, double bottom, double x)
void addNearVerticalEndPoints(double top, double bottom, double x)
static int VerticalIntersect(const SkDCubic &c, double axisIntercept, double roots[3])
The documentation for this class was generated from the following file: