i'm trying to apply voronoi tessellation on android, but the performance is too slow. it takes about 4 seconds to generate it and after some points it takes even more.
i wonder if the problem is the device or the algorithm is too long ..... or both?!
the device is HTC desireHD (cpu
1 GHz)
i tried to simplify the code as possible as i could
float[] px = new float[0];
float[] py = new float[0];
float[] distance = new float[0];
void setup()
{
size(800,480);
orientation(LANDSCAPE);
rectMode(CENTER);
}
void draw()
{
//rendering points as rectangles
for(int i=0;i<px.length;i++)
rect(px[i],py[i],10,10);
}
void mousePressed()
{
//add new point
px = append(px,mouseX);
py = append(py,mouseY);
distance = append(distance,0);
if(distance.length<2) return;
for(int y=0;y<height;y++)
for(int x=0;x<width;x++){
//calculate the distance between the pixel and each point