Merge branch 'maintenance' into devel

This commit is contained in:
Gina Häußge 2016-07-05 14:53:23 +02:00
commit 9fca41c76c

View file

@ -58,7 +58,7 @@ class Vector3D(object):
# copy constructor
other = args[0]
if not isinstance(other, Vector3D):
raise ValueError("Object to copy must be a Scalar3D instance")
raise ValueError("Object to copy must be a Vector3D instance")
self.x = other.x
self.y = other.y
@ -78,7 +78,7 @@ class Vector3D(object):
self.y + other[1],
self.z + other[2])
else:
raise ValueError("other must be a Scalar3D instance or a list or tuple of length 3")
raise ValueError("other must be a Vector3D instance or a list or tuple of length 3")
def __sub__(self, other):
if isinstance(other, Vector3D):
@ -90,7 +90,7 @@ class Vector3D(object):
self.y - other[1],
self.z - other[2])
else:
raise ValueError("other must be a Scalar3D instance or a list or tuple")
raise ValueError("other must be a Vector3D instance or a list or tuple")
def __mul__(self, other):
if isinstance(other, (int, float)):
@ -112,7 +112,7 @@ class Vector3D(object):
return self.x == other.x and self.y == other.y and self.z == other.z
def __str__(self):
return "Scalar3D(x={}, y={}, z={}, length={})".format(self.x, self.y, self.z, self.length)
return "Vector3D(x={}, y={}, z={}, length={})".format(self.x, self.y, self.z, self.length)
class MinMax3D(object):
@ -122,15 +122,15 @@ class MinMax3D(object):
Examples:
>>> minmax = MinMax3D()
>>> minmax.record(Scalar3D(2.0, 2.0, 2.0))
>>> minmax.record(Vector3D(2.0, 2.0, 2.0))
>>> minmax.min.x == 2.0 == minmax.max.x and minmax.min.y == 2.0 == minmax.max.y and minmax.min.z == 2.0 == minmax.max.z
True
>>> minmax.record(Scalar3D(1.0, 2.0, 3.0))
>>> minmax.record(Vector3D(1.0, 2.0, 3.0))
>>> minmax.min.x == 1.0 and minmax.min.y == 2.0 and minmax.min.z == 2.0
True
>>> minmax.max.x == 2.0 and minmax.max.y == 2.0 and minmax.max.z == 3.0
True
>>> minmax.size == Scalar3D(1.0, 0.0, 1.0)
>>> minmax.size == Vector3D(1.0, 0.0, 1.0)
True
"""