Hi,
My problem is: i have 2 group points green and yellow color,
now i need to find the lowest point P1(left side) and highest point P2(right side)
For the green group
The logic that I use is sort to find the point with the smallest X is M to get P1.x=M.x
then sort further to find the point with the smallest Y is N to get P1.y=N.y
The code that I use is as follows and similar to the yellow group:
PT3D ptmin, ptmax;
std::sort(vecptgreen.begin(), vecptgreen.end(), [](PT3D& a, PT3D& b) {
return a.x <= b.x;
});
ptmin.x = vecptgreen[0].x;
std::sort(vecptgreen.begin(), vecptgreen.end(), [](PT3D& a, PT3D& b) {
return a.y <= b.y;
});
ptmin.y = vecptgreen[0].y;

I want to ask is there any way to shorten this process? (Previously these 2 groups were one but I have classified them to make it easier to do)
Thanks you!