void GUISUMOAbstractView::showToolTipFor(unsigned int id) { if (id != 0) { GUIGlObject* object = GUIGlObjectStorage::gIDStorage.getObjectBlocking(id); if (object != 0) { Position pos = getPositionInformation(); pos.add(0, p2m(15)); GLHelper::drawTextBox(object->getFullName(), pos, GLO_MAX - 1, p2m(20), RGBColor::BLACK, RGBColor(255, 179, 0, 255)); GUIGlObjectStorage::gIDStorage.unblockObject(id); } } }
int main (int argc, char **argv) { AranDevelopment3d *one, *other; int ret = 0; gcomplex128 zres, zref; aran_init(); parse_args (argc, argv); one = aran_development3d_new (0, order); other = aran_development3d_new (order, 0); aran_development3d_set_zero (one); aran_development3d_set_zero (other); p2m (&points[0], ¢ers[0], one); zres = aran_development3d_multipole_evaluate (¢ers[0], one, &points[1].vector); zref = kernel (&points[0], &points[1]); if (cabs (zref-zres) > epsilon) { g_printerr ("Direct multipole error (%e + i%e) (%e + i%e)\n", creal(zref), cimag (zref), creal(zres), cimag (zres)); } aran_development3d_m2l (¢ers[0], one, ¢ers[1], other); zres = aran_development3d_local_evaluate (¢ers[1], other, &points[1].vector); if (cabs (zref-zres) > epsilon) { g_printerr ("Multipole to local error (%e + i%e) (%e + i%e)\n", creal(zref), cimag (zref), creal(zres), cimag (zres)); } aran_development3d_free (one); aran_development3d_free (other); return ret; }
void Physics::PointTriangleSelfConstraint::Solve(int iterationCount) { glm::vec3 q = m_points[0]->m_projection; glm::vec3 p1 = m_points[1]->m_projection; glm::vec3 p2 = m_points[2]->m_projection; glm::vec3 p3 = m_points[3]->m_projection; float wq = m_points[0]->m_invMass; float w1 = m_points[1]->m_invMass; float w2 = m_points[2]->m_invMass; float w3 = m_points[3]->m_invMass; glm::vec3 v1, v2; float dot = glm::dot(glm::normalize(q), glm::normalize(glm::cross(p2 - p1, p3 - p1))); if (dot >= 0) { v1 = p2 - p1; v2 = p3 - p1; } else { v1 = p3 - p1; v2 = p2 - p1; } glm::vec3 qp1 = q - p1; float constraintValue = glm::dot(qp1, glm::normalize(glm::cross(v1, v2))) - m_h; if (constraintValue >= 0) return; glm::vec3 derivQ, derivP1, derivP2, derivP3; glm::vec3 n; n = glm::normalize(glm::cross(v1, v2)); // n aici derivQ = n; glm::mat3 p2m(glm::vec3(0, p2.z, -p2.y), glm::vec3(-p2.z, 0, p2.x), glm::vec3(p2.y, -p2.x, 0)); glm::mat3 p3m(glm::vec3(0, p3.z, -p3.y), glm::vec3(-p3.z, 0, p3.x), glm::vec3(p3.y, -p3.x, 0)); if (dot >= 0) { //derivP1 = -n + qp1 * (glm::cross(v1, minusOneVec) + glm::cross(minusOneVec, v2)) * term; derivP2 = q * (-p3m + glm::dot(n, glm::cross(n, p3))) / glm::length(glm::cross(p2, p3)); derivP3 = -q * (-p2m + glm::dot(n, glm::cross(n, p2))) / glm::length(glm::cross(p2, p3)); } else { //derivP1 = -n + qp1 * (glm::cross(minusOneVec, v2) + glm::cross(v1, minusOneVec)) * term; derivP2 = q * (-p2m + glm::dot(n, glm::cross(n, p2))) / glm::length(glm::cross(p3, p2)); derivP3 = -q * (-p3m + glm::dot(n, glm::cross(n, p3))) / glm::length(glm::cross(p3, p2)); } derivP1 = -derivQ - derivP2 - derivP3; float lenDQ = glm::length(derivQ); float lenDP1 = glm::length(derivP1); float lenDP2 = glm::length(derivP2); float lenDP3 = glm::length(derivP3); float kp = 1 - std::powf(1 - m_stiffness, 1.f / iterationCount); float scalingFactor = kp * constraintValue / (wq * lenDQ * lenDQ + w1 * lenDP1 * lenDP1 + w2 * lenDP2 * lenDP2 + w3 * lenDP3 * lenDP3); glm::vec3 correction1 = -scalingFactor * wq * derivQ; glm::vec3 correction2 = -scalingFactor * w1 * derivP1; glm::vec3 correction3 = -scalingFactor * w2 * derivP2; glm::vec3 correction4 = -scalingFactor * w3 * derivP3; if (glm::length(correction1) > EPS) m_points[0]->m_projection += correction1; if (glm::length(correction2) > EPS) m_points[1]->m_projection += correction2; if (glm::length(correction3) > EPS) m_points[2]->m_projection += correction3; if (glm::length(correction4) > EPS) m_points[3]->m_projection += correction4; }