Dealing with Imprecise Drawing in CAD Drawing

Posted by Graviton on Stack Overflow See other posts from Stack Overflow or by Graviton
Published on 2011-01-12T07:50:10Z Indexed on 2011/01/12 7:53 UTC
Read the original article Hit count: 339

Filed under:
|

I have a CAD application, that allows user to draw lines and polygons and all that.

One thorny problem that I face is user drawing can be highly imprecise, for example, a user might want to draw two rectangles that are connected to each other. Hence there should be one line shared by two rectangles. However, it's easy for user to, instead of draw a line, draw two lines that are very close to each other, so close to each other that when look from the screen, you would be mistaken that they are the same line, except that they aren't when you zoom in a little bit.

My application would require user to properly draw the lines ( or my preprocessing must be able to do auto correction), or else my internal algorithm would not be able to process the inputs correctly.

What is the best strategy to combat this kind of problem? I am thinking about rounding the point coordinates to a certain degree of precision, but although I can't exactly pinpoint the problem of this approach, but I feel that this is not the correct way of doing things, that this will introduce a new set of problem.

Any idea?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about cad