Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // update force vector arrows
- for (int i = 0; i < NUM_SPHERES; i++){
- cVector3d newPoint = cAdd(spheres[i]->getLocalPos(), sphereFce[i]);
- cVector3d newPointNormalized;
- sphereFce[i].normalizer(newPointNormalized);
- velVectors[i]->m_pointA = cAdd(spheres[i]->getLocalPos(), newPointNormalized * spheres[i]->getRadius());
- velVectors[i]->m_pointB = cAdd(velVectors[i]->m_pointA, sphereFce[i] * .05);
- velVectors[i]->setLineWidth(5);
- // Change color, red if current, black otherwise
- if (i == curr_atom) {
- velVectors[i]->m_colorPointA.setRed();
- velVectors[i]->m_colorPointB.setRed();
- } else {
- velVectors[i]->m_colorPointA.setBlack();
- velVectors[i]->m_colorPointB.setBlack();
- }
- // Change size based on threshold?
- float dist = velVectors[i]->m_pointA.distance(velVectors[i]->m_pointB);
- if (dist >= .05 ){
- velVectors[i]->m_pointB = cAdd(velVectors[i]->m_pointA, newPointNormalized * .05);
- }
- // TODO - use distance to set some kind of threshold that will scale down any large lines
- // code below is a remmant from using velocity
- /*
- if (i == curr_atom) {
- velVectors[i]->m_pointB = cAdd(spheres[i]->getLocalPos(), linearVelocity);
- } else {
- velVectors[i]->m_pointB = cAdd(spheres[i]->getLocalPos(), sphereFce[i]);
- //velVectors[i]->m_pointB = cAdd(spheres[i]->getLocalPos(),
- // sphereVel[i] * -500);
- } */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement