本文整理汇总了Java中com.badlogic.gdx.physics.box2d.Transform.mul方法的典型用法代码示例。如果您正苦于以下问题:Java Transform.mul方法的具体用法?Java Transform.mul怎么用?Java Transform.mul使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.box2d.Transform
的用法示例。
在下文中一共展示了Transform.mul方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ComputeSubmergedArea
import com.badlogic.gdx.physics.box2d.Transform; //导入方法依赖的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.Transform; //导入方法依赖的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;
}