Skip to content

Commit f379db7

Browse files
authored
Merge pull request #885 from mattiskoh/offset_plane
added Plane offset method
2 parents add3a75 + 1fe702c commit f379db7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## Unreleased
9-
9+
* Added `Plane.offset`
1010
### Added
1111

1212
* Added `draw_vertexlabels`, `draw_edgelabels`, `draw_facelabels`, `draw_vertexnormals`, and `draw_facenormals` to `compas_blender.artists.MeshArtist`.

src/compas/geometry/primitives/plane.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,22 @@ def transform(self, T):
298298
"""
299299
self.point.transform(T)
300300
self.normal.transform(T)
301+
302+
def offset(self, distance):
303+
"""Returns a new offset plane by a given distance.
304+
Plane normal is used as positive direction.
305+
306+
Parameters:
307+
-----------
308+
plane: :class:`compas.geometry.Plane`
309+
The plane to be offset.
310+
distance: :obj:`float`
311+
The offset distance.
312+
313+
Returns
314+
--------
315+
:class:`Plane`
316+
The offset plane.
317+
"""
318+
319+
return Plane(self.point+self.normal.scaled(distance), self.normal)

0 commit comments

Comments
 (0)