WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how can I make a smooth theremin?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie
View previous topic :: View next topic  
Author Message
ventalator



Joined: 05 Apr 2007
Posts: 2

Digg It
PostPosted: Thu Apr 05, 2007 2:34 pm    Post subject:

I was wondering if anyone has any idea of the algorithm/equation used in GlovePIE's MapRange function?

It's driving me nuts cause i'm trying to use it to replicate the SoundAngle script in C# (which i've got working) but i've realised that my crapy algorithm only works when i'm mapping an angle between -90 and 90 to a range of 13-100... So obviously i'd like my function to be as robust as Carl's :p

Any help would be much appreciated.
Back to top
View user's profile Send private message
TiagoTiago



Joined: 20 Jan 2007
Posts: 710
Location: Brasil

Digg It
PostPosted: Thu Apr 05, 2007 6:59 pm    Post subject:

I believe maprange does just some simple math, somthign like


Code:
var.newvalue = maprange(wiimote1.pitch, -90,90,13, 100)


would be more or less like

Code:
var.orimin = -90
var.orimax = 90
var.newmin = 13
var.newmax = 100

var.newvalue = (((wiimote1.pitch + (0 - var.orimin)) / (var.orimax-var.orimin)) * (var.newmax-var.newmin)) + var.newmin

_________________
please put the scripts on the wiki so they dont get lost as new stuff is posted!
phpBB doesnt like me,somtimes it will forget to warn me about new replies to threads I asked it to,if you see a thread I should have responded, could please email me?


Last edited by TiagoTiago on Sat Apr 07, 2007 2:38 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail
ventalator



Joined: 05 Apr 2007
Posts: 2

Digg It
PostPosted: Sat Apr 07, 2007 6:22 am    Post subject:

Really appreciate that TiagoTiago, that works perfectly.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> GlovePie All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group