public void addSpline(int x, int y)
    {
        if (last != null && Math.sqrt(Math.pow(x - last.x, 2) + Math.pow(y - last.y, 2)) < Const.brushWidth)
            return;
        Spline s = new Spline(x, y, last);
        if (last != null && last.prev != null)
        {
            if (Math.abs(getAngle(s) - getAngle(last)) > 1.5 * Math.PI)
                last.angle = (getAngle(s) - getAngle(last)) / 2;
            else    last.angle = (getAngle(s) + getAngle(last)) / 2;
        }
        last = s;
        if (isStraightAngle())
            last.prev = last.prev.prev;
    }