Jump to content

GetDistance2D

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: GetDistance2D
Function Description: Calculates the Euclidean distance between two 2D points using their x and y coordinates, returning the straight-line distance in meters.
File Location: cmm.positionFunctions.lua
Syntax: CMM.GetDistance2D( number xPoint1 , number yPoint1 , number xPoint2 , number yPoint2 )
Return Value: number
Parameters: Name Description
xPoint1X-coordinate of the first point.
yPoint1Y-coordinate of the first point.
xPoint2X-coordinate of the second point.
yPoint2Y-coordinate of the second point.
Example: CMM.GetDistance2D(0, 0, 3, 4)
Example Description: Computes the distance between points (0, 0) and (3, 4), returning 5.0.
Related Functions:
Notes: