Skip to content

Commit 0003fc8

Browse files
committedJun 29, 2013
Add Lua VoxelArea methods: contains, containsp, containsi
1 parent 9126823 commit 0003fc8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎builtin/voxelarea.lua

+16
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,19 @@ function VoxelArea:indexp(p)
4444
return math.floor(i)
4545
end
4646

47+
function VoxelArea:contains(x, y, z)
48+
return (x >= self.MinEdge.x) and (x <= self.MaxEdge.x) and
49+
(y >= self.MinEdge.y) and (y <= self.MaxEdge.y) and
50+
(z >= self.MinEdge.z) and (z <= self.MaxEdge.z)
51+
end
52+
53+
function VoxelArea:containsp(p)
54+
return (p.x >= self.MinEdge.x) and (p.x <= self.MaxEdge.x) and
55+
(p.y >= self.MinEdge.y) and (p.y <= self.MaxEdge.y) and
56+
(p.z >= self.MinEdge.z) and (p.z <= self.MaxEdge.z)
57+
end
58+
59+
function VoxelArea:containsi(i)
60+
return (i >= 1) and (i <= self:getVolume())
61+
end
62+

0 commit comments

Comments
 (0)
Please sign in to comment.