Add getExtends() method to BoundingVolume?

I’m using this method to get the outter width/height/length of a model:



[java]public static Vector3f getExtents(final Node n) {

final BoundingVolume bv = n.getWorldBound();

Vector3f extents = null;

if (bv instanceof BoundingBox) {

final float x = ((BoundingBox) bv).getXExtent();

final float y = ((BoundingBox) bv).getYExtent();

final float z = ((BoundingBox) bv).getZExtent();

extents = new Vector3f(x, y, z);

} else if (bv instanceof BoundingSphere) {

final float r = ((BoundingSphere) bv).getRadius();

extents = new Vector3f(r, r, r);

}

return extents;

}[/java]



Could you add a method

[java]public Vector3f getExtents()[/java]

to BoundingVolume or do you see a problem with that?

You can use BoundingBox.getExtent(null).

But whats with BoundingSphere? Would’nt it be better to have such a method in the abstract class?