You can also define your path as a polygon and use a “point in polygon” algorithm in the fragment shader to draw the path:
https://playground.babylonjs.com/#UYM88A#7
I have used the algorithm described in this page (end of the page): Determining Whether A Point Is Inside A Complex Polygon