Last active
December 10, 2019 07:56
-
-
Save Akira-Hayasaka/012e407dc2ce18b2faa38a21180ae65b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto get_bbox = [](const vector<ofVec2f> pts) -> ofRectangle | |
{ | |
auto xpair = std::minmax_element(pts.begin(), pts.end(), | |
[](const ofVec2f& a, const ofVec2f& b) { | |
return a.x < b.x; | |
}); | |
auto ypair = std::minmax_element(pts.begin(), pts.end(), | |
[](const ofVec2f& a, const ofVec2f& b) { | |
return a.y < b.y; | |
}); | |
return ofRectangle( | |
xpair.first->x, ypair.first->y, | |
xpair.second->x - xpair.first->x, ypair.second->y - ypair.first->y); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment