math/Dist

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Merging with old math/Distance)
Line 29: Line 29:
 
|type=number
 
|type=number
 
|desc=Difference
 
|desc=Difference
 +
}}
 +
{{Example
 +
|Description=Demonstrates the use of this function.
 +
|Code=print( math.Distance( 1, 2, 5, 6 ) ) -- distance bet
 +
|Output=5.6568542494924
 
}}
 
}}

Revision as of 12:43, 4 June 2013

 math.Dist( )

Contents

Description

Returns the difference between two points in 2D space

Arguments

number x1

X position of first point

Arguments

number y1

Y position of first point

Arguments

number x2

X position of second point

Arguments

number y2

Y position of second point

Returns

number

Difference

Examples

Example

Demonstrates the use of this function.

print( math.Distance( 1, 2, 5, 6 ) ) -- distance bet

Output:

5.6568542494924
Personal tools
Navigation