Skip to content

Commit 2df226b

Browse files
authoredFeb 22, 2020
Lua_api.txt: Add documentation of VoxelArea 'ystride', 'zstride' (#9415)
1 parent d507047 commit 2df226b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed
 

‎doc/lua_api.txt

+23-1
Original file line numberDiff line numberDiff line change
@@ -3746,7 +3746,7 @@ Methods
37463746
-----------
37473747

37483748
A helper class for voxel areas.
3749-
It can be created via `VoxelArea:new{MinEdge=pmin, MaxEdge=pmax}`.
3749+
It can be created via `VoxelArea:new{MinEdge = pmin, MaxEdge = pmax}`.
37503750
The coordinates are *inclusive*, like most other things in Minetest.
37513751

37523752
### Methods
@@ -3777,6 +3777,28 @@ The coordinates are *inclusive*, like most other things in Minetest.
37773777
`[z [y [x]]]`.
37783778
* `iterp(minp, maxp)`: same as above, except takes a vector
37793779

3780+
### Y stride and z stride of a flat array
3781+
3782+
For a particular position in a voxel area, whose flat array index is known,
3783+
it is often useful to know the index of a neighboring or nearby position.
3784+
The table below shows the changes of index required for 1 node movements along
3785+
the axes in a voxel area:
3786+
3787+
Movement Change of index
3788+
+x +1
3789+
-x -1
3790+
+y +ystride
3791+
-y -ystride
3792+
+z +zstride
3793+
-z -zstride
3794+
3795+
If, for example:
3796+
3797+
local area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
3798+
3799+
The values of `ystride` and `zstride` can be obtained using `area.ystride` and
3800+
`area.zstride`.
3801+
37803802

37813803

37823804

0 commit comments

Comments
 (0)
Please sign in to comment.