Skip to content

Instantly share code, notes, and snippets.

@rpavlik
Created January 20, 2012 21:19
Show Gist options
  • Save rpavlik/1649676 to your computer and use it in GitHub Desktop.
Save rpavlik/1649676 to your computer and use it in GitHub Desktop.
A quickie function that should hopefully print the dimensions of a node.
printBoundingSphere = function(node)
local bs = node:getBound()
print("Radius:", bs:radius())
print("Center:", bs:center())
end
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