# algorithm for shape boundary growing

This topic is 4338 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everyone, I have a very urgent requirement as the whole validaity of my project depends on doing this correctly. I am a curve defined by a set of floating point numbers. So each x, y pair describes a point on the curve and the curve is created by simple joining these point pairs. Now, my probem is that the curve should snap to each pixel that it touches. So, if we consider the x part of the coordinates... then the points lying on the "left side" of the curve should round off to the lower value... So, if you have x value like 63.5 on the left side, it should become 63.0. and if you have points on the "right side" of the curve, it should round off to the upper value... So, if you have value like 130.5 on the right side, it should become 131.0 Similar logic should follow for the y values. My initial idea was to increment/decrement the values by 1.0 and see if that pixel lies in my region. If the pixel to the right lies in the region, then I take the floor of the value, else I take the ceiling. This worked for most of ther curves but every now and then I come across curves that does not work with this primitive algorithm. Also, there will be points that do not have the nearest pixel lying on the curve. I was wondering if there is an algorithm for growing a curve so that it snaps to the touched pixel... So basically it just grows like a bubble in all directions by the required amount. Is it possible to achieve something like this by looking at the derivative between 2 points? I have been thinking about this for a while now but am yet to come up with a good idea. So, I am turning to all you graphic gods out there for some inspiration :) Any leads or maybe reference to some C++/Java/ package that might do something like this would be really appreciated. Thanks for any help you might give me here. I would really appreciate it. xarg

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013744
×