Skip to content

Commit 70b568d

Browse files
committed
update 1.1
Greatly improved performances for canvas of big dimensions. Improved the visuals when scrolling (the header and palette are always visible). The h value coefficient is now customizable. The movement's cost is now customizable. Added italian translation to the page. Added settings documentation. Fixed many bugs.
1 parent 6697862 commit 70b568d

15 files changed

+625
-121
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ A live version is available [here](https://tendto.github.io/AstarPathfindingAlgo
77
![](graphic/demo.gif)
88

99
## :books: Documentation
10-
[Documentation](doc/DOC.md)
10+
[Code documentation](doc/doc_code.md)<br>
11+
[Settings documentation](doc/doc_settings.md)
1112

1213
## 🤝 Contributing
1314

doc/DOC.md renamed to doc/doc_code.md

+37-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,40 @@
1-
## Documentation
2-
3-
### Constants
4-
Vertical and Horizontal cost: 10
5-
Diagonal cost: 14
6-
7-
### Heuristics
8-
To find the h value, there are 4 possible heuristics contemplated:
9-
- **Manhattan distance:** estimate the distance considering only horizontal-vertical movements. Ignores obstacles
10-
- **Diagonal distance:** estimate the distance considering all the 8 possible directions. Ignores obstacles
11-
- **Euclid distance:** estimate the distance as the crow flies. Ignores obstacles
12-
- **Dijkstra (h = 0):** always set h = 0. It behaves exactly like Dijkstra's algorithm
1+
## Code documentation
2+
3+
### index.html
4+
```javascript
5+
/**
6+
* Used to enable the tooltips
7+
*/
8+
$(function())
9+
10+
/**
11+
* Prevents the use of unwanted characters
12+
* @param {any} ob - html input field
13+
*/
14+
function checkInput(ob)
15+
16+
/**
17+
* Checks that the value is between the constrains
18+
* @param {any} ob - html input field
19+
* @param {number} min - minimum value allowed
20+
* @param {number} max - maximum value allowed
21+
*/
22+
function validateInput(ob, min, max)
23+
24+
/**
25+
* Change the status value and shows the modal
26+
*/
27+
function callSettings()
28+
29+
/**
30+
* Show the results of the algorithm
31+
* @param {number} distance - distance result from the start point to hte end point
32+
* @param {number} stepCounter - times of calls to the function 'stepSolution'
33+
* @param {number} fcounter - times an fvalue got evalueted
34+
* @param {number} time - time enlapsed
35+
*/
36+
function setResults(distance, stepCounter, fcounter, time)
37+
```
1338

1439
### main.js
1540
```javascript

doc/doc_settings.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Settings documentation
2+
3+
### Settings explaination
4+
+ Rows: number of rows of the canvas. Min 1 - Max 99
5+
+ Columns: number of columns of the canvas. Min 1 - Max 99
6+
+ Cell size: size of the cells of the canvas. Min 6 - Max 99
7+
+ Framerate: framerate of the animation. An higher value will make the animation faster. Min 0.1 - Max 60
8+
+ **+** direction cost: cost of moving vertically or horizontally. It will influence both h and g values. Min 0 - Max 50
9+
+ **x** direction cost: cost of moving diagonally. It will influence both h and g values. Min 0 - Max 50
10+
+ H coefficient: coefficient applied to the h value. A lower coeffient will make so the algorithm will seek the shortest path, but will be less efficient. An higher value will make so the algorithm will finish earlier, but the path may not be the shortest. Min 0 - Max 99
11+
+ Special ground: traversing the special ground will cost the specified value times more than traversing the normal ground. It will only influence the g value
12+
+ Heuristics: heustic used to calculate the h value. See below for more information on each one
13+
+ Can move diagonally: whether or not diagonal movement is allowed
14+
15+
+ Cancel: revert the settings
16+
+ Apply: apply the settings
17+
18+
#### Heuristics
19+
There are 4 possible heuristics contemplated:
20+
- **Manhattan distance:** estimate the distance considering only horizontal-vertical movements. Ignores obstacles
21+
- **Diagonal distance:** estimate the distance considering all the 8 possible directions. Ignores obstacles
22+
- **Euclid distance:** estimate the distance as the crow flies. Ignores obstacles
23+
- **Dijkstra (h = 0):** always set h = 0. It behaves exactly like Dijkstra's algorithm

graphic/end.svg

+1-1
Loading

graphic/htmlValidator.png

1.63 KB
Loading

graphic/language.svg

+1
Loading

graphic/start.svg

+1-1
Loading

0 commit comments

Comments
 (0)