Jump to content
Sign in to follow this  
FuryCell

_Distance()

Recommended Posts

Just a quick scrap that calculates the distance between two points. It can be used to calculate the distance between two elements on the screen. Using it is pretty self explanatory.

Func _Distance($iX1, $iY1, $iX2, $iY2)
    Return Sqrt(($iX1 - $iX2) ^ 2 + ($iY1 - $iY2) ^ 2)
EndFunc  ;==>_Distance

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

This is the easest idea ever i learned it in grade 3. :whistle:;):P;):D:idea:

you learned about roots and powers in 3rd grade??

@SolidSnake..

Cool, now you should do one for 3D. lol

Func _Distance3($Vertex1, $Vertex2)
;Do your stuff here
$x1 = $Vertex1[0]
$y1 = $Vertex1[1]
$z1 = $Vertex1[2]

$x2 = $Vertex2[0]
$y2 = $Vertex2[1]
$z2 = $Vertex2[2]
EndFunc
Edited by CHRIS95219

Share this post


Link to post
Share on other sites

The word is vector. A vector is also a corner in a geometric shape.

Vectors consist of the standard X and Y, but also a Z coordinate as well. I wonder what good 3D calculations are in AutoIt though.

Trying to calculate the distance between two 3D points is a little more complicated.

Share this post


Link to post
Share on other sites

A Victor is a point in a rendered 3D world. :whistle:;):P

It's called a vector , not victor. ;):D:idea:

Edit: too slow

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

The word is vector. A vector is also a corner in a geometric shape.

Vectors consist of the standard X and Y, but also a Z coordinate as well. I wonder what good 3D calculations are in AutoIt though.

Trying to calculate the distance between two 3D points is a little more complicated.

Check out my 3D library. Link. I'm willing to create a _Distance3D function if anyone has a need for it.

Share this post


Link to post
Share on other sites

Check out my 3D library. Link. I'm willing to create a _Distance3D function if anyone has a need for it.

as Wus already said, just add the 3rd dimension to the function and your done....


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...