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

[python][geometry] fix geometry constructors

parent 2b31244a
......@@ -54,13 +54,17 @@ def Vector(*args, **kwargs):
if isinstance(args[0], list):
dim = len(args[0])
else:
try: dim = args[0].worldDimension
try:
if len(args) > 0: dim = args[0].worldDimension
else: dim = kwargs.get('direction')
except: raiseGeometryConstructorException("vector")
return makeVector(dim)
# (maybe) construct from two points
if numArgs == 2:
try: dim = args[0].worldDimension
try:
if len(args) > 0: dim = args[0].worldDimension
else: dim = kwargs.get('source')
except: pass
else: return makeVector(dim)
......@@ -73,7 +77,9 @@ def Vector(*args, **kwargs):
def Direction(*args, **kwargs):
numArgs = len(args) + len(kwargs)
if numArgs != 1: raiseGeometryConstructorException("direction", "numArgs")
try: dim = args[0].worldDimension
try:
if len(args) > 0: dim = args[0].worldDimension
else: dim = kwargs['vector'].worldDimension
except: raiseGeometryConstructorException("direction")
if dim == 1: return Direction_1(*args, **kwargs)
......@@ -86,7 +92,9 @@ def Direction(*args, **kwargs):
def Circle(*args, **kwargs):
numArgs = len(args) + len(kwargs)
if numArgs != 3: raiseGeometryConstructorException("circle", "numArgs")
try: dim = args[0].worldDimension
try:
if len(args) > 0: dim = args[0].worldDimension
else: dim = kwargs['center'].worldDimension
except: raiseGeometryConstructorException("circle")
if dim == 1: raiseGeometryConstructorException("circle", "notImplemented") # todo
......
Markdown is supported
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