I want to make a program where I have a collection of labeled vertices and edges between the vertices such that they join up with edges $a_{1} a_{2}, \; a_{2} a_{3}, \ldots ,\; a_{n} a_{1}$, so the edges form a "circle". Then I want to be able to input whether edges cross each other, and if they do, which edge crosses over and which edge crosses under. Is it possible to do this with Mathematica?
Examples:
|
|||||||||||
|
|
When you say you want to input, do you mean you want the code to output whether or not the lines cross? Is this what you're looking for? It's not pretty but it should do the trick. The elements in table t1 below should give you all the information you need. The rows and columns correspond to different edges and when they are non-zero it means that they are intersecting. The values are the positions at which they cross in (x,y) coordinates. r2 are the vertices of the circle:
These define the lines making up the circle:
These are the equations for the lines:
These functions are just min and max functions for the end points of a given line
This gives you a table which contains zero when there is no intersection, and the point of the intersection if there is one. It does not give intersections of lines with themselves or with their neighbours which are trivial.
This plots the lines generated randomly above and then points in the points of the intersections. I think from t1 you should be able to see, in your definition, which lies above and below which line
|
|||||||
|



Graphics[{Line[{{0,0},{1,1}}]]to draw a lince between points{0,0}and{1,1}. You can use styling to make the latest line appear visually on top. But initially you'll get better help if you try to just make a simple example code demonstrating what you would like to do. – jVincent Dec 18 '12 at 8:22