If I understand, you need to use r = 0.3f instead. No
offense, but most of your problems have nothing to do
with Java3D and are out of context here, don't you
have any school friends that can help you with these
java syntax problems.
--- Andy Tay <[EMAIL PROTECTED]> wrote:
> Hi Josh,
>
> Thanks for your help but.. i would like to put 0.3
> into r and when i run it,
> it shows me that r must be a double and not a float.
> When i change the
> float r to double r. The rest of my program shows
> me alot of errors with
> the double r. Are there any way that i can set my r
> to read a decimal value
> without affecting the rest of the program.
>
> Thanks
>
> Andy
> ----- Original Message -----
> From: Josh Richmond <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, January 17, 2001 9:19 PM
> Subject: Re: [JAVA3D] Andy's int to float problem
>
>
> > 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".
>
>
===========================================================================
> 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".
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
===========================================================================
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".