sverchok
sverchok copied to clipboard
Distance Line Line wrong result
When applying this node to parrallel lines, intersection flag is True instead of False (the distance between lines is far greater than Tolerance). Could this be corrected?
it's behaving as intended, according to the code that implements that function.
In case of parallel lines it will return the origin of the first line as the closest point
https://github.com/nortikin/sverchok/blob/675f70c33f537c87f546e35a8394fe63960dec44/utils/geom.py#L2479-L2510
i think your suggestion is valid.
when the else
is run, the dist = (inter_p[0] - line_origin_b).length
part is (i think) likely (but depending on the orientation of the lines) to be an operation on the same vector3d. there inter_p[0]
and line_origin_b
are identical, and subtracting one from the other will result in a (0, 0, 0)
and have 0
length
One solution is to calculate the angle between the line's directions and if it is 0 or 180, output false for intersection.
Well, after analysing it a bit, the problem just stems from a little mistake from the author of the function : instead of dist = (inter_p[0] - line_origin_b).length
, it should be dist = (inter_p[0] - line_origin_a).length
. Perhaps you could correct that, @zeffii.