cannot convert float to int error (newbie)
in
Programming Questions
•
1 year ago
Dear all,
I'm getting a "cannot convert float to int" on the
centroid[d][0] = a;
line of the following code. But I think I typed everything correctly:
public float a,b,c,d,e,f,g,h,i,j,k,l;
float[][] centroid = new float[100][3];
Thanks for your help!
John
---begin code---
import maxlink.*;
import codeanticode.syphon.*;
MaxLink link = new MaxLink(this,"touch_points");
public float a,b,c,d,e,f,g,h,i,j,k,l;
float[][] centroid = new float[100][3];
PGraphics canvas;
SyphonServer server;
void setup() {
size(400,400, P3D);
canvas = createGraphics(400, 400, P3D);
// Create syhpon server to send frames out.
server = new SyphonServer(this, "Processing Syphon");
link.declareInlet("a");
link.declareInlet("b");
link.declareInlet("c");
link.declareInlet("d");
link.declareInlet("e");
}
void draw() {
centroid[d][0] = a;
centroid[d][1] = b;
centroid[d][2] = c;
canvas.beginDraw();
canvas.background(0);
canvas.stroke(255);
canvas.lights();
canvas.noFill();
canvas.translate(width/2, height/2);
for(int i=0; i<e; i++){
canvas.bezier(0, 0, 0, 0, centroid[i][0]+centroid[i][1], centroid[i][0]+centroid[i][2], centroid[i][1], centroid[i][2]);
}
canvas.endDraw();
image(canvas, 0, 0);
server.sendImage(canvas);
}
1