当前位置: 首页>>代码示例>>Java>>正文


Java BoundingSphere.getRadius方法代码示例

本文整理汇总了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;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:TerrainPatch.java

示例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;
  }
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:AreaUtils.java

示例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;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:20,代码来源:GeometryUtils.java

示例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());
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:UVCoordinatesGenerator.java


注:本文中的com.jme3.bounding.BoundingSphere.getRadius方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。