@Override
    public boolean contains(Point2D position) {
        double flatness = 0.01;
        boolean intersect = false;
        PathIterator pit = path.getPathIterator(null, flatness);
        double[] coords = new double[6];
        double lastX = 0, lastY = 0;
        while (!intersect && !pit.isDone()) {
            int type = pit.currentSegment(coords);
            switch (type) {
                case PathIterator.SEG_MOVETO:
                    lastX = coords[0];
                    lastY = coords[1];
                    break;
                case PathIterator.SEG_LINETO:
                    BasicStroke stroke = new BasicStroke(10.0f);
                    Line2D.Double line = new Line2D.Double(lastX, lastY,
                            coords[0], coords[1]);
                    Shape shape = stroke.createStrokedShape(line);
                    if (shape.contains(position)) {
                        intersect = true;
                    }

                    lastX = coords[0];
                    lastY = coords[1];
            }
            pit.next();
        }
        return intersect;
    }