Re: ideas for algorithm wanted - XCC ForumRegister | Login | Search
History | Home | Messages

bugfix : new index listflyby05:51 06-12-2001
Re: bugfix : new index listWill18:34 06-12-2001
Re: bugfix : new index listflyby19:32 06-12-2001
Re: bugfix : new index listWill19:53 06-12-2001
Re: ideas for algorithm wantedWill19:57 06-12-2001
Re: ideas for algorithm wantedflyby20:21 06-12-2001

> what is the algorithm for deciding the facing of a voxel under a slope?

> the things we know are:

> 1) the facing of voxels that are on the outside.

> 2) the diagonals that the 'outside' is accessible on.

> This is going to be a complicated switch statement, I can feel it.


I wonder if you couldn't take a different approach :

If you take a voxel and surround it with neighbouring voxels, you get a 3x3x3 grid, with the targeted voxel being in the middle.

Assuming you give that voxel a temporary coordinate system,
you can that look up if there is a voxel above, at 45° or next to it.
when in the Y plane it'd look like this :
[-1,0,1] [0,0,1] [1,0,1]
[-1,0,0] [0,0,0] [1,0,0]
[-1,0,-1] [0,0,-1] [1,0,-1]

if you store every voxel in an array, it would be fairly easy for a gifted programmer like you, to look up if there exist a voxel above/next/under/etc of this voxel.
In un-optimized form, this would mean you'll have to perform 26 checks per normal identification.

A 45° slope could be identified by looking for a voxel that has either [nx-1,ny,nz-1] or [nx+1,ny,nz+1.
Having a [nx,ny,nz-1] voxel below it would be an absolute requirement to identify this voxel as part of a 45° angled upwards slope.

pffff.. so far for a non-technical topic.. :)



Re: ideas for algorithm wantedKoen van de Sande05:37 07-12-20017
    Re: ideas for algorithm wantedflyby06:20 07-12-2001
        Re: ideas for algorithm wantedwill18:07 07-12-2001
            Re: ideas for algorithm wantedflyby19:43 08-12-2001
                Re: ideas for algorithm wantedwill20:22 08-12-2001
        Re: ideas for algorithm wantedKoen van de Sande03:20 08-12-2001
            Re: ideas for algorithm wantedflyby04:07 08-12-2001


Home | Post | Users | Messages