leovandriel / cvplot

Graph plots, drawing, layout and windows in OpenCV
MIT License
122 stars 26 forks source link

set with vector<pair<float, cvplot::Point2>> does not work as expected. #12

Open copark86 opened 5 years ago

copark86 commented 5 years ago

It seems like set function does not handle cvplot::Circle data properly.

    std::vector<std::pair<float, cvplot::Point2>> pole({
      std::pair<float, cvplot::Point2>(5.0f,{X(0),Y(0)})    // Expected usage of set with vector<pair<float, Point2>>
      std::pair<float, cvplot::Point2>(X(0),{Y(0),5.0f})    // The code actually works.  
    });
    figure.series("South Pole")    
    .type(cvplot::Circle)
    .color(cvplot::Red)
    .set( pole);    
    figure.show(false); 
leovandriel commented 2 years ago

I agree, it is a little confusing. FWIW, the idea is plotting y and radius against x, therefore grouping y and radius in the second argument. I am open to a rewrite of some of this logic. The balance between expressiveness and ease of use depends on the kinds of plots (dimensionality of data) cvplot should be supporting.