aboutsummaryrefslogtreecommitdiff
path: root/data/cooked_rat.png
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-08-13 17:41:18 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-08-22 13:02:08 +0200
commit0488bf54d3f0b767eb53a026b4b52de86cfbd4ab (patch)
treeb19169b991a8a97bd80572827205976cfe4de1db /data/cooked_rat.png
parentda19aee307221dd2e6bdd00393124587654d0206 (diff)
downloadminetest-0488bf54d3f0b767eb53a026b4b52de86cfbd4ab.tar.gz
minetest-0488bf54d3f0b767eb53a026b4b52de86cfbd4ab.tar.bz2
minetest-0488bf54d3f0b767eb53a026b4b52de86cfbd4ab.zip
/me command
Diffstat (limited to 'data/cooked_rat.png')
0 files changed, 0 insertions, 0 deletions
/a> 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236

vector = {}

function vector.new(a, b, c)
	if type(a) == "table" then
		assert(a.x and a.y and a.z, "Invalid vector passed to vector.new()")
		return {x=a.x, y=a.y, z=a.z}
	elseif a then
		assert(b and c, "Invalid arguments for vector.new()")
		return {x=a, y=b, z=c}
	end
	return {x=0, y=0, z=0}
end

function vector.equals(a, b)
	return a.x == b.x and
	       a.y == b.y and
	       a.z == b.z
end

function vector.length(v)
	return math.hypot(v.x, math.hypot(v.y, v.z))
end

function vector.normalize(v)
	local len = vector.length(v)
	if len == 0 then
		return {x=0, y=0, z=0}
	else
		return vector.divide(v, len)
	end
end

function vector.floor(v)
	return {
		x = math.floor(v.x),
		y = math.floor(v.y),
		z = math.floor(v.z)
	}
end

function vector.round(v)
	return {
		x = math.floor(v.x + 0.5),
		y = math.floor(v.y + 0.5),
		z = math.floor(v.z + 0.5)
	}
end