cv::boundingRect always get a larger rect (extra right line and a bottom line)

i want to crop a polar with such parameter:

    cv::Point2f center{7000, 3000};
    float inner_radius = 1000;
    float outter_radius = 2000;
    float start_angle = 0;
    float extend_angle = 270;

i get bounding rect through code blow:

 std::vector<cv::Point2f> points;
    float step = 1.0f;
    for (size_t i = start_angle; i <= (start_angle + extend_angle); i += step)
    {
        float rad = DegreeToRadian(i);
        points.emplace_back(center + inner_radius * cv::Point2f(std::cos(rad), std::sin(rad)));
        points.emplace_back(center + outer_radius * cv::Point2f(std::cos(rad), std::sin(rad)));
    }
    for (size_t i = 0; i < 5; ++i)
    {
        float angle = 0.f + i * 90.0f;
        if (InRange(angle, start_angle, start_angle + extend_angle))
        {
            float rad = DegreeToRadian(angle);
            points.emplace_back(center + inner_radius * cv::Point2f(std::cos(rad), std::sin(rad)));
            points.emplace_back(center + outer_radius * cv::Point2f(std::cos(rad), std::sin(rad)));
        }
    }
    float end_rad = DegreeToRadian(start_angle + extend_angle);
    points.emplace_back(center + inner_radius * cv::Point2f(std::cos(end_rad), std::sin(end_rad)));
    points.emplace_back(center + outer_radius * cv::Point2f(std::cos(end_rad), std::sin(end_rad)));
    auto mini_rect = cv::boundingRect(points);

the output is :


why the width and height is 4001 and 4001, the expected value is 4000 and 4000, how can i get the expected value?

please state the values of the outermost points in all cardinal directions.

now imagine those pixels being filled.

yes, opencv has various notions of width that are rarely if ever properly distinguished or stated. some use pixels (which have extent), some use points (which don’t).

i use c++ stl get max and min value of x and y value:

    std::vector<float> x;
    std::vector<float> y;
    for (size_t i = 0; i < points.size(); ++i)
    {
        x.emplace_back(points[i].x);
        y.emplace_back(points[i].y);
    }
    float max_x = *std::max_element(x.begin(), x.end());
    float min_x = *std::min_element(x.begin(), x.end());
    float max_y = *std::max_element(y.begin(), y.end());
    float min_y = *std::min_element(y.begin(), y.end());

min_x is 5000.000
max_x is 9000.000
min_y is 1000.000
max_y is 5000.000

so the boundingrect’s width and height of the input points should be 4000 and 4000?

so i should subtract the result’s width and height of the cv::boundingrect function by one to get the expected value?