public static final float fastAtan2(float y, float x) { if (x == 0.0f) { if (y > 0.0f) return HALF_PI; if (y == 0.0f) return 0.0f; return -HALF_PI; } float atan; final float z = y / x; if (abs(z) < 1.0f) { atan = z / (1.0f + 0.28f * z * z); if (x < 0.0f) { if (y < 0.0f) return atan - PI; return atan + PI; } } else { atan = HALF_PI - z / (z * z + 0.28f); if (y < 0.0f) return atan - PI; } return atan; }
@Override public int getMaxBalance() { int maxBalance = 0; for (int i = 0; i < m_nodeCapacity; ++i) { if (m_height[i] <= 1) { continue; } assert (m_child1[i] != NULL_NODE); int child1 = m_child1[i]; int child2 = m_child2[i]; int balance = MathUtils.abs(m_height[child2] - m_height[child1]); maxBalance = MathUtils.max(maxBalance, balance); } return maxBalance; }
@Override public int getMaxBalance() { int maxBalance = 0; for (int i = 0; i < m_nodeCapacity; ++i) { final DynamicTreeNode node = m_nodes[i]; if (node.height <= 1) { continue; } assert (node.child1 == null == false); DynamicTreeNode child1 = node.child1; DynamicTreeNode child2 = node.child2; int balance = MathUtils.abs(child2.height - child1.height); maxBalance = MathUtils.max(maxBalance, balance); } return maxBalance; }
C1.y = aB - aA - m_referenceAngle; float linearError = MathUtils.abs(C1.x); float angularError = MathUtils.abs(C1.y); if (m_enableLimit) { float translation = Vec2.dot(axis, d); if (MathUtils.abs(m_upperTranslation - m_lowerTranslation) < 2.0f * Settings.linearSlop) { linearError = MathUtils.max(linearError, MathUtils.abs(translation)); active = true; } else if (translation <= m_lowerTranslation) {
pool.pushRot(2); return MathUtils.abs(C) < Settings.linearSlop;
if (MathUtils.abs(m_upperAngle - m_lowerAngle) < 2.0f * Settings.angularSlop) { m_limitState = LimitState.EQUAL; } else if (jointAngle <= m_lowerAngle) {
return MathUtils.abs(C) <= Settings.linearSlop;
Settings.maxAngularCorrection); limitImpulse = -m_motorMass * C; angularError = MathUtils.abs(C); } else if (m_limitState == LimitState.AT_LOWER) { float C = angle - m_lowerAngle;
float linearError = MathUtils.abs(C);
angularError = MathUtils.abs(C2);
if (MathUtils.abs(m_upperTranslation - m_lowerTranslation) < 2.0f * Settings.linearSlop) { m_limitState = LimitState.EQUAL; } else if (jointTranslation <= m_lowerTranslation) {