Not logged in, Join Here! or Log In Below:   News Articles
Search       Home / 3D Theory & Graphics / Particle Repulsion
Account Manager  March 08, 2005, 03:27 AM   I am searching for
the solution of the next problem, but i dont see it. I wanna
move particles across a mesh. A particle P can move outside his
original polygon A. Now I have to rotate P around the common
edge E of polygon B and A. Polygon B is the neighbour of A that
is closest to Particle P. How do I calculate the rotation axis
and rotation angle? Can anyone put me on the right way. Thanks.
Now i do the following in pseudocode:    2. Vector3D p0=Edge[0];
3. Vector3D p1=Edge[1];   4. Vector3d axis;   5.
axis.crossproduct(p0-Particle.position, p1-Particle.position);
6. axis.normalize();   7. float rotAngle=dotproduct(PolA.normal,
polB.normal);   9. Quaternion q;   10. q.setFromRotation(axis,
rotAngle);   11. Vector3D new=q.rotate(Particle.position);   14.
void Quaternion::setFromRotation(const Vector3D& axis, float
angle)   15. {   16.      