I want to create a genrator of "not perfect circles", circles that are a bit twisted and more random, but still look a bit like circle or maybe a cloud.
This is what I mean by not perfect circles:
I want to create a function that gets the maximum and minimum scale of the "not perfect circle" and gets all of its points. I know the formula of a circle: X^2+Y^2=R^2 but I cant think of a way to make it a bit more random. Anyone has any ideas?
Edit: trying to draw a perfect circle with points but it wont work:
for (int step = 0; step < 300; ++step) {
double t = step / 300 * 2 * Math.PI;
c.drawPoint(300+(float)(33 * Math.cos(t)), 300+(float)(33 * Math.sin(t)), p);
}
Edit 2:
for (int step = 0; step < 20; ++step) {
double t = step / 20.0 * 2 * Math.PI;
double imperfectR = 50.0+randInt(10, 50);
//I do it here?
points[step]=new PointF();
points[step].set((300+(float)(imperfectR * Math.cos(t))), 300+(float)(imperfectR * Math.sin(t)));
if(step==0){
pp.moveTo(points[step].x, points[step].y);
}
else
pp.quadTo(points[step-1].x, points[step-1].y,points[step].x, points[step].y);
}
Edit 3:
double t=0;
for (int i = 0; i < points.length/4; i++) {
if(t==1){
t=0;
}
t+=0.10;
double imperfectR=0.5*((2*points[i+1].y)+(-points[i].y+points[i+2].y)*t+(2*points[i].y-5*points[i+1].y+4*points[i+2].y-points[i+3].y)*(t*t)+((-points[i].y+3*points[i+1].y-3*points[i+2].y+points[i+3].y)*(t*t*t)));
newPoints[i].set((300+(float)(imperfectR * Math.cos(t))), 300+(float)(imperfectR * Math.sin(t)));
t+=0.10;
imperfectR=0.5*((2*points[i+1].y)+(-points[i].y+points[i+2].y)*t+(2*points[i].y-5*points[i+1].y+4*points[i+2].y-points[i+3].y)*(t*t)+((-points[i].y+3*points[i+1].y-3*points[i+2].y+points[i+3].y)*(t*t*t)));
newPoints[i+1].set((300+(float)(imperfectR * Math.cos(t))), 300+(float)(imperfectR * Math.sin(t)));
t+=0.10;
imperfectR=0.5*((2*points[i+1].y)+(-points[i].y+points[i+2].y)*t+(2*points[i].y-5*points[i+1].y+4*points[i+2].y-points[i+3].y)*(t*t)+((-points[i].y+3*points[i+1].y-3*points[i+2].y+points[i+3].y)*(t*t*t)));
newPoints[i+2].set((300+(float)(imperfectR * Math.cos(t))), 300+(float)(imperfectR * Math.sin(t)));
t+=0.10;
imperfectR=0.5*((2*points[i+1].y)+(-points[i].y+points[i+2].y)*t+(2*points[i].y-5*points[i+1].y+4*points[i+2].y-points[i+3].y)*(t*t)+((-points[i].y+3*points[i+1].y-3*points[i+2].y+points[i+3].y)*(t*t*t)));
newPoints[i+3].set((300+(float)(imperfectR * Math.cos(t))), 300+(float)(imperfectR * Math.sin(t)));
if(i==0){
pp.moveTo(newPoints[i].x, newPoints[i].y);
}
pp.lineTo(newPoints[i].x, newPoints[i].y);
pp.lineTo(newPoints[i+1].x, newPoints[i+1].y);
pp.lineTo(newPoints[i+2].x, newPoints[i+2].y);
pp.lineTo(newPoints[i+3].x, newPoints[i+3].y);
}
pp.close();