'How to build a mesh from a line renderer drawing?

I want a user to be able to draw a shape (let's say a non-perfect circle) using the line renderer with a cursor. Upon closing the loop to create the circle, I want to instantly build a mesh from the drawing. How can I accomplish this? View the image I attached for reference.line render circle

If these are the points included with a line renderer, how do I go about connecting the vertices and triangles to build the mesh? Any help is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source