Created
January 20, 2012 21:19
-
-
Save rpavlik/1649676 to your computer and use it in GitHub Desktop.
A quickie function that should hopefully print the dimensions of a node.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printBoundingSphere = function(node) | |
local bs = node:getBound() | |
print("Radius:", bs:radius()) | |
print("Center:", bs:center()) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printBounds = function(node) | |
local cbv = osg.ComputeBoundsVisitor() | |
node:accept(cbv) | |
local bb = cbv:getBoundingBox() | |
local dims = {} | |
for _, dim in ipairs{"x", "y", "z"} do | |
dims[dim] = bb[dim .. "Max"](bb) - bb[dim .. "Min"](bb) | |
print(dim, dims[dim]) | |
end | |
return dims | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment