I am working with CAD .NET library (cadsofttools) and hoping others have an insight for a solution and potentially know of other libraries (open source) that can help. The CAD library provides all access to entities so lines, arcs, circles, etc. To eliminate any issues we provide functionality to remove layers/entities of no interest and manual editing if contours aren't properly closed off (ie 4 lines don't fully connect, they have to otherwise it's not a closed shape). And shapes are irregular, so most of the time we look at the X and Y of the rectangle area the irregular shape occupies to make it easier. They have a good demo editor which I've customized and began mocking up the algorithm(s) for the concept I am explaining below and realizing this could get a little interesting.
Since I have access to all basic geometry, I believe I just need a series of formulas and calculations to begin post processing the entities and doing things like,
1) Group them into shapes (ie 50 entities but really 4 rectangles, 6 circles, and etc.)
- ie. if I find 4 lines that intersect to form a rectangle,remove 4 entities from a list and build a single shape that maps to the 4 individual entities
2) Calculating distance of all line segments is very straight forward looking at entities individually - done
3) Identify if lines intersect, one shape or entity is within another, and some kind of hierarchy of shapes
4) Be able to identify areas of new shapes we find, ideally leads towards finding true area of irregular shape (like someone normally would in a math exercise)
I don't think the algorithm would be perfect, there's some messy drawings. So each step my UI allows intervention and manual override to "correct" things or help make decisions with an editor and context menu options + selecting entities. So you can easily just select 4 entities and add it to a shape list, that's very easy. But the more automatic algorithm I am looking to do is to post process CAD Entities and based on the information above I think it's just a collection of math libraries and pretty common stuff to build more of a auto detection feature in.
I have sample code / pseudo code of what I am starting to do with CAD library but was hoping someone with experience could weigh in if this is just a waste of time, if my logic and explanation makes sense. To me I am not writing proprietary code at all so sharing my pseudo code or final solution doesn't matter to me I more so want opinions, guidance, and to understand if there's any available libraries to help me instead of re-writing all of my junior high mathematics learning into classes for rectangles, circles, and etc. I'll probably spend time cleaning it up, putting it on github, or sending it back to the cadsofttools team to incorporate as helper code with their library.
Someone who knows CAD would help too because I realize when you have an arc + 3 lines and get an irregular shape, you now have to do things like 1 shape (break into two, calculate area, combine as one shape and combine areas) so there can potentially be edge cases.
Or if what I am doing already sounds like something out there why re-invent the wheel...or if it's a waste of time just let me know that too! Any help, advice, or suggestions would be greatly appreciated.
Since I have access to all basic geometry, I believe I just need a series of formulas and calculations to begin post processing the entities and doing things like,
1) Group them into shapes (ie 50 entities but really 4 rectangles, 6 circles, and etc.)
- ie. if I find 4 lines that intersect to form a rectangle,remove 4 entities from a list and build a single shape that maps to the 4 individual entities
2) Calculating distance of all line segments is very straight forward looking at entities individually - done
3) Identify if lines intersect, one shape or entity is within another, and some kind of hierarchy of shapes
4) Be able to identify areas of new shapes we find, ideally leads towards finding true area of irregular shape (like someone normally would in a math exercise)
I don't think the algorithm would be perfect, there's some messy drawings. So each step my UI allows intervention and manual override to "correct" things or help make decisions with an editor and context menu options + selecting entities. So you can easily just select 4 entities and add it to a shape list, that's very easy. But the more automatic algorithm I am looking to do is to post process CAD Entities and based on the information above I think it's just a collection of math libraries and pretty common stuff to build more of a auto detection feature in.
I have sample code / pseudo code of what I am starting to do with CAD library but was hoping someone with experience could weigh in if this is just a waste of time, if my logic and explanation makes sense. To me I am not writing proprietary code at all so sharing my pseudo code or final solution doesn't matter to me I more so want opinions, guidance, and to understand if there's any available libraries to help me instead of re-writing all of my junior high mathematics learning into classes for rectangles, circles, and etc. I'll probably spend time cleaning it up, putting it on github, or sending it back to the cadsofttools team to incorporate as helper code with their library.
Someone who knows CAD would help too because I realize when you have an arc + 3 lines and get an irregular shape, you now have to do things like 1 shape (break into two, calculate area, combine as one shape and combine areas) so there can potentially be edge cases.
Or if what I am doing already sounds like something out there why re-invent the wheel...or if it's a waste of time just let me know that too! Any help, advice, or suggestions would be greatly appreciated.