本文整理汇总了Java中com.jme3.bounding.BoundingSphere.getRadius方法的典型用法代码示例。如果您正苦于以下问题:Java BoundingSphere.getRadius方法的具体用法?Java BoundingSphere.getRadius怎么用?Java BoundingSphere.getRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.bounding.BoundingSphere
的用法示例。
在下文中一共展示了BoundingSphere.getRadius方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collideWithBoundingVolume
import com.jme3.bounding.BoundingSphere; //导入方法依赖的package包/类
private int collideWithBoundingVolume(BoundingVolume boundingVolume, CollisionResults results) {
if (boundingVolume instanceof BoundingBox)
return collideWithBoundingBox((BoundingBox)boundingVolume, results);
else if(boundingVolume instanceof BoundingSphere) {
BoundingSphere sphere = (BoundingSphere) boundingVolume;
BoundingBox bbox = new BoundingBox(boundingVolume.getCenter().clone(), sphere.getRadius(),
sphere.getRadius(),
sphere.getRadius());
return collideWithBoundingBox(bbox, results);
}
return 0;
}
示例2: calcScreenArea
import com.jme3.bounding.BoundingSphere; //导入方法依赖的package包/类
private static float calcScreenArea(BoundingSphere bound, float distance, float screenWidth) {
// Where is the center point and a radius point that lies in a plan parallel to the view plane?
// // Calc radius based on these two points and plug into circle area formula.
// Vector2f centerSP = null;
// Vector2f outerSP = null;
// float radiusSq = centerSP.subtract(outerSP).lengthSquared();
float radius = (bound.getRadius() * screenWidth) / (distance * 2);
return radius * radius * FastMath.PI;
}
示例3: getModelHeight
import com.jme3.bounding.BoundingSphere; //导入方法依赖的package包/类
/**
* 获取Model的高度,主要是获取包围盒的高度
* @param spatial
* @return
*/
public static float getModelHeight(Spatial spatial) {
float height = 0;
BoundingVolume bv = spatial.getWorldBound();
if (bv.getType() == Type.AABB) {
BoundingBox bb = (BoundingBox) bv;
height = bb.getYExtent() * 2;
} else if (bv.getType() == Type.Sphere) {
BoundingSphere bs = (BoundingSphere) bv;
height = bs.getRadius() * 2;
} else {
LOG.log(Level.WARNING, "Unsupported BoundingVolume type={0}", bv.getType());
}
return height;
}
示例4: if
import com.jme3.bounding.BoundingSphere; //导入方法依赖的package包/类
/**
* This method returns the bounding box of the given mesh.
*
* @param mesh
* the mesh
* @return bounding box of the given mesh
*/
/* package */static BoundingBox getBoundingBox(Mesh mesh) {
mesh.updateBound();
BoundingVolume bv = mesh.getBound();
if (bv instanceof BoundingBox) {
return (BoundingBox) bv;
} else if (bv instanceof BoundingSphere) {
BoundingSphere bs = (BoundingSphere) bv;
float r = bs.getRadius();
return new BoundingBox(bs.getCenter(), r, r, r);
} else {
throw new IllegalStateException("Unknown bounding volume type: " + bv.getClass().getName());
}
}