We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Polygon triangle;
void setup() {
size(500,500);
triangle = new Polygon (3,100,width/2,height/2) ;
}
void draw() {
triangle.display() ;
}
class Polygon {
int n, r, x, y;
float angle ;
void Polygon (int tn, int tr, int tx, int ty) {
angle = 360/tn;
n=tn;
r=tr;
x=tx;
y=ty;
}
void display() {
strokeWeight(2);
for (int i=0; i<n; i++) {
point((x+rcos(anglei)), (y-rsin(anglei))) ;
}
}
}
Hello to beautiful community of processing! I've recently discovered processing and have stumbled into an error which i cant get rid off even after an hour of googling. Its because I'm not familiar with Java and have learnt a bit of C++ . Can you please take a look at the code and tell me whats going on wrong?
The Error I'm getting is : The Constructor Polygon does not exist. Thanks
Bhuvanesh
Answers
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
In Java, constructors don't have any returning datatype & are named exactly as its class' name. ~O)
Even
void
isn't allowed on them! [-XConsider going through the Objects Tutorial
and looking at some of the objects-based examples in the Examples Sketchbook.