diff options
author | Mattes D <github@xoft.cz> | 2016-06-05 21:18:52 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-06-05 21:18:52 +0200 |
commit | 456ffa5bd608c88f5c9b75297fd505b29d0a02e7 (patch) | |
tree | ece066d1c1f8e5ebe4a0da9cf918e06094002188 /Server/Plugins/Debuggers/Debuggers.lua | |
parent | Merge pull request #3219 from QUSpilPrgm/master (diff) | |
parent | Bindings: Fixed cBoundingBox API. (diff) | |
download | cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.gz cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.bz2 cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.lz cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.xz cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.tar.zst cuberite-456ffa5bd608c88f5c9b75297fd505b29d0a02e7.zip |
Diffstat (limited to 'Server/Plugins/Debuggers/Debuggers.lua')
-rw-r--r-- | Server/Plugins/Debuggers/Debuggers.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua index aa2205368..362dc4dd9 100644 --- a/Server/Plugins/Debuggers/Debuggers.lua +++ b/Server/Plugins/Debuggers/Debuggers.lua @@ -1921,6 +1921,52 @@ end +function HandleConsoleTestBbox(a_Split, a_EntireCmd) + -- Test bbox intersection: + local bbox1 = cBoundingBox(0, 5, 0, 5, 0, 5) + local bbox2 = cBoundingBox(bbox1) -- Make a copy + bbox2:Move(20, 20, 20) + local bbox3 = cBoundingBox(bbox1) -- Make a copy + bbox3:Move(2, 2, 2) + local doesIntersect, intersection = bbox1:Intersect(bbox2) + LOG("Bbox 2 intersection: " .. tostring(doesIntersect)) + LOG(" Intersection type: " .. type(intersection) .. " / " .. tolua.type(intersection)) + if (intersection) then + LOG(" {" .. intersection:GetMinX() .. ", " .. intersection:GetMinY() .. ", " .. intersection:GetMinZ() .. "}") + LOG(" {" .. intersection:GetMaxX() .. ", " .. intersection:GetMaxY() .. ", " .. intersection:GetMaxZ() .. "}") + end + doesIntersect, intersection = bbox1:Intersect(bbox3) + LOG("Bbox 3 intersection: " .. tostring(doesIntersect)) + LOG(" Intersection type: " .. type(intersection) .. " / " .. tolua.type(intersection)) + if (intersection) then + LOG(" {" .. intersection:GetMinX() .. ", " .. intersection:GetMinY() .. ", " .. intersection:GetMinZ() .. "}") + LOG(" {" .. intersection:GetMaxX() .. ", " .. intersection:GetMaxY() .. ", " .. intersection:GetMaxZ() .. "}") + end + + -- Test line intersection: + local lines = + { + { Vector3d(5, 0, 5), Vector3d(5, 1, 5) }, + { Vector3d(0, 0, 0), Vector3d(0, 1, 0) }, + } + for idx, line in ipairs(lines) do + local doesIntersect, coeff, face = bbox2:CalcLineIntersection(line[1], line[2]) + LOG("Line " .. idx .. " intersection: " .. tostring(doesIntersect)) + LOG(" Coeff: " .. tostring(coeff)) + LOG(" Face: " .. tostring(face)) + local doesIntersect2, coeff2, face2 = cBoundingBox:CalcLineIntersection(bbox2:GetMin(), bbox2:GetMax(), line[1], line[2]) + assert(doesIntersect == doesIntersect2) + assert(coeff == coeff2) + assert(face == face2) + end + + return true +end + + + + + function HandleConsoleTestCall(a_Split, a_EntireCmd) LOG("Testing inter-plugin calls") LOG("Note: These will fail if the Core plugin is not enabled") |