Jump to content
  • Advertisement
Sign in to follow this  
gretty

Finding the mid point of a triangle when rotated around a specific point

This topic is 2516 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

Hello

I am attempting to find the angle of a side of a right angle triangle. And also attempting to find the mid point of a right angle triangle no matter the rotation(for a webapp I am making).

TgXMM.png
I am attempting to find the angle where the question mark is, then test that my algorithm/methodology to find the position of the mid point of a shape works(this is for my HTML5 Canvas Web App).
Is my maths correct?...

// This is half code/mathematics
? = tan-1( opposite/adjacent ); // inverse tan
? = tan-1(50/25);
? = 63.43; // is that correct??


My math algorithm below attempts to find the mid point when a shape is rotated. In my webapp I will only ever know the x,y pos & the width & height, but it will also be rotated around the x,y point which means the midpoint can be different. Is it correct?

// To find the x,y midpoint all I have to do is have
// the hypotenuse of the triangle & the angle of one
// side(the angle I found above). Is that correct?

// h stands for hypotenuse, a stands for the angle I found above
midX = cos(a)*h
midY = sin(a)*h

// so to take the example above, if I use those formulas I should get an mid x,y value of 25,12.5
midX = cos(63.4)*75;
= 33.58; // shouldn't this be 25?
midY = sin(63.4)*75;
= 67.06; // should be 12.5?

Share this post


Link to post
Share on other sites
Advertisement

This topic is 2516 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.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!