summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-01 08:45:41 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-01 08:45:41 +0100
commit394bb0ee2bcd863aed75e1c6799c4c8138dbf269 (patch)
tree05e28b1b54da3ac7939fc3529191390a8f7e66a2 /core/math
parente101305950883661f9c47d8e6c552355f5e1fc2e (diff)
Fix various typos with codespell
Finally do the childs -> children rename too.
Diffstat (limited to 'core/math')
-rw-r--r--core/math/dynamic_bvh.cpp68
-rw-r--r--core/math/dynamic_bvh.h28
2 files changed, 48 insertions, 48 deletions
diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp
index 4452445241..e1315d1c64 100644
--- a/core/math/dynamic_bvh.cpp
+++ b/core/math/dynamic_bvh.cpp
@@ -36,8 +36,8 @@ void DynamicBVH::_delete_node(Node *p_node) {
void DynamicBVH::_recurse_delete_node(Node *p_node) {
if (!p_node->is_leaf()) {
- _recurse_delete_node(p_node->childs[0]);
- _recurse_delete_node(p_node->childs[1]);
+ _recurse_delete_node(p_node->children[0]);
+ _recurse_delete_node(p_node->children[1]);
}
if (p_node == bvh_root) {
bvh_root = nullptr;
@@ -65,31 +65,31 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) {
} else {
if (!p_root->is_leaf()) {
do {
- p_root = p_root->childs[p_leaf->volume.select_by_proximity(
- p_root->childs[0]->volume,
- p_root->childs[1]->volume)];
+ p_root = p_root->children[p_leaf->volume.select_by_proximity(
+ p_root->children[0]->volume,
+ p_root->children[1]->volume)];
} while (!p_root->is_leaf());
}
Node *prev = p_root->parent;
Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), nullptr);
if (prev) {
- prev->childs[p_root->get_index_in_parent()] = node;
- node->childs[0] = p_root;
+ prev->children[p_root->get_index_in_parent()] = node;
+ node->children[0] = p_root;
p_root->parent = node;
- node->childs[1] = p_leaf;
+ node->children[1] = p_leaf;
p_leaf->parent = node;
do {
if (!prev->volume.contains(node->volume)) {
- prev->volume = prev->childs[0]->volume.merge(prev->childs[1]->volume);
+ prev->volume = prev->children[0]->volume.merge(prev->children[1]->volume);
} else {
break;
}
node = prev;
} while (nullptr != (prev = node->parent));
} else {
- node->childs[0] = p_root;
+ node->children[0] = p_root;
p_root->parent = node;
- node->childs[1] = p_leaf;
+ node->children[1] = p_leaf;
p_leaf->parent = node;
bvh_root = node;
}
@@ -103,14 +103,14 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
} else {
Node *parent = leaf->parent;
Node *prev = parent->parent;
- Node *sibling = parent->childs[1 - leaf->get_index_in_parent()];
+ Node *sibling = parent->children[1 - leaf->get_index_in_parent()];
if (prev) {
- prev->childs[parent->get_index_in_parent()] = sibling;
+ prev->children[parent->get_index_in_parent()] = sibling;
sibling->parent = prev;
_delete_node(parent);
while (prev) {
const Volume pb = prev->volume;
- prev->volume = prev->childs[0]->volume.merge(prev->childs[1]->volume);
+ prev->volume = prev->children[0]->volume.merge(prev->children[1]->volume);
if (pb.is_not_equal_to(prev->volume)) {
prev = prev->parent;
} else {
@@ -129,8 +129,8 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) {
void DynamicBVH::_fetch_leaves(Node *p_root, LocalVector<Node *> &r_leaves, int p_depth) {
if (p_root->is_internal() && p_depth) {
- _fetch_leaves(p_root->childs[0], r_leaves, p_depth - 1);
- _fetch_leaves(p_root->childs[1], r_leaves, p_depth - 1);
+ _fetch_leaves(p_root->children[0], r_leaves, p_depth - 1);
+ _fetch_leaves(p_root->children[1], r_leaves, p_depth - 1);
_delete_node(p_root);
} else {
r_leaves.push_back(p_root);
@@ -195,8 +195,8 @@ void DynamicBVH::_bottom_up(Node **leaves, int p_count) {
}
Node *n[] = { leaves[minidx[0]], leaves[minidx[1]] };
Node *p = _create_node_with_volume(nullptr, n[0]->volume.merge(n[1]->volume), nullptr);
- p->childs[0] = n[0];
- p->childs[1] = n[1];
+ p->children[0] = n[0];
+ p->children[1] = n[1];
n[0]->parent = p;
n[1]->parent = p;
leaves[minidx[0]] = p;
@@ -241,10 +241,10 @@ DynamicBVH::Node *DynamicBVH::_top_down(Node **leaves, int p_count, int p_bu_thr
}
Node *node = _create_node_with_volume(nullptr, vol, nullptr);
- node->childs[0] = _top_down(&leaves[0], partition, p_bu_threshold);
- node->childs[1] = _top_down(&leaves[partition], p_count - partition, p_bu_threshold);
- node->childs[0]->parent = node;
- node->childs[1]->parent = node;
+ node->children[0] = _top_down(&leaves[0], partition, p_bu_threshold);
+ node->children[1] = _top_down(&leaves[partition], p_count - partition, p_bu_threshold);
+ node->children[0]->parent = node;
+ node->children[1]->parent = node;
return (node);
} else {
_bottom_up(leaves, p_count);
@@ -260,23 +260,23 @@ DynamicBVH::Node *DynamicBVH::_node_sort(Node *n, Node *&r) {
if (p > n) {
const int i = n->get_index_in_parent();
const int j = 1 - i;
- Node *s = p->childs[j];
+ Node *s = p->children[j];
Node *q = p->parent;
- ERR_FAIL_COND_V(n != p->childs[i], nullptr);
+ ERR_FAIL_COND_V(n != p->children[i], nullptr);
if (q) {
- q->childs[p->get_index_in_parent()] = n;
+ q->children[p->get_index_in_parent()] = n;
} else {
r = n;
}
s->parent = n;
p->parent = n;
n->parent = q;
- p->childs[0] = n->childs[0];
- p->childs[1] = n->childs[1];
- n->childs[0]->parent = p;
- n->childs[1]->parent = p;
- n->childs[i] = p;
- n->childs[j] = s;
+ p->children[0] = n->children[0];
+ p->children[1] = n->children[1];
+ n->children[0]->parent = p;
+ n->children[1]->parent = p;
+ n->children[i] = p;
+ n->children[j] = s;
SWAP(p->volume, n->volume);
return (p);
}
@@ -320,7 +320,7 @@ void DynamicBVH::optimize_incremental(int passes) {
Node *node = bvh_root;
unsigned bit = 0;
while (node->is_internal()) {
- node = _node_sort(node, bvh_root)->childs[(opath >> bit) & 1];
+ node = _node_sort(node, bvh_root)->children[(opath >> bit) & 1];
bit = (bit + 1) & (sizeof(unsigned) * 8 - 1);
}
_update(node);
@@ -396,8 +396,8 @@ void DynamicBVH::remove(const ID &p_id) {
void DynamicBVH::_extract_leaves(Node *p_node, List<ID> *r_elements) {
if (p_node->is_internal()) {
- _extract_leaves(p_node->childs[0], r_elements);
- _extract_leaves(p_node->childs[1], r_elements);
+ _extract_leaves(p_node->children[0], r_elements);
+ _extract_leaves(p_node->children[1], r_elements);
} else {
ID id;
id.node = p_node;
diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h
index 46bf56ae58..21b5340aaa 100644
--- a/core/math/dynamic_bvh.h
+++ b/core/math/dynamic_bvh.h
@@ -182,21 +182,21 @@ private:
Volume volume;
Node *parent = nullptr;
union {
- Node *childs[2];
+ Node *children[2];
void *data;
};
- _FORCE_INLINE_ bool is_leaf() const { return childs[1] == nullptr; }
+ _FORCE_INLINE_ bool is_leaf() const { return children[1] == nullptr; }
_FORCE_INLINE_ bool is_internal() const { return (!is_leaf()); }
_FORCE_INLINE_ int get_index_in_parent() const {
ERR_FAIL_COND_V(!parent, 0);
- return (parent->childs[1] == this) ? 1 : 0;
+ return (parent->children[1] == this) ? 1 : 0;
}
void get_max_depth(int depth, int &maxdepth) {
if (is_internal()) {
- childs[0]->get_max_depth(depth + 1, maxdepth);
- childs[1]->get_max_depth(depth + 1, maxdepth);
+ children[0]->get_max_depth(depth + 1, maxdepth);
+ children[1]->get_max_depth(depth + 1, maxdepth);
} else {
maxdepth = MAX(maxdepth, depth);
}
@@ -205,7 +205,7 @@ private:
//
int count_leaves() const {
if (is_internal()) {
- return childs[0]->count_leaves() + childs[1]->count_leaves();
+ return children[0]->count_leaves() + children[1]->count_leaves();
} else {
return (1);
}
@@ -216,8 +216,8 @@ private:
}
Node() {
- childs[0] = nullptr;
- childs[1] = nullptr;
+ children[0] = nullptr;
+ children[1] = nullptr;
}
};
@@ -350,8 +350,8 @@ void DynamicBVH::aabb_query(const AABB &p_box, QueryResult &r_result) {
stack = aux_stack.ptr();
threshold = aux_stack.size() - 2;
}
- stack[depth++] = n->childs[0];
- stack[depth++] = n->childs[1];
+ stack[depth++] = n->children[0];
+ stack[depth++] = n->children[1];
} else {
if (r_result(n->data)) {
return;
@@ -406,8 +406,8 @@ void DynamicBVH::convex_query(const Plane *p_planes, int p_plane_count, const Ve
stack = aux_stack.ptr();
threshold = aux_stack.size() - 2;
}
- stack[depth++] = n->childs[0];
- stack[depth++] = n->childs[1];
+ stack[depth++] = n->children[0];
+ stack[depth++] = n->children[1];
} else {
if (r_result(n->data)) {
return;
@@ -463,8 +463,8 @@ void DynamicBVH::ray_query(const Vector3 &p_from, const Vector3 &p_to, QueryResu
stack = aux_stack.ptr();
threshold = aux_stack.size() - 2;
}
- stack[depth++] = node->childs[0];
- stack[depth++] = node->childs[1];
+ stack[depth++] = node->children[0];
+ stack[depth++] = node->children[1];
} else {
if (r_result(node->data)) {
return;