Exemple #1
0
    private bool isPointInside(Vector2 point)
    {
        var collisionLine = new CSGsegment(point, new Vector2(largePositive, point.y));

        CSGsegment.LetterCounter--;
        int counter = 0;

        foreach (var i in this.segments)
        {
            if (collisionLine.doesIntersect(i))
            {
                counter++;
            }
        }
        return(counter % 2 == 1);       //odd number of intersections? then it is inside the shape
    }