3Д БУМ

3Д принтеры и всё что с ними связано

SLERP (Spherical Linear Interpolation)

Spherical linear interpolation is not all that hard either. The only thing you have to watch out for is making sure you take the shortest route. If you look at Figure 2.9 again, you will see that you could go the short way,

~ГГ^Э-

as the figure shows, or you could go back around the long way. Most things would look pretty funny if you chose to interpolate the long way.

Taking the long route would be like turning right at an intersection by turning left for three quarters of a turn and then turning right. Imagine how strange that would look to a bystander. You can make sure it always takes the shortest arc by checking the dot product of the two quater­nions, and negating one if necessary. See the code on the included CD for details; you will find it in the /Code/Math and Code/Chapter2 directories in the files quaternion. h and quaternion. inl. On to the SLERP formula!

Figure 2.11 shows you how to SLERP between two quaternions. Again, t is a value between zero and one.

SLERP(q, p,t) = ^

Figure 2.11 The formula for using interpolating between two quaternions using the SLERP method. Unlike LERP, where the resulting path will be a line, the resulting path of SLERP is an arc.

Для любых предложений по сайту: [email protected]