AutoHotkey Community

It is currently May 27th, 2012, 8:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: April 16th, 2011, 1:57 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
I posted this in General Chat as I am not asking for code, I just need the mathematical formula to figure out the problem.

I am two points, A and B. Given both the x and y coordinates and assuming the distance from x1 to x2 is 1P, what formula could I use to figure out the distance, in a straight line, from both points with completely different x coord's and y coord's. I figure I would need to figure the slope, but I have no idea where to go from there.

This is why I wish I paid more attention in Algebra. :/

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 16th, 2011, 2:00 am 
Offline

Joined: September 15th, 2009, 1:14 am
Posts: 562
Location: Tempe, Arizona
Eedis wrote:
I posted this in General Chat as I am not asking for code, I just need the mathematical formula to figure out the problem.

I am two points, A and B. Given both the x and y coordinates and assuming the distance from x1 to x2 is 1P, what formula could I use to figure out the distance, in a straight line, from both points with completely different x coord's and y coord's. I figure I would need to figure the slope, but I have no idea where to go from there.

This is why I wish I paid more attention in Algebra. :/


Distance formula:
Image

[Edit]For more information: I got that image above from: http://www.purplemath.com/modules/distform.htm
They usually have some good math tutorials at that site as I have used them to help tutor my friends in math along with a few others that have popped up during a google search.[/edit]

Hope this helps!

_________________
Disclaimer: I'm not an expert by any means; I just try to help out where I can.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 2:03 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
Code:
X1:=0, Y1:=0, X2:=3, Y2:=3
distance := sqrt((y2-y1)**2+(X2-X1)**2)
MsgBox % Distance " should equal the square-root of 18:`n" sqrt(18)

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 2:03 am 
Offline

Joined: June 12th, 2009, 11:36 pm
Posts: 1173
Location: Indianapolis IN, USA
Awesome, thanks, I'll have to browse this for a bit. :)

_________________
www.AutoHotkey.net/~Eedis
I love my wife and daughter so much.
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 2:12 am 
Offline

Joined: September 15th, 2009, 1:14 am
Posts: 562
Location: Tempe, Arizona
Stupid image...it worked at first, must be hotlink protected lol.

_________________
Disclaimer: I'm not an expert by any means; I just try to help out where I can.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 2:27 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
@codybear:
1.)Save image as
2.)upload to AutoHotkey.net
3.)???
4.)Profit

Image

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 4:04 am 
Offline

Joined: September 15th, 2009, 1:14 am
Posts: 562
Location: Tempe, Arizona
nimda wrote:
@codybear:
1.)Save image as
2.)upload to AutoHotkey.net
3.)???
4.)Profit

Image

hahhah. Yeah, I was trying to take the easy way out. :D

_________________
Disclaimer: I'm not an expert by any means; I just try to help out where I can.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 12:48 pm 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
It's all done within the .htaccess file. All the hotlink wizardry, that is.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2011, 6:23 pm 
Eedis wrote:
This is why I wish I paid more attention in Algebra. :/
Pythagorean Theorem & Quadratic Formula - two things my Algebra II teacher said to Never Forget :wink:


Report this post
Top
  
Reply with quote  
 Post subject: function to add
PostPosted: January 5th, 2012, 4:30 pm 
Code:
distcords(X1,Y1,X2,Y2)
   {
      Return sqrt((Y2-Y1)**2+(X2-X1)**2)
      ;~ Round(sqrt((Y2-Y1)**2+(X2-X1)**2))
      
   }


Code:
Usage:
distcords(0,0,100,100)

would return ~141.421... (the rounded version 141.421 = 141)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 5th, 2012, 5:33 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
@Eadis
Is this for land navigation?

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 12:31 am 
Offline
User avatar

Joined: October 31st, 2008, 9:39 am
Posts: 641
Location: France
@Mickers: we will use other thing for land navigation, as "Orthodromy"
http://en.wikipedia.org/wiki/Great-circle_distance
We need to use a lot trigonometry, else simple case is "Orthonormality" when "plan/map" is only in 2D and vector are in right angle and same unit length (therefore Pythagor), else only use vector formula (Chales and other)...

_________________
"You annoy me, therefore I exist."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 2:40 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
Mabye it's too early in the morning but I can't translate anything you just said... :lol:

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 5:23 pm 
Offline
User avatar

Joined: May 10th, 2007, 10:54 am
Posts: 649
Location: .switzerland
Mickers wrote:
Mabye it's too early in the morning but I can't translate anything you just said... :lol:

I think she means that for real navigation calculations, complexer math would be requiered, as the world is not flat and even not a sphere. :) Pythagoras requires a (2D) right-angled triangle.

_________________
http://securityvision.ch
AHK 2D GAME ENGINE


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 6th, 2012, 5:52 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1211
Location: Right behind you
Ok.

I just wanted to know if this was for passing Army land navigation tests which I have a lot of experience with. I was going to give any advice he may / may not need. :wink:

_________________
COM Tutorial for Webpages
COM Tutorial for Excel


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, tomoe_uehara and 7 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group