Grasshopper

algorithmic modeling for Rhino

Hello to you all,

a bit help please. I wish to evaluate all intersecting points based on how many curves intersect on that point. This means that, for the above example, I should get a value of 2 for both points. I can imagine that it is very simple, yet it fails me. Any help would be great!Thank you,

Panos

Views: 2063

Attachments:

Replies to This Discussion

Hello Panos,

On [Crv CP] you should graft the points input so that each point will be "tested" against all the curves.

Then you can check if the distance to the curve is 0. But the [equality] component will sometimes not work because of rounding issues in the last digits, so it's safer to use a [smaller than] component and compare the distance to a really small value.

This way you get a True/False list for each point and since True=1 and False=0 you can just use [mass addition] to get how many lines pass through each point. At the end you can flatten again and have these numbers in a single list (just like the corresponding points).

Thank you Nikos, it worked like a charm. Now, all I need is to actually get it. Thank you very much for your input.

Panos

You are welcome,

This image might explain it a bit better but, please, get back with any questions:

Hello again,

I am trying to use the output values of MA to move points-along with their respective curves- to z axis, but I get stuck somewhere along the way. Any ideas?

regards,

Panos

Attachments:

Do you want to move the whole curve on z or its 2 endpoints independently?

For example, you have a curve that starts from a point that moves 3 units on z and ends to a point that moves 2 point on z. How should the new curve be? Should it have a Z=3, a Z=2, a Z=5(2+3) or a startZ=3 and endZ=2?

There would also be a problem if 2 curves intersect somewhere in between their endpoints... How should this point's movement affect the curves?

Maybe you should rethink your approach. If your end goal is to move the curves maybe it would be more efficient to get the endpoints of each curve instead of the intersection points...

Take a look at the attached example file. Can you draw in rhino the final curves (after move)? It would help explain what you want :)

Attachments:

Hello Nikos,

I wish to move points independently as shown in the sketch, so each point, whether end or start, should have its own intersection value. Thank you for your help.

Panos

Attachments:

ok, just 1 follow-up question, in the example there were 2 lines that crossed each other (at the point tagged "2") instead of meeting at their endpoints.

If such cases exist in your drawing do you wish to "break" the intersecting lines in 2 shorter segments, or just ignore this type of intersections?

...or maybe you have made sure that such cases will never happen in your file? 

My mistake, the lines meet at point tagged '2'. In my case scenario, all lines either start or end at these 'tagged' points, so they are segments already.

Please ask me again if I am not clear enough.

Thanks.

Ok so this is one way to do it:

The 1st part (red group) finds, for each curve, all its intersections and "breaks" the curve on those points. If you are certain you don't have such cases, you can skip this part and reference the curves from Rhino inside the [crv] that is right after this group.

The 2nd part:

a. gets the end points of each curve,

b. calculates how many curves pass from each point (measures the distance from each point to all the curves and counts how many 0's there are for each point),

c. Changes all 1's to 0's (I saw from your example that if a line "ends up alone" you don't want to move this point at all),

d. amplifies these values,

e. moves the endpoints accordingly in Z,

f. Redraws the lines between these points

Hope this is clear, let me know if you have any questions!

Attachments:

Nikos, thank you! Of course it works perfectly but along with the step by step explanation, I may actually learn the way! Thank you, you are always very kind.

regards,

Panos

Got stuck a bit further along the way. On the same issue, I am now trying to set a limit 'intersection' value under which no moving of points would occur. Now this happens only to end/start points where there is no intersection event.

If I were to move points ONLY when 2 or more intersection events occur, to what would the expression if(x=1,0,x), be changed to?

Thank you again.

regards,

Panos

If you zoom in on the input X of the [expression] component, you will see a small (+) sign appear. Click this to add another input (that would be Y). Then change the expression to "if(x =< y, 0, x)" and use a slider to control Y.

let me know if this works out!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service