Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

i am going to be crazy!!!where this error coming from????

edited October 2013

The method sq(float) in type PApplet is not applicable for the arguments(float[]))

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+50,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_C;
float equation_a[]=new float[leth],equation_b[]=new float[leth],ellipse_a[]=new float[leth],ellipse_b[]=new float[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,center_X+2*(ellipse_center_X-center_X),ellipse_center_Y);
eqt();
step=20;
}

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-sqrt(sq(equation_B)-4*eqation_A*equation_C))>=0){equation_a[i]=1/((equation_B-sqrt(sq(equation_B)-4*eqation_A*equation_C))/2*equation_A);}
else if((equation_B-sqrt(sq(equation_B)-4*eqation_A*equation_C))<0){equation_a[i]=1/((equation_B+sqrt(sq(equation_B)-4*eqation_A*equation_C))/2*equation_A);}
else{println("@@@@@@@@@@@@@@@@@@");}
equation_b[i]=sq(equation_c)-equation_a[i];
ellipse_a[i]=sqrt(equation_a[i]);
ellipse_b[i]=sqrt(equation_b[i]);
}
}

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=100;
y=100;
size_1=30;
}

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;}
}
}
Tagged:

• edited October 2013 Answer ✓

Did you try running this in the Processing IDE? It would give you many other errors first.

For instance, 4eqation_Aequation_C does not make sense. Variables can not start with a number. You probably meant 4 * eqation_A * equation_C. I think there are a lot of * signs missing.

You also mispelled equation_A as eqation_A.

The problem is that you have declared equation_A and equation_B as arrays, but used them as floats, without the "[i]" part. You can not send an array of floats to sq().

In the rotte() function, you added an unnecessary float() when assigning x[i], as all the elements are already float.

It would be nice if, before posting your code in the forum, you formatted it in the processing IDE by pressing CTRL+T, and in the forum you surrounded it by <pre language="processing">yourcodehere</pre>. It would look so much nicer :)

• such a simple error,thanks