FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-pathfinding/test/util_test.py at python2 · brean/python-pathfinding · GitHub
brean
/
python-pathfinding
Public
Notifications
You must be signed in to change notification settings
Fork
73
Star
383
Code
Issues
24
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-pathfinding
/
test
/
util_test.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (42 loc) · 1.11 KB
Breadcrumbs
python-pathfinding
/
test
/
util_test.py
Copy path
File metadata and controls
48 lines (42 loc) · 1.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
from
pathfinding
.
core
.
grid
import
Grid
from
pathfinding
.
core
.
util
import
bresenham
,
raytrace
,
smoothen_path
def
test_bresenham
():
"""
test bresenham path interpolation
"""
assert
bresenham
([
0
,
0
], [
2
,
5
])
==
[
[
0
,
0
], [
0
,
1
],
[
1
,
2
], [
1
,
3
],
[
2
,
4
], [
2
,
5
]
]
assert
bresenham
([
0
,
1
], [
0
,
4
])
==
[
[
0
,
1
], [
0
,
2
], [
0
,
3
], [
0
,
4
]
]
def
test_raytrace
():
"""
test raytrace path interpolation
"""
assert
raytrace
([
0
,
0
], [
2
,
5
])
==
[
[
0
,
0
], [
0
,
1
],
[
1
,
1
], [
1
,
2
], [
1
,
3
], [
1
,
4
],
[
2
,
4
], [
2
,
5
]
]
assert
raytrace
([
0
,
1
], [
0
,
4
])
==
[
[
0
,
1
], [
0
,
2
], [
0
,
3
], [
0
,
4
]
]
def
test_smoothen_path
():
matrix
=
[
[
1
,
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
,
1
]
]
grid
=
Grid
(
matrix
=
matrix
)
path
=
[
[
0
,
0
], [
1
,
0
], [
2
,
0
], [
2
,
1
], [
2
,
2
], [
2
,
3
], [
3
,
3
], [
3
,
4
], [
4
,
4
]
]
smooth_path
=
[
[
0
,
0
], [
1
,
0
], [
2
,
0
], [
2
,
1
], [
2
,
2
], [
2
,
3
], [
3
,
3
], [
4
,
4
]
]
assert
smoothen_path
(
grid
,
path
)
==
smooth_path
Back
|
FazBrowse Home
|
New Git URL