Grasshopper

algorithmic modeling for Rhino

Curve closest point seems to return incorrect values

I have a rather strange problem where Curve Closest Point should be returning more items as having 0.0 distance but it is not.   I'm sure this must be something I've got wrong, but the definition is working in most cases.   

I have got a list of points (internal corner points of all surfaces) for which I would like to find the respective adjoining edges.  I would expect 2 points (set more than one edge apart) on one surface to have 4 adjoining edges and therefore a CCP should return four distance values of 0.0.  

I have used tree item identify which ones its not picking up and in each case it was the second item on a branch, yet it was still working correctly for higher other items in the list.  In both cases the values I was expecting to be 0.0 are nowhere near!!

Any thoughts would be much appreciated!!

Views: 1197

Attachments:

Replies to This Discussion

Hello Matthew,

please upload your definition. its weird.

cheers

alex

Hi Alex

Please find attached - thanks for your help,

Matt

Attachments:

Alex is right, I replied in a haste. this is not an equality problem. It seems to be a data matching problem. The way you have your trees organised, [Curve CP] checks the first point against the first line and the second point against all other lines. You actually want to check each of the 2 points against all lines.

So, what the results of [Curve CP] tell you, is that the first point touches the first line (and maybe the second or the last one, but it is never checked against those) and the second point touches the fifth and sixth line.

If you upload your definition we can show you how to do this! 

I just uploaded above  - I think I can see the problem now but still can't fix it!  

Hello Mathew,

this is a data matching issue. lets say the first branch of 2 points is testesd against the first branch of 8 curves. Grasshoppers longest list default behavior tests the first point with the first curve and then all the other curves with the second point.

cheers

alex

In that case would I need to duplicate the pairs of points by the number of sides for each surface and then test with [Curve CP]?  if so, how would I be able to duplicate the branches of paired points?  

or is there a simpler way?!

Hello Mathew, Alex,

This is one way to do it:

You are right, you need to graft the lines and then duplicate the pairs of points by the number of lines (list length). Then for each line you will get the distances from both points and you want to get a "True" value if one of those distances is 0.(this can be done with mass addition).

Attachments:

Well my hat is off!  Thank you very much this works really nicely - using partition list in this way is very neat.  I dropped some of the clean tree functions (remove empty branches) as I need to keep them in this order as they are being merged back into some other trees later, but it doesn't seem to affect this.

Actually I am afraid it affects the results because [partition] will make the empty branches disapear. Double check this with both solutions to be sure...(if I remember right, it returned only 2 lines in branch {2} instead of 4....)

Doesn't [CombineData] work ok even if empty branches are missing?

edit-----

You might be right, I just checked it again and it seems to work ok. The empty branches reappear after the last dispatch component...(fingers crossed)

Hi Mathew - Nikos & Alex,
though it's past my bedtime this is what I was thinking - hope I understood correctly:
Should I be in bed? ~;)

Attachments:

Hello Pieter,

Unless Mathew has some strange case where a point touches 2 different surfaces but he wants it to "affect" only 1 of them (i doubt that), then your solution is much simpler and really elegant.

Actually I think you can even remove the cross reference component from your solution and it will work the same way!

Cudos! 

Nikos

ps. I got carried away by the way Mathew had already set up his definition and took it for granted that each point should be checked only against the surface where it belongs....

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