Is there anyway to allow infinite parameters to be input into a method. For instance creating an arbitrary number of points based on x,y coordinates such as: object.addPoint(x1,y1,x2,y2,x3,y3........)???
Im trying to do a simple circle grid attractor point sketch and cant seem to find the error. I basically just want to create a grid of circles and have them scale according to their distance to the mouse cursor in real time. I keep getting the error message:
May 30 20:45:12 jon-blouts-macbook-pro.local java[1591] <Error>: CGContextGetCTM: invalid context 0x0
May 30 20:45:12 jon-blouts-macbook-pro.local java[1591] <Error>: CGContextSetBaseCTM: invalid context 0x0
May 30 20:45:12 jon-blouts-macbook-pro.local java[1591] <Error>: CGContextGetCTM: invalid context 0x0
May 30 20:45:12 jon-blouts-macbook-pro.local java[1591] <Error>: CGContextSetBaseCTM: invalid context 0x0
EXAMPLE
class Circle {
float dia, scale_dia, x, y, scalefactor;
//circle constructor with parameters
//(center x position, centery y position, scale factor for circles)
Circle(float _x, float _y, float _scalefactor){
x = _x;
y = _y;
scalefactor = _scalefactor;
}
//Display the circles according to the diameters found
//by the circles distance from the mouse cursor divided by
//a scalefactor.
void display(float _dia){
dia = _dia;
scale_dia = (dist(x, y, mouseX, mouseY)/scalefactor);
if (scale_dia < dia){
fill(200);
ellipse(x,y,scale_dia, scale_dia);
}
else {
fill(200);
ellipse (x,y, dia, dia);
}
}
}
float dia,scalefactor;
Circle[][] circle;
int countx;
int county;
void setup(){
size(600,600);
background (25);
smooth();
fill(200);
dia = 15;
scalefactor = 5;
county = 0;
countx = 0;
}
void draw(){
for (float i = dia/2; i < width; i = i + dia){
for(float j = dia/2; j < height; i = i + dia){
//Intialize the list for circles to be placed.
circle = new Circle[width/((int)dia)][height/((int)dia)];
//Create the circles.
//countx and county used to increment the list indices.
circle[countx][county] = new Circle(i,j,scalefactor);