Basic Math Question
This is probably a silly question to most, but I'm having difficulty figuring out what is wrong with my math here. I don't have a good math background and am sort of learning as I go from internet / books / etc.
Basically, I have a car with 4 tires and I'm trying to determine the pitch of the car from the height at each tire. Here's some pseudo-code of my current attempt:
Difference = (RearTire1Height + RearTire2Height) - (FrontTire1Height + FrontTire2Height)
CarPitch = Asin(Difference)
The resulting pitch is very exaggerated from what it should really be. I can hard code a "magic number", like:
CarPitch = Asin(Difference * .125)
and the result is very close to what I'm looking for, but I want to understand the right way to do it and the reasoning behind it. My current theory is that Asin is expecting a Sin based on a unit triangle and that my input to it should be somehow normalized (probably not using the correct terminology). But I'm not really sure....
any ideas?
thanks
[edited by - jzela on May 20, 2004 11:44:38 PM]
Sounds like you need to take the length between the front a rear axles into account.
With those sides labelled, we have B is the height different (what you calculated), and A is the length between the axles. You're looking for the angle between the two. Heard of SOHCAHTOA? It means Sin=Opp/Hyp, Cos=Adj/Hyp, Tan=Opp/Adj. In this case Hyp=A, Opp=B, and Adj=C, so:
sinθ=B/A
Thus: θ=asin(B/A)
I'm guessing you're magic number is very nearly 1/(distance between axles).
Hope that makes sense.
BTW: "My current theory is that Asin is expecting a Sin based on a unit triangle and that my input to it should be somehow normalized" is actually pretty close to the mark.
EDIT: Edits are fucking up my ASCII leetness.
[edited by - Doc on May 21, 2004 1:51:10 AM]
B |\ A |_\ C
With those sides labelled, we have B is the height different (what you calculated), and A is the length between the axles. You're looking for the angle between the two. Heard of SOHCAHTOA? It means Sin=Opp/Hyp, Cos=Adj/Hyp, Tan=Opp/Adj. In this case Hyp=A, Opp=B, and Adj=C, so:
sinθ=B/A
Thus: θ=asin(B/A)
I'm guessing you're magic number is very nearly 1/(distance between axles).
Hope that makes sense.
BTW: "My current theory is that Asin is expecting a Sin based on a unit triangle and that my input to it should be somehow normalized" is actually pretty close to the mark.
EDIT: Edits are fucking up my ASCII leetness.
[edited by - Doc on May 21, 2004 1:51:10 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement