Graphics Programs Reference
In-Depth Information
t=Table[ArcTan[2.^{-i}], {i,0,15}]; (* arctans in radians *)
d=1; x=2.1; y=0.34; z=46. Degree;
Do[{Print[i,", ",x,", ",y,", ",z,", ",d],
xn=x+y d 2^{-i}, yn=y-x d 2^{-i},
zn=z-d t[[i+1]], d=Sign[zn], x=xn, y=yn, z=zn}, {i,0,14}]
Print[0.60725x,", ",0.60725y]
Figure 1.13: Mathematica Code for CORDIC Rotations.
Exercise 1.30: Instead of using the complex CORDIC method, wouldn't it be simpler
to perform a rotation by a direct use of Equation (1.17)? After all, this only requires
the calculation of one sine and one cosine values.
1.2.5 Similarities
A similarity is a transformation that scales all distances by a fixed factor. It is easy to
show that a similarity is produced by the special transformation matrix
ac 0
.
ca 0
mn 1
To show this, we observe that translations preserve distances, so we can ignore
the translation part of the matrix above and restrict ourselves to the matrix ac
−ca .It
transforms a point P =( x, y )tothepoint P =( x ,y )=( ax
cy, cx + ay ). Given
the two transformations P 1 P 1
and P 2 P 2 , it is straightforward to illustrate the
relation
distance 2 ( P 1 P 2 )= x ) 2 +(Δ y ) 2
=[( ax 2
cy 1 )] 2 +[( cx 2 + ay 2 )
( cx 1 + ay 1 )] 2
cy 2 )
( ax 1
c Δ y ) 2 +( c Δ x + a Δ y ) 2
=( a Δ x
= a 2 Δ x 2
2 a Δ xc Δ y + c 2 Δ y 2 + c 2 Δ x 2 +2 c Δ xa Δ y + a 2 Δ y 2
=( a 2 + c 2 )(Δ x 2 y 2 )
=( a 2 + c 2 ) distance 2 ( P 1 P 2 ) ,
implying that distan ce ( P 1 P 2 )= a 2 + c 2 distance ( P 1 P 2 ). Thus, all distances are
scaled by a factor of a 2 + c 2 .
In general, a similarity is a transformation of the form P =( x ,y )=( ax
cy +
( cx + ay )+ n ), where the ratio of expansion (or shrinking) is k = a 2 + c 2 .If k is
positive, the similarity is called direct ;if k is negative, the similarity is opposite .
m,
±
Exercise 1.31: Discuss the case k =0.
 
Search WWH ::




Custom Search