Grasshopper

algorithmic modeling for Rhino

Dear all,

Please help me for filtering a list of point3d..

I have a list of point3d and I want to REMOVE points where the distance between points is smaller than tolerance..

How do I do that in c#? I attached stupid screen shots..hope they help you understand..

Views: 331

Attachments:

Replies to This Discussion

List<Point3d> points = .....;

for (int i = points.Count-1; i > 0; i--)

{

  for (int k = 0; k < i; k++)

  {

    double distance = points[i].DistanceTo(points[k]);

    if (distance <= tolerance)

    {

      points.RemoveAt(i);

      break;

    }

  }

}

--

David Rutten

david@mcneel.com

Thank you so much~~!

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