mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-08 15:56:42 +02:00
refactor dir table
This commit is contained in:
@@ -40,26 +40,19 @@ function _corner_value(dotM, p) =
|
|||||||
(dotMy1[x_1] ? 4 : 0) +
|
(dotMy1[x_1] ? 4 : 0) +
|
||||||
(dotMy[x_1] ? 8 : 0);
|
(dotMy[x_1] ? 8 : 0);
|
||||||
|
|
||||||
|
UP = [0, 1];
|
||||||
|
DOWN = [0, -1];
|
||||||
|
LEFT = [-1, 0];
|
||||||
|
RIGHT = [1, 0];
|
||||||
|
|
||||||
// [4, 0], [12, 0], [13, 0], // UP
|
|
||||||
// [1, 1], [3, 1], [7, 1], // DOWN
|
|
||||||
// [2, 2], [6, 2], [14, 2], // LEFT
|
|
||||||
// [8, 3], [9, 3], [11, 3] // RIGHT
|
|
||||||
_dir_table = [
|
_dir_table = [
|
||||||
undef, 1, 2, 1,
|
undef, DOWN, LEFT, DOWN,
|
||||||
0, undef, 2, 1,
|
UP, undef, LEFT, DOWN,
|
||||||
3, 3, undef, 3,
|
RIGHT, RIGHT, undef, RIGHT,
|
||||||
0, 0, 2, undef
|
UP, UP, LEFT, undef
|
||||||
];
|
];
|
||||||
|
|
||||||
_nxt_offset = [
|
function nxtp(dotM, p) = p + _dir_table[_corner_value(dotM, p)];
|
||||||
[0, 1], // UP
|
|
||||||
[0, -1], // DOWN
|
|
||||||
[-1, 0], // LEFT
|
|
||||||
[1, 0] // RIGHT
|
|
||||||
];
|
|
||||||
|
|
||||||
function nxtp(dotM, p) = p + _nxt_offset[_dir_table[_corner_value(dotM, p)]];
|
|
||||||
|
|
||||||
function _travel(dotM, p, leng) =
|
function _travel(dotM, p, leng) =
|
||||||
let(
|
let(
|
||||||
|
Reference in New Issue
Block a user