Thought I'd post this here as well as the newsgroup to increase my
chances! :)
Hi,
Yet to find a nice way to do this maths and now that I'm programming it
into
a Java3D program I was wondering if there was a simple & fast method to
do
it?
Basic problem is this;
There is a cube with 100*100*100 points in it.
There is a sphere with a radius of 15 points.
There is a list of x y z coord where the sphere has been.
I want the volume of the sphere to have covered every point in the
cube.
Is there a better way to calculate every point in the cube covered by
the
sphere so far and hence work out which points haven't been covered and
therefore where the sphere needs to go to complete it's task?
So far I've done something like this... (ie Brute force :)
int Sphere[S]{sx,sy,sz}
int Cube[100][100][100]
for x = 1 to 100
for y = 1 to 100
for z = 1 to 100
for s = 1 to Sphere.length
if (dist(x,y,z,sx,sy,sz)<=15) Cube[x][y][z]++
I then divide the cube into 7*7*7 blocks and work out how many points
in
each of those blocks have not been touched in order to work out the
most
efficient coord to move the sphere to complete it's task.
The sphere can only move 12 points at a time but there can be more then
one
sphere at a time.
This takes about 30-45 mins to run on a P3-600 under jre1.1.8, I'm
moving it
to my jdk1.3.1 program so it should be a little faster but I'd like to
find
another way to do it.
My math skills are very limited and I've not found anyone who could
work out
a better way in Java to do this.
Actually just thought I should turn the Cube int array into boolean and
the
sphere if to a while loop as I no longer look at how inefficent it's
been. :)
Cheers,
Jase.
===========================================================================
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".