Skip to content

Commit

Permalink
more resets
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed May 21, 2024
1 parent 1d7873a commit be9643a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/compas/geometry/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def compute_obb(self):
"""
raise NotImplementedError

@reset_computed
def transform(self, transformation):
"""Transform the geometry.
Expand Down Expand Up @@ -122,6 +123,7 @@ def transformed(self, transformation): # type: (...) -> G
geometry.transform(transformation)
return geometry # type: ignore

@reset_computed
def scale(self, x, y=None, z=None):
"""Scale the geometry.
Expand Down Expand Up @@ -195,6 +197,7 @@ def scaled(self, x, y=None, z=None): # type: (...) -> G

return self.transformed(Scale.from_factors([x, y, z]))

@reset_computed
def translate(self, vector):
"""Translate the geometry.
Expand Down Expand Up @@ -244,6 +247,7 @@ def translated(self, vector): # type: (...) -> G

return self.transformed(Translation.from_vector(vector))

@reset_computed
def rotate(self, angle, axis=None, point=None):
"""Rotate the geometry.
Expand Down
1 change: 1 addition & 0 deletions src/compas/geometry/shapes/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ def to_brep(self):
# Transformations
# ==========================================================================

@reset_computed
def scale(self, factor):
"""Scale the box.
Expand Down
4 changes: 4 additions & 0 deletions src/compas/geometry/shapes/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def to_brep(self):
# Transformation
# =============================================================================

@reset_computed
def transform(self, transformation):
"""Transform the shape.
Expand All @@ -191,6 +192,7 @@ def transform(self, transformation):
"""
self.frame.transform(transformation)

@reset_computed
def translate(self, vector):
"""Translate the shape.
Expand All @@ -212,6 +214,7 @@ def translate(self, vector):
"""
self.frame.point += vector

@reset_computed
def rotate(self, angle, axis=None, point=None):
"""Rotate the shape.
Expand All @@ -236,6 +239,7 @@ def rotate(self, angle, axis=None, point=None):
matrix = Rotation.from_axis_and_angle(axis=axis, angle=angle, point=point)
self.transform(matrix)

@reset_computed
def scale(self, scale):
"""Scale the shape.
Expand Down

0 comments on commit be9643a

Please sign in to comment.