1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Test::Test(){
r1 = 2;
counter = 0.1; // setting counter back to 0.1 so new sub Object start in the middle
};
void Test::hej(float x, float y, float r2){
float n = 56.5;
r2 = counter +1; // increasing r2 by 1
ofBeginShape();
for (float i = 0; i<360; i+=360/n){
x = 0+cos(i/n)*r2;
y = 0+sin(i/n)*r2;
// r2 is the reason the circles expands outwards, as it is increasing
ofFill();
ofDrawCircle(x, y, r1);
ofNoFill();
ofVertex(x, y);
}
ofEndShape();
float dist = ofDist(x, y, 0, 0);
if (dist > 200){
Test subTest;
subTest.hej(0, 0, 0.1); // starting sub Object at the same place as the first, in the middle, setting r2 to 0.1
}
counter = r2; // counter saves this size of r2 for next loop, as it is initialized back to 0.1 in ofApp.cpp
cout << r2 << endl;
}
|