Thread: 2d Transformations : Is the following correct ?

1. I get your point.
(Though I can't use the same matrix for two consecutive transformations as the point at the maxima will generally not be at the middle.)
Still calling sin/cos twice is negligible w.r.t say.... 40-50 calls...and it was a bit of premature optimization to think otherwise.

I don't understand interpolation yet and it seems interesting, so I'd try to get its theory first, provided that it doesn't need more maths than I know or can learn in a day or two .

2. I'm not sure interpolation is worth it here. Odds are good that the math library's implementation of the sin function already uses lookup tables, interpolation, taylor series and other methods of approximating sin fairly quickly and accurately.

Interpolation is a method of approximating a value of a function at some x given the values of of the function for at two points, one less than x and the other greater than x. For example, if you knew f(3) and f(7), you could approximate f(5). A simple linear interpolation would say "5 is halfway between 3 and 7, so f(5) must be halfway between f(3) and f(7)". That is, it must be the midpoint of the line from (3, f(3)) and (7, f(7)). You can imagine that linear interpolation is only very accurate if you're interpolating on a nearly linear piece of a graph, either due to the nature of the function f, or due to having a lot of known points, making each section small and near-linear. You can do quadratic, cubic, etc interpolation for more accuracy, but at more computational cost. You can also use different methods of interpolation or approximation for different segments of your graph. For example, from 0 to pi/16 may be sufficiently linear for using linear interpolation. From pi/16 to, say, pi/8 you may want quadratic, etc. But note that finding the right quadratic function to approximate that piece of the graph well enough can be a challenge in itself.

EDIT: I'm sure you could learn the math necessary in a day or two, and think you should learn it at some point, but I'm not sure it's worth it in this specific case.

Popular pages Recent additions