forked from rai-opensource/spatialmath-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_graphics.py
More file actions
66 lines (51 loc) · 1.99 KB
/
test_graphics.py
File metadata and controls
66 lines (51 loc) · 1.99 KB
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
import unittest
import numpy as np
from spatialmath.base import *
# test graphics primitives
# TODO check they actually create artists
class TestGraphics(unittest.TestCase):
def test_plotvol2(self):
plotvol2(5)
def test_plotvol3(self):
plotvol3(5)
def test_plot_box(self):
plot_box("r--", centre=(-2, -3), wh=(1, 1))
plot_box(lt=(1, 1), rb=(2, 0), filled=True, color="b")
def test_plot_circle(self):
plot_circle(1, (0, 0), "r") # red circle
plot_circle(2, (0, 0), "b--") # blue dashed circle
plot_circle(0.5, (0, 0), filled=True, color="y") # yellow filled circle
def test_ellipse(self):
plot_ellipse(np.diag((1, 2)), "r") # red ellipse
plot_ellipse(np.diag((1, 2)), "b--") # blue dashed ellipse
plot_ellipse(
np.diag((1, 2)), centre=(1, 1), filled=True, color="y"
) # yellow filled ellipse
def test_plot_homline(self):
plot_homline((1, 2, 3))
plot_homline((1, -2, 3), "k--")
def test_cuboid(self):
plot_cuboid((1, 2, 3), color="g")
plot_cuboid((1, 2, 3), centre=(2, 3, 4), color="g")
plot_cuboid((1, 2, 3), filled=True, color="y")
def test_sphere(self):
plot_sphere(0.3, color="r")
plot_sphere(1, centre=(1, 1, 1), filled=True, color="b")
def test_ellipsoid(self):
plot_ellipsoid(np.diag((1, 2, 3)), color="r") # red ellipsoid
plot_ellipsoid(
np.diag((1, 2, 3)), centre=(1, 2, 3), filled=True, color="y"
) # yellow filled ellipsoid
def test_cylinder(self):
plot_cylinder(radius=0.2, centre=(0.5, 0.5, 0), height=[-0.2, 0.2])
plot_cylinder(
radius=0.2,
centre=(0.5, 0.5, 0),
height=[-0.2, 0.2],
filled=True,
resolution=5,
color="red",
)
# ---------------------------------------------------------------------------------------#
if __name__ == "__main__":
unittest.main(buffer=True)