[Fix] Fix split point in BSP
This commit is contained in:
parent
47cb202181
commit
df033d257c
1 changed files with 2 additions and 2 deletions
|
@ -45,7 +45,7 @@ class Leaf:
|
||||||
return False
|
return False
|
||||||
split_point = random.randint(MIN_LEAF_SIZE, self.width - MIN_LEAF_SIZE)
|
split_point = random.randint(MIN_LEAF_SIZE, self.width - MIN_LEAF_SIZE)
|
||||||
self.left_leaf = Leaf(self.x, self.y, split_point, self.height, self.id+1)
|
self.left_leaf = Leaf(self.x, self.y, split_point, self.height, self.id+1)
|
||||||
self.right_leaf = Leaf(self.x + split_point-1, self.y, self.width - split_point+1, self.height, self.id+2)
|
self.right_leaf = Leaf(self.x + split_point, self.y, self.width - split_point, self.height, self.id+2)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# y
|
# y
|
||||||
|
@ -53,7 +53,7 @@ class Leaf:
|
||||||
return False
|
return False
|
||||||
split_point = random.randint(MIN_LEAF_SIZE, self.height - MIN_LEAF_SIZE)
|
split_point = random.randint(MIN_LEAF_SIZE, self.height - MIN_LEAF_SIZE)
|
||||||
self.left_leaf = Leaf(self.x, self.y, self.width, split_point, self.id+1)
|
self.left_leaf = Leaf(self.x, self.y, self.width, split_point, self.id+1)
|
||||||
self.right_leaf = Leaf(self.x, self.y + split_point-1, self.width, self.height - split_point+1, self.id+2)
|
self.right_leaf = Leaf(self.x, self.y + split_point, self.width, self.height - split_point, self.id+2)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue