Ejemplo n.º 1
0
    static public bool overlap(SceneShapeLine shape1, SceneShapePolygon shape2)
    {
        LineSegf line = new LineSegf(new Vector2f(shape1.mVertex1.x, shape1.mVertex1.y), new Vector2f(shape1.mVertex2.x, shape1.mVertex2.y));

        for (int i = 1; i < shape2.mPts.Count; i++)
        {
            Vector2f p1 = new Vector2f(shape2.mPts[i - 1].x, shape2.mPts[i - 1].y);
            Vector2f p2 = new Vector2f(shape2.mPts[i].x, shape2.mPts[i].y);

            if (Geometryalgorithm2d.lineseg_intersect_lineseg(line, new LineSegf(p1, p2)))
            {
                return(true);
            }
        }

        return(false);
    }
Ejemplo n.º 2
0
 static public bool overlap(SceneShapeLine shape1, SceneShapeLine shape2)
 {
     return(Geometryalgorithm2d.lineseg_intersect_lineseg(
                new LineSegf(new Vector2f(shape1.mVertex1.x, shape1.mVertex1.y), new Vector2f(shape1.mVertex2.x, shape1.mVertex2.y)),
                new LineSegf(new Vector2f(shape2.mVertex1.x, shape2.mVertex1.y), new Vector2f(shape2.mVertex2.x, shape2.mVertex2.y))));
 }