Efficiency and Optimization

We have already seen that we can reduce the final application of the transformation matrix to 4 * and 4 +. We can make approximations to further reduce this.

For rapid animation - rotation

x' = x cos q - y sin q -> 4* & 2 +
y' = y cos q + x sin q

If q small then cos q is close to 1 then can do ( 2* & 2+):

(1)
x' = x - y sin q
y' = x sin q + y

A better approximation is:

(2)
x' = x - y sin q
y' = x' sin q + y

This is better because the determinant of the corresponding matrix = 1, which is true for all rotations but not true for (1). Look at computed results for above for q = 1, xo = 1.0, and yo = 1.0:

  Nrot    x(1)     y (1)      x(2)        y(2)
 
  360    1.057     1.055    1.00824      .999756  

  3600   1.75      1.72     1.0024       .99756  
 

Note: the coordinates will eventually will "blow up" so we must save old coordinates and periodically restore them.


Main 2D modeling page
HyperGraph Table of Contents.
HyperGraph Home page.

Last changed June 02, 1999, G. Scott Owen, owen@siggraph.org