Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        Debug.DrawLine(new Vector3(lineSeg1.a.x, 0, lineSeg1.a.y), new Vector3(lineSeg1.b.x, 0, lineSeg1.b.y), Color.blue, 10000.0f, false);
        Debug.DrawLine(new Vector3(lineSeg2.a.x, 0, lineSeg2.a.y), new Vector3(lineSeg2.b.x, 0, lineSeg2.b.y), Color.cyan, 10000.0f, false);

        Debug.Log(LinesIntersect.FasterLineSegmentIntersection(lineSeg1.a, lineSeg1.b, lineSeg2.a, lineSeg2.b));

        //Debug.Log(LinesIntersect.DoLinesIntersect(lineSeg1, lineSeg2));
    }
Esempio n. 2
0
        private bool CellIntersectedBy(GOTileCell c, LineSeg l)
        {
            bool intersected = false;

            foreach (var edge in c.edges)
            {
                if (LinesIntersect.DoLinesIntersect(edge, l))
                {
                    l.Draw(Color.green);        // draw road line green
                    edge.Draw(Color.green);     // draw cell edge green
                    intersected = true;         // flag this cell to be intersected
                }
                else
                {
                    if (l.color != Color.green)
                    {
                        l.Draw(Color.red);                          // draw road line red
                    }
                }
            }

            return(intersected);
        }