Grasshopper

algorithmic modeling for Rhino

Hi to all,

I have a question about lines and end points coordinates.

I have two lines:

They don't have the same same points coordinate for the common point that is for the end point for the 1 line and for the start point for line 2. There are no global coordinates? There is a way to obtain them? I need them to eliminate dulicates point from selected curves.

Thanks in advance.

Bye

Views: 2423

Replies to This Discussion

Is this a scripting question?

Yes.

ok.

Thank you for answering. Next time i will post there.

Robert

Surely the end-point of one of the lines is the same as the start-point of the other line?

All coordinates in GH are global, in that they are all specified with respect to WorldXY. Grasshopper doesn't have local c-planes like Rhino.

You can extract the end-points (both end-points) from a set of curves, then merge them all into a single big list of points and use the [Cull Duplicates] component to remove points that are too close together. You can specify the tolerance here, so even if your curves aren't exactly coincident at their ends, you can still make it work.

Hi David,

Thanks for answering. Is a question for a c# component i'm writting. Ok I understand. The problem was also in my code. I used:

double m_Length = m_Beams[i].Length;

Point3d m_Start = m_Beams[i].PointAt(0);

Point3d m_End = m_Beams[i].PointAt(Length);

and this work bad. Why? Now i discovered:

Point3d m_Start = m_Beams[i].From;

Point3d m_End = m_Beams[i].To;

thant works very good.

Thank you.

Robert

Hi David,

Another question. CullDuplicate can be very usefull to me, but I see that is a Grasshopper component (Component Index>Vector>Point>Cull Duplicates). I need something similar to use in C# code. Can you give me some advices?

Thanks

I think it uses the Grasshopper.Kernel.Geometry.Node3Tree class to perform quick nearest neighbour searches. You can use the same class in C#, but it'll require you to populate the tree and loop the searches.

If you know your end-points are always exactly coincident, or if you know they are always exactly coincident after rounding to N decimal places, you can ditch the Node3Tree and just perform exact lookups. Either using a HashSet, or Dictionary or some other collection class with O(1) or O(log N) lookup.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service