aboutsummaryrefslogtreecommitdiff
path: root/util/buildbot
diff options
context:
space:
mode:
authorLiet Kynes <sissi90@gmail.com>2021-07-06 08:26:02 +0000
committersfan5 <sfan5@live.de>2021-11-27 19:33:52 +0100
commit0ce549f49ec607cffc5fcc50063c7ddb36c897b1 (patch)
tree8fb6c1cb03e467c2e52b7aed7b9b491bb58b1eb3 /util/buildbot
parent7445a72f76f7f741af5362ce0b245d619c8d5733 (diff)
downloadminetest-0ce549f49ec607cffc5fcc50063c7ddb36c897b1.tar.gz
minetest-0ce549f49ec607cffc5fcc50063c7ddb36c897b1.tar.bz2
minetest-0ce549f49ec607cffc5fcc50063c7ddb36c897b1.zip
Translated using Weblate (Norwegian Bokmål)
Currently translated at 55.4% (774 of 1396 strings)
Diffstat (limited to 'util/buildbot')
0 files changed, 0 insertions, 0 deletions
d='n113' href='#n113'>113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
VoxelArea = {
	MinEdge = vector.new(1, 1, 1),
	MaxEdge = vector.new(0, 0, 0),
	ystride = 0,
	zstride = 0,
}

function VoxelArea:new(o)
	o = o or {}
	setmetatable(o, self)
	self.__index = self

	local e = o:getExtent()
	o.ystride = e.x
	o.zstride = e.x * e.y

	return o
end

function VoxelArea:getExtent()
	local MaxEdge, MinEdge = self.MaxEdge, self.MinEdge
	return vector.new(
		MaxEdge.x - MinEdge.x + 1,
		MaxEdge.y - MinEdge.y + 1,
		MaxEdge.z - MinEdge.z + 1
	)
end

function VoxelArea:getVolume()
	local e = self:getExtent()
	return e.x * e.y * e.z
end

function VoxelArea:index(x, y, z)
	local MinEdge = self.MinEdge
	local i = (z - MinEdge.z) * self.zstride +
			  (y - MinEdge.y) * self.ystride +
			  (x - MinEdge.x) + 1
	return math.floor(i)
end

function VoxelArea:indexp(p)
	local MinEdge = self.MinEdge
	local i = (p.z - MinEdge.z) * self.zstride +
			  (p.y - MinEdge.y) * self.ystride +
			  (p.x - MinEdge.x) + 1
	return math.floor(i)
end

function VoxelArea:position(i)
	local p = {}
	local MinEdge = self.MinEdge

	i = i - 1