Skip to content

Commit

Permalink
grid creation method change
Browse files Browse the repository at this point in the history
  • Loading branch information
PARKCHEOLHEE-lab committed Mar 26, 2023
1 parent 3509f50 commit 45b406c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
Binary file modified utils/kmeans/k_rooms_cluster.gh
Binary file not shown.
45 changes: 16 additions & 29 deletions utils/kmeans/kroomsclusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def get_predicted_rooms(self):
self._gen_boundaries()
self._gen_estimated_grid_size()
self._gen_grid()
# self._gen_predicted_rooms()
self._gen_predicted_rooms()
# self._gen_network()
# self._gen_connected_rooms_to_corridor()

return
return [room.room for room in self.rooms]

def _is_disjoint_floor_and_core(self):
is_disjoint = (
Expand Down Expand Up @@ -147,6 +147,10 @@ def _gen_grid(self):
/ 2
)

base_rectangle.Translate(
self.get_normalized_vector(x_vector) * -self.grid_size / 2
)

if ri == 0:
copied_hall.Translate(
(
Expand Down Expand Up @@ -226,36 +230,21 @@ def _gen_grid(self):
rg.AreaMassProperties.Compute(g).Centroid for g in self.grid
]

self.remained_boundaries = []
def _gen_predicted_rooms(self):
self.points = self.grid_centroids
self.k = self.boundaries[0].k

_, indices = self.predict(get_indices=True)

# for boundary in self.boundaries:
# remained_boundary = rg.Curve.CreateBooleanDifference(
# boundary.boundary, self.grid
# )

self.rooms = []
for each_indices in indices:
cells = []
for index in each_indices:
cells.append(self.grid[index])

# self.remained_boundaries.extend(remained_boundary)
self.rooms.append(Room(cells))

# for remained in remained_boundary:
# print(remained)
#
# self.remained_boundaries = copied_hall

# def _gen_predicted_rooms(self):
# self.points = self.grid_centroids
# self.k = self.boundaries[0].k
#
# _, indices = self.predict(get_indices=True)
#
# self.rooms = []
# for each_indices in indices:
# cells = []
# for index in each_indices:
# cells.append(self.grid[index])
#
# self.rooms.append(Room(cells))
#
# def _gen_network(self):
# self.network = []
# self.network_length = []
Expand Down Expand Up @@ -376,5 +365,3 @@ def _gen_grid(self):

krooms = krsc.get_predicted_rooms()
grid = krsc.grid
d = krsc.base_rectangles
e = krsc.remained_boundaries

0 comments on commit 45b406c

Please sign in to comment.