This is a part of my source code for my project... It is
giving me alot of problem and i still couldn't figure how to correct it.. Can
any one help me.. It is quite urgent cause my deadline is coming
soon...
private Geometry sphereGeometry() {
int f;
int r = 50;
int xc = 100; int yc = 100; int zc = 100; 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*(60/100);
Point3f[] coordinates;
coordinates = new
Point3f[bvol];
for(f = 0; f < v;
f++){
randx = 0.0f + (float) (Math.random() * 1.0f); randy = 0.0f + (float) (Math.random() * 1.0f); randz = 0.0f + (float) (Math.random() * 1.0f); spanx =
(xc+r)-(xc-r);
spany = (yc+r)-(yc-r); spanz = (zc+r)-(zc-r); 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)
{
coordinates[f].x = rx; coordinates[f].y = ry; coordinates[f].z = rz; } } PointArray point = new
PointArray(bvol, PointArray.COORDINATES);
point.setCoordinates(0, coordinates);
return point;
} // end of method SphereGeometry in class
Bone
When i compile, it doesn't show any problem but when i run, i
show me this errors.... I really hope that anyone out that can help me with this
problem thanks....
java.lang.NullPointerException
at javax.media.j3d.GeometryArrayRetained.setCoordinates<CompiledCode> at javax.media.j3d.GeometryArray.setCoordinates<GeometryArray.java:333> at FinalProject$Bone.sphereGeometry<Compiled Code> at FinalProject$Bone.<init><FinalProject.java:27> at FinalProject.createSceneGraph<FinalProject.java:114> at FinalProject.<init><FinalProject.java:142> at java.lang.Class.newInstance0<Native Method> at java.lang.Class.newInstance<Class.java:239> at sun.applet.AppletPanel.createApplet<AppletPanel.java:532> at sun.applet.AppletPanel.runLoader<AppletPanel.java:468> at sun.applet.AppletPanel.run<Compiled Code> at java.lang.Thread.run<Thread.java:479> Andy
|
- Re: [JAVA3D] J. Lee Dixon
- [JAVA3D] Chris Gates
- Re: [JAVA3D] Dipl. Ing. Paul Szawlowski
- Re: [JAVA3D] Chris Gates
- Re: [JAVA3D] Dummy question Adriano Cavalcanti
- Re: [JAVA3D] Dummy question Mark Ferneau
- [JAVA3D] K.R.Karthikeyan
- [JAVA3D] Aubri & James Sandlin
- Re: [JAVA3D] Rory Douglas
- [JAVA3D] Roman Guskov
- Re: [JAVA3D] Andy Tay
- Re: [JAVA3D] Sameer Pokarna
- Re: [JAVA3D] Adriano Cavalcanti Silva
- Re: [JAVA3D] Extracting float from Flo... Damir Arh
- Re: [JAVA3D] Float to float. Cromwell Enage
- [JAVA3D] Just some introduction... Karsten Fries
- Re: [JAVA3D] John Wright
- Re: [JAVA3D] John D
- Re: [JAVA3D] Andy Tay
- Re: [JAVA3D] Eric
- Re: [JAVA3D] John D