Subversion Repositories gelsvn

Rev

Rev 89 | Rev 443 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89 Rev 125
Line 59... Line 59...
59
		{}	
59
		{}	
60
 
60
 
61
		/** Store a voxel in a regular grid. */
61
		/** Store a voxel in a regular grid. */
62
		void store(const CGLA::Vec3i& p, const T& t) 
62
		void store(const CGLA::Vec3i& p, const T& t) 
63
		{
63
		{
64
			assert(in_domain(p));
64
			assert(this->in_domain(p));
65
			data[grid_idx(p)] = t;
65
			data[grid_idx(p)] = t;
66
		}
66
		}
67
 
67
 
68
		/** Read/write access to voxel grid. This is 
68
		/** Read/write access to voxel grid. This is 
69
				a non-const overloaded operator[]. In a regular 
69
				a non-const overloaded operator[]. In a regular 
70
				grid, we have reserved room for all voxels in 
70
				grid, we have reserved room for all voxels in 
71
				advance. Hence, it is possible to create a non-const
71
				advance. Hence, it is possible to create a non-const
72
				operator[]. See AncestorGrid::operator[]. */
72
				operator[]. See AncestorGrid::operator[]. */
73
		T& operator[](const CGLA::Vec3i& p) 
73
		T& operator[](const CGLA::Vec3i& p) 
74
		{
74
		{
75
			assert(in_domain(p));
75
			assert(this->in_domain(p));
76
			return data[grid_idx(p)];
76
			return data[grid_idx(p)];
77
		}
77
		}
78
 
78
 
79
		/// Read only access to voxel grid through const operator[]
79
		/// Read only access to voxel grid through const operator[]
80
		const T& operator[](const CGLA::Vec3i& p) const 
80
		const T& operator[](const CGLA::Vec3i& p) const 
81
		{
81
		{
82
			assert(in_domain(p));
82
			assert(this->in_domain(p));
83
			return data[grid_idx(p)];
83
			return data[grid_idx(p)];
84
		}
84
		}
85
 
85
 
86
		/// Const function to get a pointer to the first voxel in grid.
86
		/// Const function to get a pointer to the first voxel in grid.
87
		const T* get() const {return &data[0];}
87
		const T* get() const {return &data[0];}