1
0
Fork 0

cCuboid: Added the IsCompletelyInside() function

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1339 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-03-31 18:22:55 +00:00
parent 25742dcd7a
commit 412a80b5c2
4 changed files with 56 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 03/31/13 18:21:23.
** Generated automatically by tolua++-1.0.92 on 03/31/13 20:21:16.
*/
#ifndef __cplusplus
@ -17838,6 +17838,40 @@ tolua_lerror:
}
#endif //#ifndef TOLUA_DISABLE
/* method: IsCompletelyInside of class cCuboid */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsCompletelyInside00
static int tolua_AllToLua_cCuboid_IsCompletelyInside00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0);
const cCuboid* a_Outer = ((const cCuboid*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCompletelyInside'", NULL);
#endif
{
bool tolua_ret = (bool) self->IsCompletelyInside(*a_Outer);
tolua_pushboolean(tolua_S,(bool)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'IsCompletelyInside'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Move of class cCuboid */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Move00
static int tolua_AllToLua_cCuboid_Move00(lua_State* tolua_S)
@ -23918,6 +23952,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside00);
tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside01);
tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside02);
tolua_function(tolua_S,"IsCompletelyInside",tolua_AllToLua_cCuboid_IsCompletelyInside00);
tolua_function(tolua_S,"Move",tolua_AllToLua_cCuboid_Move00);
tolua_function(tolua_S,"IsSorted",tolua_AllToLua_cCuboid_IsSorted00);
tolua_endmodule(tolua_S);

View File

@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 03/31/13 18:21:24.
** Generated automatically by tolua++-1.0.92 on 03/31/13 20:21:17.
*/
/* Exported function */

View File

@ -72,6 +72,22 @@ bool cCuboid::DoesIntersect(const cCuboid & a_Other) const
bool cCuboid::IsCompletelyInside(const cCuboid & a_Outer) const
{
return (
(p1.x >= a_Outer.p1.x) &&
(p2.x <= a_Outer.p2.x) &&
(p1.y >= a_Outer.p1.y) &&
(p2.y <= a_Outer.p2.y) &&
(p1.z >= a_Outer.p1.z) &&
(p2.z <= a_Outer.p2.z)
);
}
void cCuboid::Move(int a_OfsX, int a_OfsY, int a_OfsZ)
{
p1.x += a_OfsX;

View File

@ -59,6 +59,9 @@ public:
);
}
/// Returns true if this cuboid is completely inside the specifie cuboid (in all 6 coords)
bool IsCompletelyInside(const cCuboid & a_Outer) const;
/// Moves the cuboid by the specified offsets in each direction
void Move(int a_OfsX, int a_OfsY, int a_OfsZ);