A B
A B

Reputation: 21

Can scanline flood-fill optimization be extended to 3D?

I want to create a function that can quickly 'paint' a volume in a 3D binary array.

The first approach I tried was extending a standard flood-fill algorithm into 3D, which was easy to do but I was interested in making it faster. I read into how to optimize the flood-fill algorithm and found the 'scanline' flood-fill algorithm. Implementing this into 2D gave me great results. I wanted to extend this into 3D but it was not clear to me how to do this while maintaining the spirit of scanline by minimising the number of voxel checks.

I have searched for an existing implementation or explanation of scanline in 3D, but found nothing on it. I managed to extend the algorithm by essentially splitting the 3D grid into 2D planes and performing the scanline 2D function on each slice. This is an improvement but I feel like there's a better way.

Can scanline be extended into 3D, or is there a better approach entirely to all of this?

Upvotes: 2

Views: 975

Answers (0)

Related Questions