1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
# Copyright (c) 2018-2020 Manfred Moitzi
# License: MIT License
from ezdxf.math import PassTroughUCS, UCS, Vec3, X_AXIS, Y_AXIS, Z_AXIS
def test_u_vectors():
ucs = PassTroughUCS()
assert ucs.ux == X_AXIS
assert ucs.uy == Y_AXIS
assert ucs.uz == Z_AXIS
def test_to_wcs():
ucs = PassTroughUCS()
assert ucs.to_wcs((1, 2, 3)) == Vec3(1, 2, 3)
assert ucs.to_wcs((3, 4, 5)) == Vec3(3, 4, 5)
ucs2 = UCS()
assert ucs.to_wcs((1, 2, 3)) == ucs2.to_wcs((1, 2, 3))
assert ucs.to_wcs((3, 4, 5)) == ucs2.to_wcs((3, 4, 5))
def test_points_to_wcs():
ucs = PassTroughUCS()
assert list(ucs.points_to_wcs([(1, 2, 3), (3, 4, 5)])) == [
Vec3(1, 2, 3),
Vec3(3, 4, 5),
]
ucs2 = UCS()
assert list(ucs.points_to_wcs([(1, 2, 3), (3, 4, 5)])) == list(
ucs2.points_to_wcs([(1, 2, 3), (3, 4, 5)])
)
def test_to_ocs():
ucs = PassTroughUCS()
assert ucs.to_ocs((1, 2, 3)) == Vec3(1, 2, 3)
assert ucs.to_ocs((3, 4, 5)) == Vec3(3, 4, 5)
def test_points_to_ocs():
ucs = PassTroughUCS()
assert list(ucs.points_to_ocs([(1, 2, 3), (3, 4, 5)])) == [
Vec3(1, 2, 3),
Vec3(3, 4, 5),
]
def test_from_wcs():
ucs = PassTroughUCS()
assert ucs.from_wcs((1, 2, 3)) == Vec3(1, 2, 3)
assert ucs.from_wcs((3, 4, 5)) == Vec3(3, 4, 5)
ucs2 = UCS()
assert ucs.from_wcs((1, 2, 3)) == ucs2.from_wcs(Vec3(1, 2, 3))
assert ucs.from_wcs((3, 4, 5)) == ucs2.from_wcs(Vec3(3, 4, 5))
def test_points_from_wcs():
points = Vec3.list([(1, 2, 3), (3, 4, 5)])
ucs = PassTroughUCS()
assert list(ucs.points_from_wcs(points)) == points
ucs2 = UCS()
assert list(ucs.points_from_wcs(points)) == list(
ucs2.points_from_wcs(points)
)
|