Jon Gordner wrote:
> Cult of Nurse's wrote in message news:<3F2FF798.8030509@health.com>...
>
>>Jon Gordner wrote:
>>
>>>Hi,
>>>
>>>I'm trying to create a sort of lasso tool VI. Something that you can
>>>select a certain area of a graph. The way I am going about this, is
>>>getting the picture of the graph, opening it in a picture control, and
>>>now am currently trying to find the best way to draw on the picture.
>>>Right now, i am drawing individual points and am trying to detect an
>>>overlap in the points drawn. However, since the method I'm using to
>>>draw doesn't draw on every single point and only a series of
>>>unconnected dots, detection of overlap is rather inaccurate. Does
>>>anybody know of a VI that allows you to draw on a picture control or
>>>on a graph control? Or does anybody know of an existing lasso VI?
>>>
>>>Thanks,
>>>
>>>Jon
>>
>>I suppose I call it a 'rubber banding'.
>>
>>Start with a reference to the picture with the graph displayed.
>>
>>In a loop, redraw a rectangle onto the picture as the mouse moves
>>(use the original reference each time the rectangle is drawn),
>>until the button is released, then process the 'selection'. This, and a
>>circular selection are about the simplest cases. Irregular regions sould
>>be made up of line segment, the selected region determined in a raster
>>scan means.
>
>
>
> what do you mean, "raster scan means"?
>
> Thanks,
> Jon
If the selection shape is a box then it is easy to tell which pixels are
selected, it's defined by the four corners of the box, or actually the
equations of vertical and horizontal lines. Lets say the selection shape
is defined by an octagon. In order to tell what pixels are selected you
start at the top by determining the minimum y coordinate of the
selection shape. This defines either a line if the top edge of the shape
is parallel to the x axis, or a point in case the octagon is spun with
respect to the x axis. For the next line down, as you begin to raster
scan, the length will be determined by the equation of two lines, etc.
As you move down line by line, the selection lasso line equations change
as the edges of the bounding shape change.