Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old November 15th, 2009, 02:54 AM   #1 (permalink)
New Member
 
Join Date: Nov 2009
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to combine accelerometer values into 1

I'm developing an application which measures the accelerometer values to indicate how much the phone is being shaken. At the moment I'm just using the Z value, which works if the phone is lying flat on its back.
Is there any formula to combine x + y + z in order to give the value irrespective of the orientation of the phone?

rcasha is offline  
Reply With Quote
Sponsors
Old November 15th, 2009, 09:42 AM   #2 (permalink)
Junior Member
 
Join Date: Oct 2009
Posts: 33
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you mean what I think you mean:

If only Z it's Z.
X+Z it's: VALxz^2=X^2+Z^2
X+Y+Z it's: VALxyz^2 = VALxz^2 + Y^2



Hope that helps. Cheers.
metter is offline  
Reply With Quote
Old November 15th, 2009, 09:57 AM   #3 (permalink)
Junior Member
 
Join Date: Nov 2009
Posts: 52
 
Device(s):
Thanks: 0
Thanked 4 Times in 1 Post
Default

My answer is somewhat close to what Metter said, but if I understand your question correctly, you want to get the amount of acceleration irrespective of direction. If that is the case, the value you would be looking for is the root of the sum of the squares:

absolute value = sqrt(X^2 + Y^2 + Z^2);

See The Pythagorean Theorem for details.
DaveInNYC is offline  
Reply With Quote
Old November 15th, 2009, 09:58 AM   #4 (permalink)
New Member
 
Join Date: Nov 2009
Posts: 2
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What I mean is: "How much is the phone being shaken - whether up and down, or sideways, or diagonally, etc?"

DaveInNYC: Thanks, that's what I needed.
rcasha is offline  
Last edited by rcasha; November 15th, 2009 at 10:20 AM. Reason: thx to correct answer
Reply With Quote
Old November 15th, 2009, 12:33 PM   #5 (permalink)
Junior Member
 
Join Date: Oct 2009
Posts: 33
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

And that's exactly what I wrote. I just left you some thinking
metter is offline  
Reply With Quote
Reply

Bookmarks

Tags
accelerometer, maths


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can we show data table with dynamic values in android UI raghu462 Introductions 6 February 2nd, 2011 09:20 AM
Color Values RocknSteve Developer 101 2 January 3rd, 2011 07:24 PM
setcpu losing scaling values alaman68 EVO 4G - All Things Root 12 December 11th, 2010 11:35 PM
nil web service values andywhoa Developer 101 7 July 20th, 2010 03:20 PM
Converter app with hardness values? kst8engineer Android Applications 1 November 13th, 2009 10:32 AM



All times are GMT -5. The time now is 02:55 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo


SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.