Hi All,
I have 1 problem, hope EveryBody can help me. This is, how can i compare 2 polyline together. Thanks.
Hi,
What do you need to compare?: length, color, number of segments, smooth, ccw/cw, bulges, etc...
Gaston Nunez
I want to compare about their shape. how can i know them the same. I have attached image.
so, you have to compare the 2 polylines with these aspects:
1.have the same count of points(vertexs, by using the Property NumberOfVertices), if not ,return false, else see 2.
2.for each vertex ,check the Bulge is equal(by using the Method GetBulgeAt),if not, return false, else see 3.
3. check the length of each segment(both arc and line) of the polylines are all equal(you may have to write some methods to calc the length of line or arc), if so we assume they are the same,if not,then not th same
at last, you may have to reverse one of the polyline, and do it over again, cause one may draw a polyline from Beginning to End, others may draw a polyline form End to Beginning
hope this be helpful to you.
Hi,
If It's only the shape, and the polylines can be in any position, rotation and scale, it may be a difficult problem (a pattern recognition one). Can you explain if this is the case?, if not, the cdinten approach should be fine.
Gaston Nunez
Yes. this is problem. Them only difference about position, rotation. Thanks for your help.
Hi,
You may try using some invariant (on position and rotation) properties like surface, perimeter and maybe the inertia moment (measured from the centroid).
Gaston Nunez
What about checking distance between verticies and the difference of angle between vertices?
Also would need to check both ways and bulges but would'nt the distance from
vertex[0] to vertex[1]
vertex[0] to vertex[2]
............
and angle between a line from
vertex[0] to vertex[1]
&
vertex[0] to vertex[2]
have to be the same?
Can't find what you're looking for? Ask the community or share your knowledge.