|
CPlotView:FindPoint
The Find method returns the index of the
point in the class data matrix nearest a target coordinate.
Syntax
|
index = CPlotView:FindPoint( x, y )
|
x,y is the target coordinate.
index is the index of the nearest point, beginning
at 1.
On success,
index > 0 is returned.
On failure, 0
is returned.
Remarks
This method finds the point in the class data
matrix that is nearest the specified coordinate. Typically, this
method is used to find a point when the index returned by
Add is unknown or after the data points have been
shuffled.
This method corrects for the fact that the x and y
scales may differ. The point returned is geometrically closest to
the target point if the points were plotted with the scale equal in
both axes.
Example
The following script finds the closest points to an
x,y target position:
|
V = new_plotview()
|
|
|
V:Add( 22.52, 70.5, 3, 12)
|
|
|
V:Add( 23.52, 150.5, 5, 8)
|
|
|
V:Add( 18.2, 100, 2.5)
|
|
|
n = V:FindPoint( 19,
148)
|
|
|
Printf("n = %d", n)
|
|
Related Topics
CPlotView class
Add
Mira Pro x64 Script User's Guide, v.8.76 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.
|