51 int last = fIntersections->
used() - 1;
52 for (
int index = 0; index < last; ) {
53 double conicMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
55 double t = fLine->
nearPoint(conicMidPt,
nullptr);
74 static bool close_to(
double a,
double b,
const double c[3]) {
80 double conicVals[] = { fConic[0].fY, fConic[1].fY, fConic[2].fY };
81 return this->
validT(conicVals, axisIntercept,
roots);
91 for (
int index = 0; index <
count; ++index) {
92 double conicT =
roots[index];
94 SkDEBUGCODE(
double conicVals[] = { fConic[0].fY, fConic[1].fY, fConic[2].fY });
95 SkOPOBJASSERT(fIntersections, close_to(pt.
fY, axisIntercept, conicVals));
99 fIntersections->
insert(conicT, lineT, pt);
103 fIntersections->
flip();
106 return fIntersections->
used();
116 for (
int index = 0; index <
roots; ++index) {
117 double conicT = rootVals[index];
120 if (!fIntersections->globalState()
121 || !fIntersections->globalState()->debugSkipAssert()) {
124 SkASSERT(conicPt.approximatelyDEqual(linePt));
130 fIntersections->
insert(conicT, lineT, pt);
134 return fIntersections->
used();
138 double adj = (*fLine)[1].fX - (*fLine)[0].fX;
139 double opp = (*fLine)[1].fY - (*fLine)[0].fY;
141 for (
int n = 0; n < 3; ++n) {
142 r[n] = (fConic[n].fY - (*fLine)[0].fY) * adj - (fConic[n].fX - (*fLine)[0].fX) * opp;
149 double B = r[1] * fConic.
fWeight - axisIntercept * fConic.
fWeight + axisIntercept;
158 double conicVals[] = { fConic[0].fX, fConic[1].fX, fConic[2].fX };
159 return this->
validT(conicVals, axisIntercept,
roots);
169 for (
int index = 0; index <
count; ++index) {
170 double conicT =
roots[index];
172 SkDEBUGCODE(
double conicVals[] = { fConic[0].fX, fConic[1].fX, fConic[2].fX });
173 SkOPOBJASSERT(fIntersections, close_to(pt.
fX, axisIntercept, conicVals));
174 double lineT = (pt.
fY - top) / (bottom - top);
177 fIntersections->
insert(conicT, lineT, pt);
181 fIntersections->
flip();
184 return fIntersections->
used();
192 double lineT = fLine->
exactPoint(fConic[cIndex]);
196 double conicT = (double) (cIndex >> 1);
197 fIntersections->
insert(conicT, lineT, fConic[cIndex]);
203 double conicT = (double) (cIndex >> 1);
204 if (fIntersections->
hasT(conicT)) {
207 double lineT = fLine->
nearPoint(fConic[cIndex],
nullptr);
211 fIntersections->
insert(conicT, lineT, fConic[cIndex]);
217 for (
int lIndex = 0; lIndex < 2; ++lIndex) {
218 double lineT = (double) lIndex;
219 if (fIntersections->
hasOppT(lineT)) {
223 (*fLine)[lIndex], (*fLine)[!lIndex]);
227 fIntersections->
insert(conicT, lineT, (*fLine)[lIndex]);
237 double conicT = (double) (cIndex >> 1);
238 fIntersections->
insert(conicT, lineT, fConic[cIndex]);
244 double conicT = (double) (cIndex >> 1);
245 if (fIntersections->
hasT(conicT)) {
252 fIntersections->
insert(conicT, lineT, fConic[cIndex]);
263 double conicT = (double) (cIndex >> 1);
264 fIntersections->
insert(conicT, lineT, fConic[cIndex]);
270 double conicT = (double) (cIndex >> 1);
271 if (fIntersections->
hasT(conicT)) {
278 fIntersections->
insert(conicT, lineT, fConic[cIndex]);
285 double dx = (*fLine)[1].fX - (*fLine)[0].fX;
286 double dy = (*fLine)[1].fY - (*fLine)[0].fY;
287 if (fabs(
dx) > fabs(dy)) {
288 return (xy.
fX - (*fLine)[0].fX) /
dx;
290 return (xy.
fY - (*fLine)[0].fY) / dy;
300 double qT = *conicT =
SkPinT(*conicT);
301 double lT = *lineT =
SkPinT(*lineT);
303 *pt = (*fLine).ptAtT(lT);
305 *pt = fConic.
ptAtT(qT);
318 if (gridPt == fConic[0].asSkPoint()) {
321 }
else if (gridPt == fConic[2].asSkPoint()) {
329 for (
int inner = 0; inner < fIntersections->
used(); ++inner) {
330 if (fIntersections->
pt(inner) != pt) {
333 double existingConicT = (*fIntersections)[0][inner];
334 if (conicT == existingConicT) {
338 double conicMidT = (existingConicT + conicT) / 2;
346 SkDebugf(
"%s pt=(%1.9g,%1.9g) cPt=(%1.9g,%1.9g)\n", __FUNCTION__, pt.
fX, pt.
fY,
382 for (
int index = 0; index < fUsed; ++index) {
383 fPt[index] =
conic.ptAtT(fT[0][index]);
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define SkDEBUGPARAMS(...)
bool approximately_equal(double x, double y)
bool approximately_one_or_less_double(double x)
bool approximately_zero_or_more_double(double x)
#define SkOPOBJASSERT(obj, cond)
bool approximately_zero_when_compared_to(double x, double y)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
void addNearHorizontalEndPoints(double left, double right, double y)
LineConicIntersections(const SkDConic &c)
int horizontalIntersect(double axisIntercept, double roots[2])
int intersectRay(double roots[2])
void addNearVerticalEndPoints(double top, double bottom, double x)
LineConicIntersections(const SkDConic &c, const SkDLine &l, SkIntersections *i)
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped)
void addExactHorizontalEndPoints(double left, double right, double y)
bool uniqueAnswer(double conicT, const SkDPoint &pt)
int validT(double r[3], double axisIntercept, double roots[2])
bool pinTs(double *conicT, double *lineT, SkDPoint *pt, PinTPoint ptSet)
int verticalIntersect(double axisIntercept, double roots[2])
void addExactVerticalEndPoints(double top, double bottom, double x)
double findLineT(double t)
void addLineNearEndPoints()
int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped)
void allowNear(bool allow)
int intersectRay(const SkDLine &, const SkDLine &)
int insert(double one, double two, const SkDPoint &pt)
int intersect(const SkDLine &, const SkDLine &)
void removeOne(int index)
const SkDPoint & pt(int index) const
static double VerticalIntercept(const SkDLine &line, double x)
int vertical(const SkDLine &, double top, double bottom, double x, bool flipped)
bool hasOppT(double t) const
bool hasT(double t) const
static double HorizontalIntercept(const SkDLine &line, double y)
void setCoincident(int index)
int horizontal(const SkDLine &, double left, double right, double y, bool flipped)
bool isCoincident(int index)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
SkDPoint ptAtT(double t) const
static const int kPointCount
static const int kPointLast
double exactPoint(const SkDPoint &xy) const
static double ExactPointV(const SkDPoint &xy, double top, double bottom, double x)
SkDPoint ptAtT(double t) const
static double NearPointH(const SkDPoint &xy, double left, double right, double y)
static double NearPointV(const SkDPoint &xy, double top, double bottom, double x)
static double ExactPointH(const SkDPoint &xy, double left, double right, double y)
double nearPoint(const SkDPoint &xy, bool *unequal) const
bool approximatelyEqual(const SkDPoint &a) const
SkPoint asSkPoint() const
static bool ApproximatelyEqual(const SkPoint &a, const SkPoint &b)
static int RootsValidT(const double A, const double B, const double C, double s[2])