Find similar curves


#1

I have two question about similar curves
1:
I have many curves.
and need using C++ codes to divide them into groups along the curves‘s Similarity。
how can I do?

2:I have two group curves named gruop A and B (these curves are not sorted )
which can be merged to two closed curves.
one closed curve is inner the other.
one curve in gruop A has a similartity curve in gruop B.
How can I find the corresponding curve in gruop B?

similarCurves.rar(6.0 KB) is a just simpely test sample curves.
in this example: I need find the same color curve along the outside curves.


(Dale Fugier) #2

1.) How do you define “similarity?”

2.) The RhinoMergeCurves() SDK function will join these into 2 closed curves. Is this what you are looking for?


#3

1: the shape of curves are similarity.

2:RhinoMergeCurves can make them to two closed curves
but before that I need find the same color curve along the outside curves.
you can see my test sample curves,maybe be can unstand what I want to do.


(Dale Fugier) #4

1.) So by similar shapes, you mean “find all lines” or “find all circles”? If this is the case then you might take a look at this code sample and see if it gives you any ideas:

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleClassifyCurve.cpp

2.) To find curves that have the same color, you will need to use a CRhinoObjectIterator class to iterate through all objects in the document.

Once you have an object, you can perform whatever test you need.

For example:

https://gist.github.com/dalefugier/6117713

Hope this helps.


#5

dale:
Thanks for you help
maybe I explained my problem not clearly.
These ideas are not I needed.

I am sorry for my poor english.
I will think how to sovle these problems myself.
If I still have’t ideas,I will try explain my problem more clearly.
Thanks again.


(Dale Fugier) #6

If you need help with language conversion, you always email @kelvin at kelvin@mcneel.com.


#7

Hey Dale,

Good morning.

I am reviving a thread from last year to ask “why does it seem so difficult to come up with a script that can find duplicate objects that do not overlap?” Any kind of duplicate objects, from a simple two point line to a closed four sided curve loop, to more complicated stuff. I posted a request in the Scripting forum and the only answer I got was from Mitch who has a script for finding closed objects that have the same volume.

Is there something I’m missing?

Thank you.