Thread: 2d Transformations : Is the following correct ?

  1. #16
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    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 .
    Last edited by manasij7479; 05-15-2012 at 01:26 PM.

  2. #17
    Registered User
    Join Date
    Nov 2010
    Long Beach, CA
    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 subscribe to a feed

Similar Threads

  1. OpenGL Transformations
    By Homunculus in forum Game Programming
    Replies: 4
    Last Post: 11-01-2011, 05:21 PM
  2. Numerical System Transformations - Lecture
    By vurdlak in forum C++ Programming
    Replies: 2
    Last Post: 03-16-2006, 08:16 AM
  3. opengl model transformations
    By curlious in forum Game Programming
    Replies: 3
    Last Post: 09-06-2004, 02:30 PM
  4. DirectX transformations
    By confuted in forum Game Programming
    Replies: 9
    Last Post: 08-02-2003, 07:41 PM