Author Topic: Hello, and Point3dCollection Question  (Read 2307 times)

0 Members and 1 Guest are viewing this topic.

ophion

  • Guest
Hello, and Point3dCollection Question
« on: February 08, 2019, 09:57:35 PM »
Hi Everyone, I'm Ophion. I'm hoping you can help me.

Anyone know a more efficient way to find the closest point in a Point3dCollection from a coordinate other than iterating through every one of them using a distanceto check?

Thanks!

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Hello, and Point3dCollection Question
« Reply #1 on: February 08, 2019, 10:36:02 PM »
Welcome to the club Ophion,

That's a fun topic, one that has been asked a few times on this forum, I would invite you to search "closest point" using the search feature
as you might find exactly what you need, or a place to start.

Cheers

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Hello, and Point3dCollection Question
« Reply #2 on: February 09, 2019, 02:26:41 AM »
Hi,

As far as I know, the Point3dCollection is a resizable indexed data structure similar to List<Point3d>, so it doesn't provided any other search way than iterating the whole collection.
If you have several searches to do in the same big point collection, you can convert the Point3dCollection into a more efficient data structure (this supposes the Point3dcollection to be completely iterated one time for the conversion.
Some times ago, I tried to implement a Point3dTree structure base on a kd-tree.
The discussion sarts here and the last improved version here.
The Point3dTree class provides a NearestNeighbour() method which returns the closest point.
Speaking English as a French Frog