distanceSqr: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>") |
Lou Montana (talk | contribs) m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>") |
||
Line 16: | Line 16: | ||
|r1= [[Number]] Distance in meters or 1e10 if distance cannot be calculated | |r1= [[Number]] Distance in meters or 1e10 if distance cannot be calculated | ||
|x1= < | |x1= <sqf>player distanceSqr (leader player)</sqf> | ||
|x2= < | |x2= <sqf>_distance = sqrt ((x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2); | ||
_distanceSqr = (x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2; | _distanceSqr = (x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2; | ||
_distance = [x1, y1, z1] distance [x2, y2, z2]; | _distance = [x1, y1, z1] distance [x2, y2, z2]; | ||
_distanceSqr = [x1, y1, z1] distanceSqr [x2, y2, z2]; | _distanceSqr = [x1, y1, z1] distanceSqr [x2, y2, z2]; | ||
_distance = sqrt ([x1, y1, z1] distanceSqr [x2, y2, z2]); | _distance = sqrt ([x1, y1, z1] distanceSqr [x2, y2, z2]); | ||
_distanceSqr = ([x1, y1, z1] distance [x2, y2, z2]) ^ 2;</ | _distanceSqr = ([x1, y1, z1] distance [x2, y2, z2]) ^ 2;</sqf> | ||
If normal distance is calculated according to this formula: | If normal distance is calculated according to this formula: |
Revision as of 10:22, 13 May 2022
Description
- Description:
- Computes the squared distance between two objects or positions.
- Groups:
- Math - Geometry
Syntax
- Syntax:
- var1 distanceSqr var2
- Parameters:
- var1: Object or Position
- var2: Object or Position
- Return Value:
- Number Distance in meters or 1e10 if distance cannot be calculated
Examples
- Example 1:
- Example 2:
- If normal distance is calculated according to this formula: squared distance is calculated according to this formula: distanceSqr =_distance = sqrt ((x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2); _distanceSqr = (x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2; _distance = [x1, y1, z1] distance [x2, y2, z2]; _distanceSqr = [x1, y1, z1] distanceSqr [x2, y2, z2]; _distance = sqrt ([x1, y1, z1] distanceSqr [x2, y2, z2]); _distanceSqr = ([x1, y1, z1] distance [x2, y2, z2]) ^ 2;
Additional Information
- See also:
- distance vectorDistanceSqr distance2D
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note