# ofPath blobby question

I have a vector of a class that’ll return ofPoints. The vector is sorted by angle from the centre (red) from this i’ve been able to draw a filled ofPath, super blobby style. The points move so the creation of the path is done in the draw function.
The problem I’m having is that the points which are close to the centre make the path tuck in and it kinds starts breaking the aesthetic. So what i really need is something like the bottom image.
What would be the best way to do that?

Thanks

just for other people’s reference i ended up using a convex hull algorithm to work it out:
So if you give it a vector of ofPoints sorted by increasing X value then it will return a vector of points just like i was looking for above

``````#ifndef chainHull_h
#define chainHull_h

// Implementation of Andrew's monotone chain 2D convex hull algorithm.
// Asymptotic complexity: O(n log n).
// Practical performance: 0.5-1.0 seconds for n=1000000 on a 1GHz machine.
#include <algorithm>
#include <vector>
using namespace std;

class ChainHull{
public:

typedef double coord_t;         // coordinate type
typedef double coord2_t;  // must be big enough to hold 2*max(|coordinate|)^2

// 2D cross product of OA and OB vectors, i.e. z-component of their 3D cross product.
// Returns a positive value, if OAB makes a counter-clockwise turn,
// negative for clockwise turn, and zero if the points are collinear.
coord2_t cross(const ofPoint &O, const ofPoint &A, const ofPoint &B)
{
return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x);
}

// Returns a list of points on the convex hull in counter-clockwise order.
// Note: the last point in the returned list is the same as the first one.
vector<ofPoint> convex_hull(vector<ofPoint> P)
{
int n = P.size(), k = 0;
vector<ofPoint> H(2*n);

// Sort points lexicographically
//sort(P.begin(), P.end());

// Build lower hull
for (int i = 0; i < n; ++i) {
while (k >= 2 && cross(H[k-2], H[k-1], P[i]) <= 0) k--;
H[k++] = P[i];
}

// Build upper hull
for (int i = n-2, t = k+1; i >= 0; i--) {
while (k >= t && cross(H[k-2], H[k-1], P[i]) <= 0) k--;
H[k++] = P[i];
}

H.resize(k-1);
return H;
}
};
#endif /* chainHull_h */``````
1 Like