本文整理汇总了Java中org.andengine.util.math.MathUtils.degToRad方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.degToRad方法的具体用法?Java MathUtils.degToRad怎么用?Java MathUtils.degToRad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.util.math.MathUtils
的用法示例。
在下文中一共展示了MathUtils.degToRad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setGradientAngle
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
/**
* @param pGradientAngle in degrees. <code>0</code> is a 'left-to-right', <code>90</code> is 'top-to-bottom', ...
*/
public void setGradientAngle(final float pGradientAngle) {
final float angleInRad = MathUtils.degToRad(pGradientAngle);
this.setGradientVector((float) Math.cos(angleInRad), (float) Math.sin(angleInRad));
}
示例2: createCircleBody
import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public static Body createCircleBody(final PhysicsWorld pPhysicsWorld, final float pCenterX, final float pCenterY, final float pRadius, final float pRotation, final BodyType pBodyType, final FixtureDef pFixtureDef, final float pPixelToMeterRatio) {
final BodyDef circleBodyDef = new BodyDef();
circleBodyDef.type = pBodyType;
circleBodyDef.position.x = pCenterX / pPixelToMeterRatio;
circleBodyDef.position.y = pCenterY / pPixelToMeterRatio;
circleBodyDef.angle = MathUtils.degToRad(pRotation);
final Body circleBody = pPhysicsWorld.createBody(circleBodyDef);
final CircleShape circlePoly = new CircleShape();
pFixtureDef.shape = circlePoly;
final float radius = pRadius / pPixelToMeterRatio;
circlePoly.setRadius(radius);
circleBody.createFixture(pFixtureDef);
circlePoly.dispose();
return circleBody;
}