Skip to content
Snippets Groups Projects

Update bht_algorithm_3D.py

Merged nicoa96 requested to merge nicoa96-main-patch-47348 into main
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
@@ -22,7 +22,7 @@ class MainApp:
self.rootNode.insert(particle)
def ResetTree(self, particles):
"""Reset the Quadtree by reinitializing the root node."""
"""Reset the Octree by reinitializing the root node."""
# Define the size of the rootNode based on the positions of the particles
#min_x = min([particle.x for particle in particles])
#min_y = min([particle.y for particle in particles])
@@ -161,8 +161,8 @@ class TreeNode:
mid_x = self.x + self.width / 2
mid_y = self.y + self.height / 2
mid_z = self.z + self.depth / 2
quad_index = (particle.x >= mid_x) + 2 * (particle.y >= mid_y) + 4 * (particle.z >= mid_z)
return quad_index
oct_index = (particle.x >= mid_x) + 2 * (particle.y >= mid_y) + 4 * (particle.z >= mid_z)
return oct_index
def print_tree(self, depth_=0):
"""Print the structure of the Octree.
@@ -363,4 +363,4 @@ class TreeNode:
self.mass = total_mass
else:
self.center_of_mass = np.array([0.0, 0.0, 0.0])
self.mass = 0
\ No newline at end of file
self.mass = 0
Loading