Hi Andy,
If all you want to do is make r, xc, yc, and zc into floats, but keep v as an int
(which you need to do for your array declaration), just cast the calculation of v to
an int:
float r, xc, yc, zc, bvol;
int v;
bvol = ((xc+r)-(xc-r))*((yc+r)-(yc-r))*((zc+r)-(zc-r));
v = (int) (bvol*200);
Point3f[] coordinates;
coordinates = new Point3f[v];
josh
>>> [EMAIL PROTECTED] 01/17/01 03:53PM >>>
Does anyone knows how to set all my int values to float.. Cos i try to change my int
v; to float but they show me an error that say
Incompatible type for new. Explicit cast needed to convert float to int.
coordinates = new Point3f[v];
Andy
private Geometry sphereGeometry() {
int r = 1;
int xc = 0;
int yc = 0;
int zc = 0;
int v;
int bvol;
float rx, ry, rz, spanx, spany, spanz, randx, randy, randz;
bvol = ((xc+r)-(xc-r))*((yc+r)-(yc-r))*((zc+r)-(zc-r));
v = (bvol*200);
Point3f[] coordinates;
coordinates = new Point3f[v];
spanx = (xc+r)-(xc-r);
spany = (yc+r)-(yc-r);
spanz = (zc+r)-(zc-r);
for (int i=0; i<v; i++)
{
coordinates[i] = new Point3f ();
//}
//for(int f=0; f<v; f++){
randx = (xc-r) + (float) (Math.random() * spanx);
randy = (yc-r) + (float) (Math.random() * spany);
randz = (zc-r) + (float) (Math.random() * spanz);
rx = (randx*spanx)+(xc-r);
ry = (randy*spany)+(yc-r);
rz = (randz*spanz)+(zc-r);
if (((rx-xc)*(rx-xc))+((ry-yc)*(ry-yc))+((rz-zc)*(rz-zc)) <= ((r)*(r)))
{
coordinates[i].x = rx;
coordinates[i].y = ry;
coordinates[i].z = rz;
}
}
PointArray point = new PointArray(v, PointArray.COORDINATES);
point.setCoordinates(0, coordinates);
return point;
} // end of method SphereGeometry in class Bone
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".