You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
555 B
16 lines
555 B
1 month ago
|
import { quadraticProjectPoint } from '../core/curve.js';
|
||
|
export function containStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
|
||
|
if (lineWidth === 0) {
|
||
|
return false;
|
||
|
}
|
||
|
var _l = lineWidth;
|
||
|
if ((y > y0 + _l && y > y1 + _l && y > y2 + _l)
|
||
|
|| (y < y0 - _l && y < y1 - _l && y < y2 - _l)
|
||
|
|| (x > x0 + _l && x > x1 + _l && x > x2 + _l)
|
||
|
|| (x < x0 - _l && x < x1 - _l && x < x2 - _l)) {
|
||
|
return false;
|
||
|
}
|
||
|
var d = quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null);
|
||
|
return d <= _l / 2;
|
||
|
}
|