summaryrefslogtreecommitdiff
path: root/core/math/vector3i.cpp
blob: d5e05c1398afc6d08895f503371b075f1c6f513b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "vector3i.h"

void Vector3i::set_axis(int p_axis, int32_t p_value) {
	ERR_FAIL_INDEX(p_axis, 3);
	coord[p_axis] = p_value;
}
int32_t Vector3i::get_axis(int p_axis) const {

	ERR_FAIL_INDEX_V(p_axis, 3, 0);
	return operator[](p_axis);
}

int Vector3i::min_axis() const {

	return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
}
int Vector3i::max_axis() const {

	return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0);
}

Vector3i::operator String() const {

	return (itos(x) + ", " + itos(y) + ", " + itos(z));
}