Results 1 to 21 of 21

Thread: Radian LookUp Table

Hybrid View

  1. #1
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Radian LookUp Table

    Why not just wrap an array in a function and pass a float to that and do some internal processing.

    Also: Default properties of classes can take floats as arguments (as well as anything else in fact.
    I don't live here any more.

  2. #2

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Radian LookUp Table

    Yes but:
    Vector *m_VectorCircle
    m_VectorCirlce = new Vector[360]
    m_VectorCircle[2.56] <<-- error. You HAVE to use integers when diving through arrays. You can probably bitshift or increment the points by a float...but that probably won't do you any good.
    delete [] m_VectorCircle
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  3. #3
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Radian LookUp Table

    Maybe I'm a bit easy minded, but:

    I use only degrees in my prog.
    I figured a lookup-table for every tenth of a degree gives enough accuracy.

    So I use something like:
    Create a LookUptable(array) for Sin(0 ...3599) and Cos(0 ..3599). The conversion from Rad is done in there.
    Make a Function that takes degree as input and gives the Sinus/Cosinus as output. This Function uses the lookuptable and takes care of the multiplication from 1/10 degree to 1 degree.

    So I only use a Sinus or Cosinus Function in my program that take degree as input!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  4. #4

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Radian LookUp Table

    Thats pretty what I'm doing but now I only get a 0-360 range of movement.
    Its not a bad idea.
    I suppose.


    Also to clarify with my last post.
    I believe you overload the [] operator in a class with a float.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  5. #5
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Radian LookUp Table

    Sorry forgot to mention, when calling the sinus or Cosinus function, I take degree as input, but I only use it as an integer! In my application (where I'm using 1/10 degree resolution) I do something like
    VB Code:
    1. Sinus=SinusFromLookTableUpValue (Int(Degree*10))
    the SinusFromLookupTable holds Values for each 1/10 degree.
    That way I do not overload!!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  6. #6

    Thread Starter
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Radian LookUp Table

    Thats very intelligent.

    Thanks for all the replies.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  7. #7
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Radian LookUp Table

    Quote Originally Posted by Halsafar
    Thats very intelligent.

    I wish my math-teachers would have said that, back then..........
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width