I've a sketch that throw me a "cannot convert float to int" exception, but it seems illogic to me.
Here is the code :
class Points {
float x, y, z;
char axis;
public Points(String[] pieces) {
// x = float(pieces[1].substring(1));
// y = float(pieces[2].substring(1));
// z = float(pieces[3].substring(1));
for (int x=1;x<=pieces.length-1;x++) {
axis = pieces[x].charAt(0);
switch(axis) {
case 'X' : x = float(pieces[x].substring(1)); break;
case 'Y' : y = float(pieces[x].substring(1)); break;
case 'Z' : z = float(pieces[x].substring(1)); break;
// case 'X' : println("X ---> " + pieces[x].substring(1)); break;
// case 'Y' : println("Y ---> " + pieces[x].substring(1)); break;
// case 'Z' : println("Z ---> " + pieces[x].substring(1)); break;
default: break;
}
}
}
}
Error happens at line 12.
Every commented line does not throw any exception and work as excpected (thats why it seems illogic to me)
If I delete all the loop folks and keep only the 6th, 7th and 8th lines, all works fine even if they are somewhat similar
Processing seems to see x, y and z as integer when I am in the for statement, even if they are declared as float.