-
Notifications
You must be signed in to change notification settings - Fork 1
Sqrdist
mtbeek32 edited this page Feb 1, 2024
·
7 revisions
Geometric functions sq(ua)r(e)dist(ance)
- sqrdist(destination, origin)
sqrdist(destination, origin) calculates the square distance (as the crow flies) between origin and destination points of the same domain unit.
The resulting data item has a float32 value type without metric. Use the value function to convert the result to the requested values unit.
The sqrdist calculates faster than the dist function and can be used if only the distance order is relevant.
- destination and origin are data items with Point value type
The values unit and domain unit of the destination and origin arguments must match.
attribute<m2> sqrdistOD (ADomain) := value(sqrdist(destination, origin), m2);
destination | origin | sqrdistOD |
---|---|---|
{401331, 115135} | {401331, 115135} | 0 |
{399501, 111793} | {399476, 111803} | 725 |
{399339, 114883} | {399289, 114903} | 2900 |
{401804, 111323} | {401729, 111353} | 6525 |
{398796, 111701} | {398696, 111741} | 11600 |
ADomain, nr of rows = 5
GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.