RANK is the sorting
key used to sort multiple chains that have a common node by their
angle, starting from 0 at due east and proceeding counterclockwise.
A node can be either of the two end-points of a chain.
RANK values have the
form
ffffff.tttttt, where the
ffffff value
is used to sort the chain around its from-node and the
tttttt value
is used to sort the chain around its to-node. The
ffffff and
tttttt components
are calculated using the following formula:
where
R
is the calculated ranking
factor.
Q
is the quadrant number
(1 to 4) that contains the angle α for the chain.
See Quadrant Numbers for details
of the quadrant numbers.
For the
ffffff component,
α is defined by the vector F→D
0,
where F is the from-node and D
0 is the first
detail point. For chains that have no detail points, D
0 is
the to-node. For the
tttttt component,
α is defined by the vector T→D
L,
where T is the to-node and D
L is the last detail
point. For chains that have no detail points, D
L is
the from-node.
A
is the angle from the
chain clockwise to the nearest X or Y axis. The angle is determined
with
![formula for chain angles](images/apdatgis-chainrank-deqn1.png)
where α is the clockwise angle from the chain
to the positive x-axis (due east).
The tangent term is
called the half-angle tangent. Because the angle A/2 can never exceed
π/4 (45 degrees), the half-angle tangent has values from 0 to
1. The (Q-1) multiplier adjusts the range of values to 0 to 4. The
values 0, 1, 2, 3, and 4 represent angles of 0, 90, 180, 270, and
just under 360 degrees, respectively.
The 1E5 multiplier is
used to transform decimal rank values to integers. Thus, the rank
values for a chain have six significant digits.
Note: The trigonometric functions
are in radians.