本文整理汇总了Java中com.badlogic.gdx.physics.box2d.CircleShape.getRadius方法的典型用法代码示例。如果您正苦于以下问题:Java CircleShape.getRadius方法的具体用法?Java CircleShape.getRadius怎么用?Java CircleShape.getRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.box2d.CircleShape
的用法示例。
在下文中一共展示了CircleShape.getRadius方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ComputeSubmergedArea
import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public static float ComputeSubmergedArea(CircleShape shape, Vector2 normal, float offset, Transform xf, Vector2 c)
{
Vector2 p = xf.mul(shape.getPosition());
float l = -(normal.dot(p) - offset);
float r = shape.getRadius();
if (l < -r)
{ // Completely dry
return 0;
}
if (l > r)
{ // Completely wet
c.set(p);
return MathUtils.PI * r * r;
}
float r2 = r * r;
float l2 = l * l;
float area = r2 * ((float) Math.asin(l / r) + MathUtils.PI / 2) + l * (float) Math.sqrt(r2 - l2);
float com = -2.0f / 3.0f * (float) Math.pow(r2 - l2, 1.5f) / area;
c.x = p.x + normal.x * com;
c.y = p.y + normal.y * com;
return area;
}
示例2: ComputeSubmergedArea
import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public static float ComputeSubmergedArea(CircleShape shape, Vector2 normal, float offset, Transform xf, Vector2 c)
{
Vector2 p = xf.mul(shape.getPosition());
float l = -(normal.dot(p) - offset);
float r = shape.getRadius();
if (l < -r)
{ // Completely dry
return 0;
}
if (l > r)
{ // Completely wet
c.set(p);
return MathUtils.PI * r * r;
}
float r2 = r * r;
float l2 = l * l;
float area = r2 * ((float) Math.asin(l / r) + MathUtils.PI / 2) + l * (float) Math.sqrt(r2 - l2);
float com = -2.0f / 3.0f * (float) Math.pow(r2 - l2, 1.5f) / area;
c.x = p.x + normal.x * com;
c.y = p.y + normal.y * com;
return area;
}
示例3: draw
import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public void draw(IFieldRenderer renderer) {
CircleShape shape = (CircleShape)body.getFixtureList().get(0).getShape();
Vector2 center = body.getPosition();
float radius = shape.getRadius();
renderer.fillCircle(center.x, center.y, radius, primaryColor);
// Draw a smaller circle to show the ball's rotation.
float angle = body.getAngle();
float smallCenterX = center.x + (radius / 2) * MathUtils.cos(angle);
float smallCenterY = center.y + (radius / 2) * MathUtils.sin(angle);
renderer.fillCircle(smallCenterX, smallCenterY, radius / 4, secondaryColor);
}
示例4: RenderOfCircleFixture
import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
public RenderOfCircleFixture(Fixture fixture, VertexBufferObjectManager pVBO) {
super(fixture);
CircleShape fixtureShape = (CircleShape) fixture.getShape();
Vector2 position = fixtureShape.getPosition();
float radius = fixtureShape.getRadius() * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT;
mEntity = new Ellipse(position.x * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT,
position.y * PhysicsConnector.PIXEL_TO_METER_RATIO_DEFAULT,
radius, radius, pVBO);
}
示例5: createShape
import com.badlogic.gdx.physics.box2d.CircleShape; //导入方法依赖的package包/类
/**
* Creates the shape.
*/
@Override
public void createShape()
{
shape = new CircleShape();
shape.setRadius(_radius/B2FlxB.RATIO);
// The shape radius is gone when the shape got disposed.
_shapeRadius = shape.getRadius();
fixtureDef.shape = shape;
}