|
-
Jan 7th, 2005, 05:32 AM
#1
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.
-
Jan 7th, 2005, 03:13 PM
#2
Thread Starter
PowerPoster
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
-
Jan 7th, 2005, 04:07 PM
#3
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!
-
Jan 7th, 2005, 06:32 PM
#4
Thread Starter
PowerPoster
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
-
Jan 8th, 2005, 03:41 PM
#5
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:
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!
-
Jan 8th, 2005, 06:07 PM
#6
Thread Starter
PowerPoster
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
-
Jan 9th, 2005, 07:17 AM
#7
Re: Radian LookUp Table
 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|