Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jzela

Basic Math Question

This topic is 5291 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you need to take the length between the front a rear axles into account.


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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!