Results 1 to 5 of 5

Thread: Ordering points

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    513

    Ordering points

    Hello: I'm working on an windows app in vb 2005 and it incorporates an autocad api.

    My program is placing points in the center of polyline objects that look like letters. (see pic - the points are represented as the small squares).

    I need to connect the points; however, in the collection that contains these points, they are not in any paticular order.

    One idea I have it to try to find the point that is closest to another point; however, If I have an object that resembles the letter "W", there's the possibility that it will find another point closer that's not in the order that visually looks correct.

    I was wondering if anyone has any ideas?

    Thanks for your help,
    Proctor
    Attached Images Attached Images  

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Ordering points

    I assume that your example is just an example, so perhaps you could elaborate a bit more on what the real bounds of the problem are. After all, in the example you have given, a single straight line would connect all of those dots, and that line is a vertical line through the X coordinate of any of the points. So, for that example, you could sort by the Y coordinate and it would suffice. I assume that such a simplistic solution won't work for the real problem, so there must be more to it.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    513

    Re: Ordering points

    Hi Shaggy Hiker - thanks for your reply. Yes, there's more for sure....in the above example, I'm getting points for the centerline of the letter "I" however, this program will be detecting the centerline of any letter and in addition to that, each letter could be any font. (but they will be polyline objects). For example, the program might detecting the centerline for the letter "C" or the letter "B". The points that form the centerlines for these letters will not be linear. I hope that helps (sorry for not explaining in more detail).

    Proctor

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Ordering points

    Ah, I couldn't see the forest for the trees. I wasn't looking at the overall shape, just the lines within it (which didn't look like any particular letter, but it could have been a bunch of Ws on their sides).

    I do see the issue, now, as it is clear that just examining the points won't suffice. My first thought was to ask whether you had information about the lines, but that's actually quite irrelevant. Where I was going with that wouldn't work for many letters such as f and t.

    The only way that I see that looks promising is to come up with a form of pattern recognition to figure out which letter it is, and have a set of rules for each letter (though they would often be the same). This might work, assuming the font is always the same. You might look for vertical runs and horizontal runs. Since letters tend to be made up of lots of vertical runs, that might give you a series of line segments, and the relationship between them may be sufficient to identify the letter, which may be sufficient to let you know how to connect the other dots.

    Just a thought, though.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    513

    Re: Ordering points

    It's a tough problem for sure. Actually, the letters can be any fonts....so that does deepen the problem; however, I could ask the user to enter the letters so that the system knows what they are. Even if the fonts are different, they should all have generally the same shape and that might help.

    I appreciate the idea....

    Proctor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width