Lines Matching full:line
12 From http://en.wikipedia.org/wiki/Line-line_intersection
14 SkDPoint SkIntersections::Line(const SkDLine& a, const SkDLine& b) {
29 int SkIntersections::computePoints(const SkDLine& line, int used) {
30 fPt[0] = line.ptAtT(fT[0][0]);
32 fPt[1] = line.ptAtT(fT[0][1]);
80 // see if end points intersect the opposite line
92 /* Determine the intersection point of two line segments
137 static int horizontal_coincident(const SkDLine& line, double y) {
138 double min = line[0].fY;
139 double max = line[1].fY;
146 if (AlmostEqualUlps(min, max) && max - min < fabs(line[0].fX - line[1].fX)) {
152 static double horizontal_intercept(const SkDLine& line, double y) {
153 return (y - line[0].fY) / (line[1].fY - line[0].fY);
156 int SkIntersections::horizontal(const SkDLine& line, double y) {
157 int horizontalType = horizontal_coincident(line, y);
159 fT[0][0] = horizontal_intercept(line, y);
167 int SkIntersections::horizontal(const SkDLine& line, double left, double right,
169 // see if end points intersect the opposite line
172 if ((t = line.exactPoint(leftPt)) >= 0) {
177 if ((t = line.exactPoint(rightPt)) >= 0) {
181 if ((t = SkDLine::ExactPointH(line[index], left, right, y)) >= 0) {
182 insert((double) index, flipped ? 1 - t : t, line[index]);
186 int result = horizontal_coincident(line, y);
188 fT[0][0] = horizontal_intercept(line, y);
189 double xIntercept = line[0].fX + fT[0][0] * (line[1].fX - line[0].fX);
193 // OPTIMIZATION: ? instead of swapping, pass original line, use [1].fX - [0].fX
198 return computePoints(line, result);
204 if ((t = line.nearPoint(leftPt)) >= 0) {
209 if ((t = line.nearPoint(rightPt)) >= 0) {
213 if ((t = SkDLine::NearPointH(line[index], left, right, y)) >= 0) {
214 insert((double) index, flipped ? 1 - t : t, line[index]);
221 static int vertical_coincident(const SkDLine& line, double x) {
222 double min = line[0].fX;
223 double max = line[1].fX;
236 static double vertical_intercept(const SkDLine& line, double x) {
237 return (x - line[0].fX) / (line[1].fX - line[0].fX);
240 int SkIntersections::vertical(const SkDLine& line, double x) {
241 int verticalType = vertical_coincident(line, x);
243 fT[0][0] = vertical_intercept(line, x);
251 int SkIntersections::vertical(const SkDLine& line, double top, double bottom,
253 // see if end points intersect the opposite line
256 if ((t = line.exactPoint(topPt)) >= 0) {
261 if ((t = line.exactPoint(bottomPt)) >= 0) {
265 if ((t = SkDLine::ExactPointV(line[index], top, bottom, x)) >= 0) {
266 insert((double) index, flipped ? 1 - t : t, line[index]);
270 int result = vertical_coincident(line, x);
272 fT[0][0] = vertical_intercept(line, x);
273 double yIntercept = line[0].fY + fT[0][0] * (line[1].fY - line[0].fY);
277 // OPTIMIZATION: instead of swapping, pass original line, use [1].fY - [0].fY
282 return computePoints(line, result);
288 if ((t = line.nearPoint(topPt)) >= 0) {
293 if ((t = line.nearPoint(bottomPt)) >= 0) {
297 if ((t = SkDLine::NearPointV(line[index], top, bottom, x)) >= 0) {
298 insert((double) index, flipped ? 1 - t : t, line[index]);