A better way to draw SVG lines

I decided that I was unhappy with the version I first came up (see 2 posts back), so googled for something on Stackoverflow and found a much better approach.

This is how it’s now going to be done on XVG.

What impresses me with this algorithm by enxaneta is its simplicity, elegance and speed.

Enxaneta is a prolific SVG expert.  I intend to study his user page on SO and learn from all his cool examples.

What is really pleasing about this gem is that it means that XVG does not have to be burdened with some svg graphics library or framework in order to do something as simple but crucial as drawing an SVG line by dragging a mouse on the screen.