Skip to content

Commit 174c00b

Browse files
committed
Optional args in frame constructor
1 parent 0757d64 commit 174c00b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/compas/geometry/frame.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class Frame(Geometry):
3131
----------
3232
point : [float, float, float] | :class:`~compas.geometry.Point`
3333
The origin of the frame.
34-
xaxis : [float, float, float] | :class:`~compas.geometry.Vector`
35-
The x-axis of the frame.
36-
yaxis : [float, float, float] | :class:`~compas.geometry.Vector`
37-
The y-axis of the frame.
34+
xaxis : [float, float, float] | :class:`~compas.geometry.Vector`, optional
35+
The x-axis of the frame. Defaults to the unit X vector.
36+
yaxis : [float, float, float] | :class:`~compas.geometry.Vector`, optional
37+
The y-axis of the frame. Defaults to the unit Y vector.
3838
3939
Attributes
4040
----------
@@ -77,15 +77,15 @@ class Frame(Geometry):
7777
"required": ["point", "xaxis", "yaxis"],
7878
}
7979

80-
def __init__(self, point, xaxis, yaxis, **kwargs):
80+
def __init__(self, point, xaxis=None, yaxis=None, **kwargs):
8181
super(Frame, self).__init__(**kwargs)
8282
self._point = None
8383
self._xaxis = None
8484
self._yaxis = None
8585
self._zaxis = None
8686
self.point = point
87-
self.xaxis = xaxis
88-
self.yaxis = yaxis
87+
self.xaxis = xaxis or Vector(1, 0, 0)
88+
self.yaxis = yaxis or Vector(0, 1, 0)
8989

9090
def __repr__(self):
9191
return "{0}(point={1!r}, xaxis={2!r}, yaxis={3!r})".format(

0 commit comments

Comments
 (0)