Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Accessing a volume's voxels
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=14&t=270
Page 1 of 1

Author:  Gnurfos [ Mon Sep 26, 2011 5:58 am ]
Post subject:  Accessing a volume's voxels

Hi,

I'm not a fan of dumb optimization (I guess no one is, named like that), so this is more a question than a suggestion:

Wouldn't it save a significant quantity of copies to have in SimpleVolume a method to access a given voxel by non-const reference ?

Cheers.

Author:  David Williams [ Mon Sep 26, 2011 5:51 pm ]
Post subject:  Re: Accessing a volume's voxels

This would work in the case of the SimpleVolume and the RawVolume because the data is all fixed in memory. But I think it is more complex in the case of the LargeVolume because the data you have obtained a reference to could later become invalidated by compression, paging, etc.

We could add the methods to just the SimpleVolume and RawVolume but on the other hand it's nice when the Volumes are interchangable. It also might make it hard if we did decide that the data needs to move around for some reason. Not that we have any plans for that, but this is the advantage of encapsulation.

I do see your point though... if we want to e.g. double a voxel's value then currently you have to retrieve it, double it, and then set the new value. It would be nice to do it in-place.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/