void LidarOverlay::createFillCoordinates()

in sensor_fusion_pkg/src/lidar_overlay.cpp [86:175]


    void LidarOverlay::createFillCoordinates() {
    /*
        topLeftCorner       topRightCorner
                    p0   p12
                 _______________       
            p2  |  0 \     /  7,|  p10
                | `   \   / ,   |
            p3  |__1_`_\ /____6_|  p9
                |      /|\      |
                |  2 /  |  \  5 |
                |__/__3_|_4__\__|
                    p5         p7     
        bottomLeftCorner    bottomRightCorner
                    bottomCenter
                                    (p3 and p9 are not at center)
                                    (image not to scale)
    */  
        // Create end points required for the fill coordinates        
        centerPoint_ = cv::Point(imageWidth_/2, imageHeight_/2);
        cv::Point bottomcenterPoint_ = cv::Point(imageWidth_/2, imageHeight_);
        cv::Point topLeftCornerPoint = cv::Point(0, 0);
        cv::Point topRightCornerPoint = cv::Point(imageWidth_, 0);
        cv::Point bottomLeftCornerPoint = cv::Point(0, imageHeight_);
        cv::Point bottomRightCornerPoint = cv::Point(imageWidth_, imageHeight_);
        // Left half
        cv::Point p0 = cv::Point((imageWidth_/2) - tan(DEG2RAD(30)) * (imageHeight_/2), 0);
        cv::Point p2 = cv::Point(0, tan(DEG2RAD(22.5))*(imageWidth_/2));
        cv::Point p3 = cv::Point(0, (imageHeight_/2) + tan(DEG2RAD(15))*(imageWidth_/2));
        cv::Point p5 = cv::Point((imageWidth_/2) - tan(DEG2RAD(37.5)) * (imageHeight_/2), imageHeight_);
        // Right half
        cv::Point p7 = cv::Point((imageWidth_/2) + tan(DEG2RAD(37.5)) * (imageHeight_/2), imageHeight_);
        cv::Point p9 = cv::Point(imageWidth_, (imageHeight_/2) + tan(DEG2RAD(15)) * (imageWidth_/2));
        cv::Point p10 = cv::Point(imageWidth_, tan(DEG2RAD(22.5)) * (imageWidth_/2));
        cv::Point p12 = cv::Point((imageWidth_/2) + tan(DEG2RAD(30)) * (imageHeight_/2), 0);

        // Sector 0 - -150 degrees to -112.5 degrees
        std::vector<std::vector<cv::Point>> sector0 = {{{centerPoint_},
                     {p0},
                     {topLeftCornerPoint},
                     {p2}}};
        // Sector 1 - -112.5 degrees to -75 degrees
        std::vector<std::vector<cv::Point>> sector1 = {{{centerPoint_},
                     {p2},
                     {p3}}};
        // Sector 2 - -75 degrees to -37.5 degrees
        std::vector<std::vector<cv::Point>> sector2 = {{{centerPoint_},
                     {p3},
                     {bottomLeftCornerPoint},
                     {p5}}};
        // Sector 3 - -37.5 degrees to 0 degrees
        std::vector<std::vector<cv::Point>> sector3 = {{{centerPoint_},
                     {p5},
                     {bottomcenterPoint_}}};
        // Sector 4 - 0 degrees to 37.5 degrees
        std::vector<std::vector<cv::Point>> sector4 = {{{centerPoint_},
                     {p7},
                     {bottomcenterPoint_}}};
        // Sector 5 - 37.5 degrees to 75 degrees
        std::vector<std::vector<cv::Point>> sector5 = {{{centerPoint_},
                     {p9},
                     {bottomRightCornerPoint},
                     {p7}}};
        // Sector 6 - 75 degrees to 112.5 degrees
        std::vector<std::vector<cv::Point>> sector6 = {{{centerPoint_},
                     {p10},
                     {p9}}};
        // Sector 7 - 112.5 degrees to 150 degrees
        std::vector<std::vector<cv::Point>> sector7 = {{{centerPoint_},
                     {p12},
                     {topRightCornerPoint},
                     {p10}}};
        sectorCoordinatesMap_[0] = sector0;
        sectorCoordinatesMap_[1] = sector1;
        sectorCoordinatesMap_[2] = sector2;
        sectorCoordinatesMap_[3] = sector3;
        sectorCoordinatesMap_[4] = sector4;
        sectorCoordinatesMap_[5] = sector5;
        sectorCoordinatesMap_[6] = sector6;
        sectorCoordinatesMap_[7] = sector7;
        // Save sector end points to draw sector seperator lines
        sectorEndPoints_.push_back(p0);
        sectorEndPoints_.push_back(p2);
        sectorEndPoints_.push_back(p3);
        sectorEndPoints_.push_back(p5);
        sectorEndPoints_.push_back(bottomcenterPoint_);
        sectorEndPoints_.push_back(p7);
        sectorEndPoints_.push_back(p9);
        sectorEndPoints_.push_back(p10);
        sectorEndPoints_.push_back(p12);                                                    
    }