Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
d9553497
Commit
d9553497
authored
Apr 21, 2020
by
Dennis Gläser
Browse files
[python][direction] implement type deduction from args
parent
90a743c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
python/frackit/geometry/__init__.py
View file @
d9553497
...
...
@@ -67,6 +67,20 @@ def Vector(*args, **kwargs):
# last option: construction from the raw coordinates
return
makeVector
(
numArgs
)
############################################
# Argument-dependent n-d direction construction
def
Direction
(
*
args
,
**
kwargs
):
numArgs
=
len
(
args
)
+
len
(
kwargs
)
if
numArgs
!=
1
:
raiseGeometryConstructorException
(
"direction"
,
"numArgs"
)
try
:
dim
=
args
[
0
].
worldDimension
except
:
raiseGeometryConstructorException
(
"direction"
)
if
dim
==
1
:
return
Direction_1
(
*
args
,
**
kwargs
)
elif
dim
==
2
:
return
Direction_2
(
*
args
,
**
kwargs
)
else
:
return
Direction_3
(
*
args
,
**
kwargs
)
############################################
# Argument-dependent n-d circle construction
def
Circle
(
*
args
,
**
kwargs
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment