diff options
author | Paramat <paramat@users.noreply.github.com> | 2020-02-22 01:11:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 01:11:33 +0000 |
commit | 2df226bb41904bfd80c33f243996ee7b1bd7e907 (patch) | |
tree | 913bfc3bbc20a4b036aa4cba6d46505790f842f9 /doc | |
parent | d5070474439c4bd1e59841ffd6400e981854c63d (diff) | |
download | minetest-2df226bb41904bfd80c33f243996ee7b1bd7e907.tar.gz minetest-2df226bb41904bfd80c33f243996ee7b1bd7e907.tar.bz2 minetest-2df226bb41904bfd80c33f243996ee7b1bd7e907.zip |
Lua_api.txt: Add documentation of VoxelArea 'ystride', 'zstride' (#9415)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua_api.txt | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index fe5b1a626..a16c083c8 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3746,7 +3746,7 @@ Methods ----------- A helper class for voxel areas. -It can be created via `VoxelArea:new{MinEdge=pmin, MaxEdge=pmax}`. +It can be created via `VoxelArea:new{MinEdge = pmin, MaxEdge = pmax}`. The coordinates are *inclusive*, like most other things in Minetest. ### Methods @@ -3777,6 +3777,28 @@ The coordinates are *inclusive*, like most other things in Minetest. `[z [y [x]]]`. * `iterp(minp, maxp)`: same as above, except takes a vector +### Y stride and z stride of a flat array + +For a particular position in a voxel area, whose flat array index is known, +it is often useful to know the index of a neighboring or nearby position. +The table below shows the changes of index required for 1 node movements along +the axes in a voxel area: + + Movement Change of index + +x +1 + -x -1 + +y +ystride + -y -ystride + +z +zstride + -z -zstride + +If, for example: + + local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax} + +The values of `ystride` and `zstride` can be obtained using `area.ystride` and +`area.zstride`. + |