Commit d9553497 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[python][direction] implement type deduction from args

parent 90a743c3
...@@ -67,6 +67,20 @@ def Vector(*args, **kwargs): ...@@ -67,6 +67,20 @@ def Vector(*args, **kwargs):
# last option: construction from the raw coordinates # last option: construction from the raw coordinates
return makeVector(numArgs) 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 # Argument-dependent n-d circle construction
def Circle(*args, **kwargs): def Circle(*args, **kwargs):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment