Jump to content

Distance2D

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: Distance2D
Function Description: Calculates the 2D distance between two points using x and y or x and z coordinates, returning the magnitude of the vector difference.
File Location: cmm.positionFunctions.lua
Syntax: CMM.Distance2D( table vecA , table vecB )
Return Value: number or nil
Parameters: Name Description
vecA{x <number>, y <number> or z <number>} – first point, must have x and either y or z.
vecB{x <number>, y <number> or z <number>} – second point, must have x and either y or z.
Example: CMM.Distance2D({x=10, z=20}, {x=30, z=40})
Example Description: Computes the 2D distance between two points using x and z coordinates, returning the magnitude of the vector difference.
Related Functions:
Notes: