Grasshopper

algorithmic modeling for Rhino

I'm combining elements (segments) to make different configurations. (here the other topic where Joseph Oster has found a good solution).

At the end I'll have a lot (tens of thounsand) of identical configurations but with different spatial orientation (rotation).

I would compare them to discard duplicates taking just one of each (similar to Delete Consecutive, but working with geometries).

The comparison has to be geometric because the only thing that canges is the direction of the segments (max 4 per configuration always sharing 1 endpoint).

A neural network could probably recognize fair quickly identity between identical configurations. I've never used them and I was wandering if exist any other method to run this task.

Nonetheless, it could be a first attempt to deal with ANN; any plugin/documentatio to suggest?

Views: 651

Replies to This Discussion

Try Panda,and this two component may work

Thank you Panda, I've seen your example. It's a very powerful tool but doesn't work in my case.

The traditional approach to such a problem is to write a hash-function which only incorporates those parts of the elements you care to equate. For example, what you could do, is measure a bunch of lengths or angles in each element and compose those into a textual string.*

Let's say you identify 3 key points in each element (A, B, C) and you decide that two elements are the same if they share the same distance AB, the distance AC and the angle ABC. So associate each element with the text "4.623, 8.500, 26.7", where the first part is the AB distance rounded to a specific tolerance, the second part of the AC distance and the last part is the angle. You can now compare these textual representations using Set components.

* Actually it is more common to use integers as outputs of hash functions, but other easily comparable data types work just as well.

Thank you, I'll go for it.

In my case I'll use the area of the 4point surface given by the ending points of the segments.

It should work.

'Area' is a slow, compute-intensive component that can make a model extremely slow when referenced thousands of times.  'Average' applied to the four points will yield a similar result and be much faster.

As to starting a new thread for every detail and aspect of the original problem you posed in the other thread, that's a bad idea as far as I'm concerned.  First, related ideas in the original thread are lost.  Second, without the original context, time and effort is wasted answering the wrong questions when a better solution in the original thread might be available.

I'm sorry, I've missed this comment, that's why I've wrote the other comment on monday.
I agree with this and I'm going to follow just the other thread.

Why start a new thread for this?  There is more that can be done in that purple group in the other thread to detect "duplicates", which in this case are the same four integers (0 to 11) that just happen to be in a different sequence.

I'm sorry, I've opened a different thread because these are different issues but in the same file.

In this case we have two orders of duplicates: the first is made by the same segments just taken in different order, so the duplicate will be the same and in the same position; the second one is made by different segments that arrange in the same configuration but with a different spatial orientation. This depends on the starting group of segments that are omogeneously oriented in space.
Editing your solution we can cut some redundancy but probably a new algorithm has to be implemented in order to solve the second kind of identity.

That said I'm a beginner so probably I'm missing something and any suggestion is gold.

If you can't derive it from the parameters that are the basis of how the shape is generated, but only from the generated geometry than a possible way would be to compute a plane for the element. This can be done through:

A) Principal Component Analysis 

B) Minimal Bounding Box Computation

Based on this plane you can compute a distance histogram and use this as an Identy for comparing. Here you can include the tolerances for matching. Also if you normalise the histogram you can also have scale inveriant matching.

This Identity will not Detect Mirroring of an Object since only the direction of the coordinate System (plane) redrived through A or B will be defined but the sign is not.

If two elements should be considered different when differently mirrored than you would need to have a local fixed point to orinetate the coordinate system.

However maybe you could provide an example script this would realy help to help you.

maybe you could provide an example script

See other threadsegmentscombination_2017Sep25d33.gh

Hi please find attached a possible solution as described before, maybe I didn't completly understand the problem. 

There seams to be 495 different solutions each having 24 solutions in the set....

You will need mathNet.numerics to run the code -> please donwload....

https://numerics.mathdotnet.com/

if you have spiderweb installed it is included...

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service