Hi guys I hope you are all healthy and well. Im working on my project and need help understanding how the axis values are calculated for a given motion, like when we move our thumb into a certain angle.
To give an actual use case / illustrate what I want to calculate I made a picture with two arrows:
How would you calculate the correct X and Y values for a given angle?
Like in the example arrow 1) which X-Y vlaues would represent a 60° thumb motion?
Or 2) which X-Y axis values would represent a 140° thumb motion?
Understanding maths behind axis values / how to calculate axis values by given angles?
Re: Understanding maths behind axis values / how to calculate axis values by given angles?
I wrote a simple program which shows current X and Y values of my controllers left stick and the angle the current current motion is representing. I noticed somewhere around 60° the X value starts to decrease until by 0° it is 0. Between like 58° and like 121° the X value is maxed. Here are some example outputs:
Max Values are between -127.996094 and 127.996094
60° motion:
90° motion:
140° motion:
Above I read actual controller X and Y values of my controller and calculated the Angle. What I want is the other way around. I want to calculate X and Y values for a given angle.
By looking at the values above I couldn't figure out the maths. I would love any input from you guys. Stay healthy and cheers!
Max Values are between -127.996094 and 127.996094
60° motion:
Code: Select all
LX: 127.996094
LY: -73.789063
L motion: 60.04
Code: Select all
LX: 127.996094
LY: 0.500000
L motion: 90.22
Code: Select all
LX: 88.843750
LY: 107.917969
L motion: 140.54
By looking at the values above I couldn't figure out the maths. I would love any input from you guys. Stay healthy and cheers!
Re: Understanding maths behind axis values / how to calculate axis values by given angles?
The maths branch you are looking for is called trigonometry: https://en.wikipedia.org/wiki/Trigonometry
Have a look at the sine and cosine functions.
Have a look at the sine and cosine functions.
GIMX creator
Re: Understanding maths behind axis values / how to calculate axis values by given angles?
Topic moved to discussion section.
GIMX creator
Re: Understanding maths behind axis values / how to calculate axis values by given angles?
I've looked into sine and cosine functions and tried to calculate the controller X and Y values for a given angle / motion.
Example calculation:
* angle / motion: 140
* 140° in radians: 2.44
* max axis values: 128
* LX = 128 * cos(2.44) = -97.768345866
* LY = 128 * sin(2.44) = 82.6156797868
Unfortunately I seem to miss something since actual controller inputs in gimx show different x-y values than my calculation.
Could you please help?
Example calculation:
* angle / motion: 140
* 140° in radians: 2.44
* max axis values: 128
* LX = 128 * cos(2.44) = -97.768345866
* LY = 128 * sin(2.44) = 82.6156797868
Unfortunately I seem to miss something since actual controller inputs in gimx show different x-y values than my calculation.
Could you please help?
Re: Understanding maths behind axis values / how to calculate axis values by given angles?
GIMX is free and open source software. The main function for mouse translation is here: https://github.com/matlo/GIMX/blob/mast ... ig.c#L1186
Sadly I'm way too busy to help you more on the matter.
Sadly I'm way too busy to help you more on the matter.
GIMX creator