We are about to switch to a new forum software. Until then we have removed the registration on this forum.
int leth=1,sze_X=900,sze_Y=600;
float center_X=sze_X/3,center_Y=sze_Y/3,ellipse_center_X=center_X+0.15,ellipse_center_Y=center_Y,equation_c;
float x[]=new float[leth],y[]=new float[leth],size_1[]=new float[leth],step[]=new float[leth],angle[]=new float[leth],equation_a[]=new float[leth],equation_b[]=new float[leth],equation_A[]=new float[leth],equation_B[]=new float[leth],equation_C;
double ellipse_a[]=new double[leth],ellipse_b[]=new double[leth];
boolean negation_X[]=new boolean[leth],negation_Y[]=new boolean[leth];
void setup(){
size(sze_X,sze_Y,OPENGL);
background(0);
smooth(8);
noStroke();
rdm();
equation_c=dist(center_X,center_Y,ellipse_center_X,ellipse_center_Y);
eqt();
println(ellipse_a[0]+","+ellipse_b[0]+","+equation_c+",");
step[0]=0.01;
}
void rdm(){
int half_size=45;
for(int i=0;i<leth;i++){
x[i]=random(-sze_X,sze_X);
y[i]=random(-sze_Y,sze_Y);
if(center_X-half_size-13<=x[i]&&x[i]<=center_X+half_size+13){
if(center_Y-half_size-13<=y[i]&&y[i]<=center_Y+half_size+13){
while(center_Y-half_size-13<=y[i]&&y[i]<=center_Y+half_size+13){y[i]=random(0,sze_Y);}
}
}
size_1[i]=random(5,13);
}
x[0]=100;
y[0]=100;
size_1[0]=30;
}
void eqt(){
for(int i=0;i<leth;i++){
equation_A[i]=sq(equation_c)*sq(x[i]);
equation_B[i]=sq(x[i])+sq(y[i])+sq(equation_c);
equation_C=1;
if((equation_B[i]-sqrt(sq(equation_B[i])-4*equation_A[i]*equation_C))>=0){equation_a[i]=1/((equation_B[i]-sqrt(sq(equation_B[i])-4*equation_A[i]*equation_C))/2*equation_A[i]);}
else if((equation_B[i]-sqrt(sq(equation_B[i])-4*equation_A[i]*equation_C))<0){equation_a[i]=1/((equation_B[i]+sqrt(sq(equation_B[i])-4*equation_A[i]*equation_C))/2*equation_A[i]);}
else{println("@@@@@@@@@@@@@@@@@@");}
equation_b[i]=equation_a[i]-sq(equation_c);
ellipse_a[i]=sqrt(equation_a[i]);
ellipse_b[i]=sqrt(equation_b[i]);
}
}
void draw(){
color blk=color(0,0,0);
color blu=color(100,255,252);
int size=100;
float number=0.01;
color change=lerpColor(blk,blu,0);
clear();
for(int i=0;i<100;i++){
if(number<=1){
change=lerpColor(blk,blu,number);
number=number+0.01;
fill(change);
}
else{
fill(blu);
}
if(size>0){
ellipse(center_X,center_Y,size,size);
}
size=size-1;
}
star();
rotte();
}
void star(){
color blc=color(0,0,0);
color org=color(255,252,45);
float size_2=5.0;
float number;
color change;
for(int i=0;i<leth;i++){
size_2=size_1[i];
number=0;
for(int j=0;j<size_1[i];j++){
if(number<=1){
change=lerpColor(blc,org,number);
number=number+1/size_1[i];
fill(change);
}
else{
fill(org);
}
if(size_2>0){
if(negation_X[i]==true){
if(negation_Y[i]==true){ellipse(-x[i],-y[i],size_2,size_2);}
else{ellipse(-x[i],y[i],size_2,size_2);}
}
else{
if(negation_Y[i]==true){ellipse(x[i],-y[i],size_2,size_2);}
else{ellipse(x[i],y[i],size_2,size_2);}
}
ellipse(x[i],y[i],size_2,size_2);
negation_X[i]=false;negation_Y[i]=false;
}
size_2=size_2-1;
}
}
}
void rotte(){
int i;
for(i=0;i<leth;i++){
x[i]=(float)(x[i]+ellipse_a[i]*cos(angle[i]));
y[i]=(float)(y[i]+ellipse_b[i]*sin(angle[i]));
angle[i]+=step[i];
if(angle[i]>TWO_PI){angle[i]-=TWO_PI;}
if(x[i]<0){negation_X[i]=true;x[i]=-x[i];}
else if(y[i]<0){negation_Y[i]=true;y[i]=-y[i];}
else{negation_X[i]=false;negation_Y[i]=false;}
}
}
Answers
why can't see full of rotte()?is forum goes wrong?
Here's your formatted code. All lines gotta have at least 4 spaces in order for the auto-format to kick in!
We can accomplished that within Processing's IDE by CTRL+T, CTRL+A and then CTRL+].
not understand....... i am using chrome ctrl+T is to open a new label,and click ctrl+a is choosing all words but ctrl+] the same no use.
I guess I've mentioned it's the Processing's IDE itself? 8-X
After doing the whole scheme there, use CTRL+C to transfer it to be posted here!
Just paste the code here, select it and click the button labeled "C", that should indent your code properly.
Oh! It wasn't so before. It just wrapped highlighted text in apostrophes. Nice it's changed now! \m/
But there are some bugs yet:
Stroke button doesn't work.
And there's no underline button. Which is more useful than stroke.
Some color buttons.
image hosting.
And quotes button doesn't seem to make much difference from a normal text!
could somebody answer my question?the programming problem.....
what programming problem? you haven't asked a question, just posted a bunch of code.
what is wrong? what do you expect? what are you seeing instead?
@GoToLoop .. there is not underline or strikethrough in markdown i'm afraid. That's why it's not working. I will possibly remove the buttons.
Let's further discuss this in another discussion, @ATC243750496 would like an answer eventually ..
@ATC243750496 has open another topic which has the code and is a little clearer as to the problem so I suggest answers should go there.
how to make a ball/round running with a ellipse track
OK, closing this one.