Grasshopper

algorithmic modeling for Rhino

Sorting Points from 2 Lists based on their vicinity

I am trying to sort Points from 2 Lists based on their vicinity. I came across an older solution from David, but it is not working in my case. I have tried everything I came across but can not figure it out. I was wondering if someone had a solution for this problem

Views: 2286

Attachments:

Replies to This Discussion

Since I am talking to someone with the Force... I am using this definition quite a bit, but it is so slow... it is used to find the centroid of a closed curve and unifies the plane normal for all curves. You wouldn't know a way to speed this thing up would you... a spare time challenge!

Oliver

Attachments:

OK, that's a nice w/e challenge (but I hate laptops) whilst waiting for some proper wind (wave windsurfing).

With regard THAT ... er ... Centroid-Blah-Blah thing of yours (what was that? a test for the brave?):

Good news: solution is accelerated by a factor of 1678,784 (if memory serves well). Still WIP and no parallel processing, mind. For the Curve vertices the notorious HocusPocusLocus (Tm)(C)(US patent pending) method is used.

Bad news: No plane orienting policy applied yet: explain (like talking to a stupid robot) what scenarios suit your goals.(Hint: do you want the curves become clockwise?).

Ugly news: No wind this w/e: life sucks.

Load R file first and DO NOT internalize this type of stuff (tears on sight the one or the other way).

Attachments:

I see... you look awfully relaxed there... You enjoy your maithai and catch some waves... Thank you for your help!

Good (Dark) Lord, 

Awesome Stuff... So many questions...

For output why use Datatrees instead of Lists? I assume it makes sense to place the info into a rhino kind of data structure directly but what is the benefit?

BTW: go easy on the Tequila and Vodka

On the GetNextDiscontinuity part. How did you figure to use C1_locus_continuous = 7... where can I read up on this?

Just digging through the stuff you threw at me... I will get back to you. Thank you Peter

Well...

1.We have N Curves each one of them may have a variable amount of HocusLocusPocus (HLP) pts > therefore only a "higher" order thingy can store that type of stuff: and the GH way is a DataTree. That said these things (masterminded by a certain David R) are not bad at all ... but if you write code that is "supposedly" transferable (kinda) to other CAD apps ... well ... I would strongly recommend the other classic nested C# collections.

2. The HLP method is one out of many: for instance for a better approximation of the required fitted plane we can use the divide Curve method etc etc.

3. GH components use (in most of cases) methods exposed in Rhino SDK > get the thingy and start digging into the rabbit hole. Of course David did some other components as well that use "less" classic SDK methods (if at all).

4. HLP is a classic approach to count the beans in nurbs curves. Of course I could use PolyCurves and recursive explosion blah, blah ... but here we are not after segments (at least at present time). On the other hand if that was a Faceted Dome (planar Polylines) ... well getting the nodes that way it could be an overkill (this means business for V2).

5. Mastermind some plane orientation policies in order to finish(?) the @$%@$ thing. For instance: Given Plane plane, define a Plane.WorldXY at plane.Origin and section these 2 > then get the cross product (sectionVector, plane.ZAxis) for the new orientedPlane Y axis etc etc (this presupposes that any plane Z axis points "outwards": use Dot Product and a center point as apex etc etc).

BTW:

what was that? a test for the brave?... man you are brave - this thing you wrote is lightning fast... do not know what to do with all that extra time - I guess I go surfing. Thanx

Well ... surfing is a far more serious thingy than C# ... but ... if there's no waves AND you want big (literally) response times I could add a proper variable for the job (kinda like the 0.7 to 600+ ms on the other case of yours, he he).

BTW: Assuming that the final scope is the obvious ... have in mind that the path is long (and hilly). I don't want to mimic Kassandra ... but consider a faceted dome for that kind of stuff (real-time solution from step 0 to 666).

Not at all clear to me what you are trying to accomplish?

You have two lists of 176 points each, but only 240 unique points between the two sets.

What is your goal?  "based on their vicinity" doesn't say enough.

It's the 2 of us again... you are right in hindsight my question was not clear. I am trying to create 2 index/list of the points inside the sphere. 176 points are used to draw spheres. each of these 176 points has one close by that is within the sphere. This makes 176 pairs of points. I need to sort these points to have the same index.

sphere1 - list1point1 list2point1

sphere2 - list1point2 list2point2

sphere3 - list1point3 list2point3

and so on... see new attached file.

thank you,

Oliver

Attachments:

For the other thingy of yours (Centroid), found a couple of minutes for the trad update.

V1A orients (if desired) the plane Z axis outwards ... but it doesn't do anything with regard X/Y Axis.

V1A is rather more intelligent (vertices List => it detects Polylines that are way faster to process: use the 2nd demo and see the serious gains in response time [ 1 to ~5] and all that without checking planarity [i.e. using always the Plane fit to pts method]).

5 ms for 180 polylines:

22 ms for your Curves:

BTW: Added a "viz" planes demo by orienting something.

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