mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-14 22:43:53 +01:00
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
function draw_line_feedback(x0, y0, x1, y1, th, c1, c0, _s) { #region
|
|
//draw_line_dashed_color(x0, y0, x1, y1, th, c1, c0, 6 * _s);
|
|
//return;
|
|
|
|
var _y0 = y0 - 12 * _s;
|
|
var _y1 = y1 - 12 * _s;
|
|
|
|
var x0e = x0 + 12 * _s * sign(x0 - x1);
|
|
var x1e = x1 - 12 * _s * sign(x0 - x1);
|
|
|
|
draw_line_dashed_color(x0e, y0, x0e, _y0, th, c0, c0, 6 * _s);
|
|
draw_line_dashed_color(x0, y0, x0e, y0, th, c0, c0, 6 * _s);
|
|
|
|
draw_line_dashed_color(x0e, _y0, x1e, _y1, th, c1, c0, 6 * _s);
|
|
|
|
draw_line_dashed_color(x1e, y1, x1e, _y1, th, c1, c1, 6 * _s);
|
|
draw_line_dashed_color(x1e, y1, x1, y1, th, c1, c1, 6 * _s);
|
|
} #endregion
|
|
|
|
function distance_line_feedback(mx, my, x0, y0, x1, y1, _s) { #region
|
|
var _y0 = y0 - 12 * _s;
|
|
var _y1 = y1 - 12 * _s;
|
|
|
|
var x0e = x0 + 12 * _s * sign(x0 - x1);
|
|
var x1e = x1 - 12 * _s * sign(x0 - x1);
|
|
|
|
var dd = 99999999;
|
|
|
|
dd = min(dd, distance_to_line(mx, my, x0e, y0, x0e, _y0));
|
|
dd = min(dd, distance_to_line(mx, my, x0, y0, x0e, y0));
|
|
|
|
dd = min(dd, distance_to_line(mx, my, x0e, _y0, x1e, _y1));
|
|
|
|
dd = min(dd, distance_to_line(mx, my, x1e, y1, x1e, _y1));
|
|
dd = min(dd, distance_to_line(mx, my, x1e, y1, x1, y1));
|
|
|
|
return dd;
|
|
} #endregion |