how to join random points with lines and detect intersection ? I'm looking to create a game like untangle.

I’m a beginner and didn’t find anything helpful on the internet that I understood. But I got a few leads
*I have to create random points
*perform a triangulation to form a planar graph
*randomize the vertices to make it non planar
*let the user rearrange the vertices
*detect when they are planar again

It would be very helpful if some one provided a simplified explanation for my problem.

Do you want to determine whether 2 lines intersect each other or not? Right? I found this small article. I didn’t have a chance to check if it works. Check it out by yourself:

Article

Good luck!