int intersect() { addEndPoints(); double rootVals[2]; int roots = intersectRay(rootVals); for (int index = 0; index < roots; ++index) { double quadT = rootVals[index]; double lineT = findLineT(quadT); if (pinTs(quadT, lineT)) { intersections.insert(quadT, lineT); } } return intersections.fUsed; }
int intersect() { addExactEndPoints(); if (fAllowNear) { addNearEndPoints(); } double rootVals[3]; int roots = intersectRay(rootVals); for (int index = 0; index < roots; ++index) { double cubicT = rootVals[index]; double lineT = findLineT(cubicT); SkDPoint pt; if (pinTs(&cubicT, &lineT, &pt, kPointUninitialized) && uniqueAnswer(cubicT, pt)) { fIntersections->insert(cubicT, lineT, pt); } } checkCoincident(); return fIntersections->used(); }
int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) { addVerticalEndPoints(top, bottom, axisIntercept); double rootVals[2]; int roots = verticalIntersect(axisIntercept, rootVals); for (int index = 0; index < roots; ++index) { double y; double quadT = rootVals[index]; xy_at_t(quad, quadT, *(double*) NULL, y); double lineT = (y - top) / (bottom - top); if (pinTs(quadT, lineT)) { intersections.insert(quadT, lineT); } } if (flipped) { flip(); } return intersections.fUsed; }
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped) { addHorizontalEndPoints(left, right, axisIntercept); double rootVals[2]; int roots = horizontalIntersect(axisIntercept, rootVals); for (int index = 0; index < roots; ++index) { double x; double quadT = rootVals[index]; xy_at_t(quad, quadT, x, *(double*) NULL); double lineT = (x - left) / (right - left); if (pinTs(quadT, lineT)) { intersections.insert(quadT, lineT); } } if (flipped) { flip(); } return intersections.fUsed; }
int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) { addExactVerticalEndPoints(top, bottom, axisIntercept); if (fAllowNear) { addNearVerticalEndPoints(top, bottom, axisIntercept); } double rootVals[2]; int roots = verticalIntersect(axisIntercept, rootVals); for (int index = 0; index < roots; ++index) { double quadT = rootVals[index]; SkDPoint pt = fQuad.ptAtT(quadT); double lineT = (pt.fY - top) / (bottom - top); if (pinTs(&quadT, &lineT, &pt, kPointInitialized)) { fIntersections->insert(quadT, lineT, pt); } } if (flipped) { fIntersections->flip(); } return fIntersections->used(); }
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped) { addExactHorizontalEndPoints(left, right, axisIntercept); if (fAllowNear) { addNearHorizontalEndPoints(left, right, axisIntercept); } double rootVals[2]; int roots = horizontalIntersect(axisIntercept, rootVals); for (int index = 0; index < roots; ++index) { double quadT = rootVals[index]; SkDPoint pt = fQuad.ptAtT(quadT); double lineT = (pt.fX - left) / (right - left); if (pinTs(&quadT, &lineT, &pt, kPointInitialized)) { fIntersections->insert(quadT, lineT, pt); } } if (flipped) { fIntersections->flip(); } return fIntersections->used(); }
int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) { addExactVerticalEndPoints(top, bottom, axisIntercept); if (fAllowNear) { addNearVerticalEndPoints(top, bottom, axisIntercept); } double roots[3]; int count = VerticalIntersect(fCubic, axisIntercept, roots); for (int index = 0; index < count; ++index) { double cubicT = roots[index]; SkDPoint pt = { axisIntercept, fCubic.ptAtT(cubicT).fY }; double lineT = (pt.fY - top) / (bottom - top); if (pinTs(&cubicT, &lineT, &pt, kPointInitialized) && uniqueAnswer(cubicT, pt)) { fIntersections->insert(cubicT, lineT, pt); } } if (flipped) { fIntersections->flip(); } checkCoincident(); return fIntersections->used(); }
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped) { addExactHorizontalEndPoints(left, right, axisIntercept); if (fAllowNear) { addNearHorizontalEndPoints(left, right, axisIntercept); } double roots[3]; int count = HorizontalIntersect(fCubic, axisIntercept, roots); for (int index = 0; index < count; ++index) { double cubicT = roots[index]; SkDPoint pt = { fCubic.ptAtT(cubicT).fX, axisIntercept }; double lineT = (pt.fX - left) / (right - left); if (pinTs(&cubicT, &lineT, &pt, kPointInitialized) && uniqueAnswer(cubicT, pt)) { fIntersections->insert(cubicT, lineT, pt); } } if (flipped) { fIntersections->flip(); } checkCoincident(); return fIntersections->used(); }
int intersect() { addExactEndPoints(); if (fAllowNear) { addNearEndPoints(); } if (fIntersections->used() == 2) { // FIXME : need sharable code that turns spans into coincident if middle point is on } else { double rootVals[2]; int roots = intersectRay(rootVals); for (int index = 0; index < roots; ++index) { double quadT = rootVals[index]; double lineT = findLineT(quadT); SkDPoint pt; if (pinTs(&quadT, &lineT, &pt, kPointUninitialized)) { fIntersections->insert(quadT, lineT, pt); } } } return fIntersections->used(); }