Skip to content

Commit fe9422a

Browse files
chriswmackeyChris Mackey
authored andcommitted
fix(colorobj): Slightly improve text labeling of faces
1 parent d1f937e commit fe9422a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

honeybee_display/colorobj.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ def color_face_to_vis_set(
163163
# loop through the faces and create the text labels
164164
for face_prop, f_geo in zip(color_face.attributes, color_face.flat_geometry):
165165
if face_prop != 'N/A':
166-
cent_pt = f_geo.center # base point for the text
166+
cent_pt = f_geo.center if f_geo.is_convex else \
167+
f_geo.pole_of_inaccessibility(tolerance)
167168
base_plane = Plane(f_geo.normal, cent_pt)
168169
if base_plane.y.z < 0: # base plane pointing downwards; rotate it
169170
base_plane = base_plane.rotate(base_plane.n, math.pi, base_plane.o)
@@ -174,7 +175,7 @@ def color_face_to_vis_set(
174175
(f_geo.max.y - f_geo.min.y),
175176
(f_geo.max.z - f_geo.min.z)]
176177
dims.sort()
177-
txt_h = dims[1] / (txt_len * 1.5)
178+
txt_h = dims[1] / txt_len
178179
else:
179180
txt_h = txt_height
180181
if txt_h < tolerance:

honeybee_display/energy/colorobj.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def color_face_to_vis_set(
150150
label_text = []
151151
face_zip_obj = zip(color_face.matched_values, color_face.matched_flat_geometry)
152152
for face_val, f_geo in face_zip_obj:
153-
cent_pt = f_geo.center # base point for the text
153+
cent_pt = f_geo.center if f_geo.is_convex else \
154+
f_geo.pole_of_inaccessibility(tolerance)
154155
base_plane = Plane(f_geo.normal, cent_pt)
155156
face_prop = f_str % face_val
156157
if base_plane.y.z < 0: # base plane pointing downwards; rotate it
@@ -162,7 +163,7 @@ def color_face_to_vis_set(
162163
(f_geo.max.y - f_geo.min.y),
163164
(f_geo.max.z - f_geo.min.z)]
164165
dims.sort()
165-
txt_h = dims[1] / (txt_len * 1.5)
166+
txt_h = dims[1] / txt_len
166167
else:
167168
txt_h = txt_height
168169
if txt_h < tolerance:

0 commit comments

Comments
 (0)