Write a function that takes 3 arguments: control_points: a list of points that serves as a control alignment in the XY plane
test_points: a list of points that are to be examined
tolerance: the max distance any point can be offset from the control alignment
Signature: (
IndexPoints control_points test_points tolerance)
Return value: A list of integers representing the ordered position of the test_points. Points that
fall outside the tolerance should not be indexed. Use base 0 per the
nth LISP
function.
Objective: Using the points represented by variable
control_points, compare each point hosted
by the
test_points variable. If the point is on the alignment, or is within the distance
represented by the
precision variable, return its order position relative to the
control_points data; base 0. That is, the point closest to the first control point would have a position value
of 0, the next 1, the next 2 and so on.
Note 1: The comparisons detailed above are to be performed by projecting to a common XY plane,
so if the function is passed 3D points it will still perform the task.
Note 2: Duplicate data should not be discarded. For example, if three points are equidistant from a
control point
and are within the tolerance corridor then the three points should be indexed.
For example, given control points of: '(
(00.0 40.0)
(20.0 40.0)
(20.0 00.0)
(35.0 00.0)
(35.0 20.0)
(55.0 20.0)
)
Test points of: '(
(17.7 20.1)
(35.0 15.3)
(05.4 39.2)
(20.9 32.7)
(20.9 17.9)
(37.1 10.4)
(18.8 09.8)
(27.2 00.2)
(21.6 07.8)
(21.0 02.5)
(39.2 20.0)
(35.8 07.3)
(22.0 28.1)
(30.1 00.0)
(07.7 40.7)
(25.2 00.4)
(10.3 42.2)
(34.5 02.9)
(42.5 21.3)
(49.8 18.4)
(18.5 35.9)
(51.1 20.0)
(11.9 40.0)
(53.3 20.9)
)
And a tolerance of: 1.0
The result should be: (
2
14
22
3
4
9
15
7
13
17
11
1
10
21
23
)
Note that the following highlighted values were not indexed because they breached the tolerance value: (
(17.7 20.1) index: 0 * (35.0 15.3) 1
(05.4 39.2) 2
(20.9 32.7) 3
(20.9 17.9) 4
(37.1 10.4) 5 *
(18.8 09.8) 6 * (27.2 00.2) 7
(21.6 07.8) 8 * (21.0 02.5) 9
(39.2 20.0) 10
(35.8 07.3) 11
(22.0 28.1) 12 * (30.1 00.0) 13
(07.7 40.7) 14
(25.2 00.4) 15
(10.3 42.2) 16 * (34.5 02.9) 17
(42.5 21.3) 18 *
(49.8 18.4) 19 *
(18.5 35.9) 20 * (51.1 20.0) 21
(11.9 40.0) 22
(53.3 20.9) 23
)
Some imagery to illuminate: Control points represented by green, test points by red and points that exceed the
tolerance gray respectively. Red points to be numbered according to their distance
from point <1> along the alignment established by points 1 thru 6. Distances used
for ordering should reflect the distance from the control point to the equivalent test
point along the center line. See image below for clarity.
Tolerance detail, light gray area represents the limits of the tolerance. Distance for
any red point from the green point to be measured along the center line.
Let me know if I've not provided enough detail, lol.
Cheers, Michael.