當前位置: 首頁>>代碼示例>>Java>>正文


Java FastMath.PI屬性代碼示例

本文整理匯總了Java中com.jme3.math.FastMath.PI屬性的典型用法代碼示例。如果您正苦於以下問題:Java FastMath.PI屬性的具體用法?Java FastMath.PI怎麽用?Java FastMath.PI使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.jme3.math.FastMath的用法示例。


在下文中一共展示了FastMath.PI屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: set

public void set( float a1, float a2, float a3 ) {

		this.ry = (float) ( 3 * Math.PI - a1 ) % ( 2 * FastMath.PI ); // heading from north
		this.rx = ( a2 + FastMath.PI * 3 / 2 ) % ( 2 * FastMath.PI ); // normally about 90 (if not on a hill)
		this.rz = 2 * FastMath.PI + a3; // tilt: normally about 0 
		
		Quaternion q1 = new Quaternion(), q2 = new Quaternion(), q3 = new Quaternion();

		q2.fromAngleAxis( ry, new com.jme3.math.Vector3f( 0, 1, 0 ) );
		q3.fromAngleAxis( -rx, new com.jme3.math.Vector3f( 1, 0, 0 ) );
		q1.fromAngleAxis( rz, new com.jme3.math.Vector3f( 0, 0, 1 ) );

		geomRot = q2.mult( q3 ).mult( q1 );
		inverseGeomRot = geomRot.inverse();
	}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:15,代碼來源:Pano.java

示例2: Editor3DEditorState

public Editor3DEditorState() {
    this.cameraLocation = new Vector3f();
    this.cameraVRotation = FastMath.PI / 6;
    this.cameraTDistance = 20;
    this.cameraHRotation = 0;
    this.cameraSpeed = 1;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:7,代碼來源:Editor3DEditorState.java

示例3: calcScreenArea

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,代碼行數:9,代碼來源:AreaUtils.java

示例4: controlRender

protected void controlRender(RenderManager rm, ViewPort vp){
    BoundingVolume bv = spatial.getWorldBound();

    Camera cam = vp.getCamera();
    float atanNH = FastMath.atan(cam.getFrustumNear() * cam.getFrustumTop());
    float ratio = (FastMath.PI / (8f * atanNH));
    float newDistance = bv.distanceTo(vp.getCamera().getLocation()) / ratio;
    int level;

    if (Math.abs(newDistance - lastDistance) <= distTolerance)
        level = lastLevel; // we haven't moved relative to the model, send the old measurement back.
    else if (lastDistance > newDistance && lastLevel == 0)
        level = lastLevel; // we're already at the lowest setting and we just got closer to the model, no need to keep trying.
    else if (lastDistance < newDistance && lastLevel == numLevels - 1)
        level = lastLevel; // we're already at the highest setting and we just got further from the model, no need to keep trying.
    else{
        lastDistance = newDistance;

        // estimate area of polygon via bounding volume
        float area = AreaUtils.calcScreenArea(bv, lastDistance, cam.getWidth());
        float trisToDraw = area * trisPerPixel;
        level = numLevels - 1;
        for (int i = numLevels; --i >= 0;){
            if (trisToDraw - numTris[i] < 0){
                break;
            }
            level = i;
        }
        lastLevel = level;
    }

    spatial.setLodLevel(level);
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:33,代碼來源:LodControl.java

示例5: loadAnimModel

private Spatial loadAnimModel() {
    // 生成路徑點
    if (fixedPoints == null) {
        fixedPoints = new Vector3f[randomPoints.length];
        for (int i = 0; i < randomPoints.length; i++) {
            Vector3f point = new Vector3f();
            ((Position)Loader.load(randomPoints[i])).getPoint(point);
            fixedPoints[i] = point;
        }
    }
    MySpline spline = createSpline(fixedPoints, tension, cycle);
    if(dimension > 1) {
        // 計算出實際的維度旋轉軸
        TempVars tv = TempVars.get();
        Vector3f nextPoint = tv.vect1;
        Vector3f forward = tv.vect2;
        Vector3f left = tv.vect3;
        Vector3f rotAxis = tv.vect4;
        spline.getSplinePoint(spline.getTotalLength() / segments, nextPoint);
        nextPoint.subtract(spline.getControlPoints().get(0), forward).normalizeLocal();
        up.cross(forward, left).normalizeLocal();
        left.cross(up, rotAxis).normalizeLocal();
        
        Quaternion qua = new Quaternion();
        Vector3f tempUp = tv.vect5;
        float angle = FastMath.PI / dimension;
        Node animNode = new Node();
        for (int i = 0; i < dimension; i++) {
            qua.fromAngleAxis(angle * i, rotAxis);
            qua.mult(up, tempUp);
            animNode.attachChild(createSurface(spline, tempUp));
        }
        tv.release();
        return animNode;
    } else {
        return createSurface(spline, up);
    }
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:38,代碼來源:SlideColorIOSplineEffect.java

示例6: getVolume

@Override
public float getVolume() {
    return 4 * FastMath.ONE_THIRD * FastMath.PI * radius * radius * radius;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:4,代碼來源:BoundingSphere.java

示例7: loadAnimModel

@Override
protected final Spatial loadAnimModel() {
    fixedPoints = data.getAsVector3fArray("fixedPoints");
    randomPoints = data.getAsArray("randomPoints");
    width = data.getAsFloat("width", width);
    segments = data.getAsInteger("segments", segments);
    tension = data.getAsFloat("tension", tension);
    cycle = data.getAsBoolean("cycle", cycle);
    up = data.getAsVector3f("up", up).normalizeLocal();
    dimension = data.getAsInteger("dimension", dimension);
    
    if (fixedPoints == null && randomPoints == null)
        throw new NullPointerException("need fixedPoints or randomPoints");
    
    // 生成路徑點
    if (fixedPoints == null) {
        fixedPoints = new Vector3f[randomPoints.length];
        for (int i = 0; i < randomPoints.length; i++) {
            Vector3f point = new Vector3f();
            ((Position)Loader.load(randomPoints[i])).getPoint(point);
            fixedPoints[i] = point;
        }
    }
    MySpline spline = createSpline(fixedPoints, tension, cycle);
    if(dimension > 1) {
        // 計算出實際的維度旋轉軸
        TempVars tv = TempVars.get();
        Vector3f nextPoint = tv.vect1;
        Vector3f forward = tv.vect2;
        Vector3f left = tv.vect3;
        Vector3f rotAxis = tv.vect4;
        spline.getSplinePoint(spline.getTotalLength() / segments, nextPoint);
        nextPoint.subtract(spline.getControlPoints().get(0), forward).normalizeLocal();
        up.cross(forward, left).normalizeLocal();
        left.cross(up, rotAxis).normalizeLocal();
        
        Quaternion qua = new Quaternion();
        Vector3f tempUp = tv.vect5;
        float angle = FastMath.PI / dimension;
        Node animObject = new Node();
        for (int i = 0; i < dimension; i++) {
            qua.fromAngleAxis(angle * i, rotAxis);
            qua.mult(up, tempUp);
            animObject.attachChild(createSurface(spline, tempUp));
        }
        tv.release();
        return animObject;
    } else {
        return createSurface(spline, up);
    }
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:51,代碼來源:SlideColorSplineEffect.java

示例8: updateScale

private void updateScale() {
	
	float scale = handleScale();
	
	Vector3f offset = new Vector3f( dir );
	
	BoundingBox bv =  (BoundingBox) target.getWorldBound();
	g1.setLocalTransform(new Transform(  bv.getCenter().add( offset.mult( bv.getExtent(null)) ).add(offset.mult(2)) ));
	
	g1.setLocalScale( scale * 1 );
	
	Quaternion rot = new Quaternion(new float[] {FastMath.PI/2, 0, 0 });
	
	g1.setLocalRotation( rot );
}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:15,代碼來源:RotHandle.java


注:本文中的com.jme3.math.FastMath.PI屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。