Функция DrawCircle
должна возвращать центральную точку круга. Используйте PVector
для типа возврата:
PVector DrawCircle(float x, float y, float d, float i) {
// [...]
return new PVector(x, y);
}
Нарисуйте линию от текущей центральной точки до центральной точки, которая возвращается из рекурсивного вызова:
PVector innerCpt = DrawCircle(x, y, d/2, i * -1);
line(innerCpt.x, innerCpt.y, x, y);
См. Пример:
float x = 350.0;
float y = 350.0;
float dia = 699;
float i = 1;
float z;
float p;
float s = 500;
void setup(){
size(700,700);
}
void draw(){
noFill();
stroke(255);
strokeWeight(1);
background(0);
scale(1);
DrawCircle(x, y, dia, i);
}
PVector DrawCircle(float x, float y, float d, float i){
strokeWeight(1);
ellipse(x, y, d, d);
strokeWeight(3);
point(x,y);
z += 0.001;
x += (sin(i*z/d*s)/2)*d/2;
y += (cos(i*z/d*s)/2)*d/2;
if(d > 0.1){
PVector innerCpt = DrawCircle(x, y, d/2, i * -1);
line(innerCpt.x, innerCpt.y, x, y);
}
return new PVector(x, y);
}