Skip to content

Commit

Permalink
fix(room): Ensure that space_polygon_geometry is transformed with parent
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jul 8, 2024
1 parent 7cea5b0 commit f4ccc5c
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions honeybee_doe2/properties/room.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# coding=utf-8
"""Room DOE-2 Properties."""
import math

from ladybug_geometry.geometry3d import Face3D
from honeybee.typing import float_in_range, float_positive
from honeybee.altnumber import autocalculate
Expand Down Expand Up @@ -143,6 +145,63 @@ def space_polygon_geometry(self, value):
self._floor_geometry = value.flip()
self._space_polygon_geometry = value

def move(self, moving_vec):
"""Move this object along a vector.
Args:
moving_vec: A ladybug_geometry Vector3D with the direction and distance
to move the object.
"""
if self.space_polygon_geometry is not None:
self._space_polygon_geometry = self.space_polygon_geometry.move(moving_vec)

def rotate(self, angle, axis, origin):
"""Rotate this object by a certain angle around an axis and origin.
Args:
angle: An angle for rotation in degrees.
axis: Rotation axis as a Vector3D.
origin: A ladybug_geometry Point3D for the origin around which the
object will be rotated.
"""
if self.space_polygon_geometry is not None:
self._space_polygon_geometry = \
self.space_polygon_geometry.rotate(math.radians(angle), axis, origin)

def rotate_xy(self, angle, origin):
"""Rotate this object counterclockwise in the world XY plane by a certain angle.
Args:
angle: An angle in degrees.
origin: A ladybug_geometry Point3D for the origin around which the
object will be rotated.
"""
if self.space_polygon_geometry is not None:
self._space_polygon_geometry = \
self.space_polygon_geometry.rotate_xy(math.radians(angle), origin)

def reflect(self, plane):
"""Reflect this object across a plane.
Args:
plane: A ladybug_geometry Plane across which the object will
be reflected.
"""
if self.space_polygon_geometry is not None:
self._space_polygon_geometry = self.space_polygon_geometry.reflect(plane)

def scale(self, factor, origin=None):
"""Scale this object by a factor from an origin point.
Args:
factor: A number representing how much the object should be scaled.
origin: A ladybug_geometry Point3D representing the origin from which
to scale. If None, it will be scaled from the World origin (0, 0, 0).
"""
if self.space_polygon_geometry is not None:
self._space_polygon_geometry = \
self.space_polygon_geometry.scale(factor, origin)

@classmethod
def from_dict(cls, data, host):
"""Create RoomDoe2Properties from a dictionary.
Expand Down

0 comments on commit f4ccc5c

Please sign in to comment.