Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have list of points
mydots[][points] = { {"x,y,z"}} // 2000 dots

what is the best and fastest way to connect nearest dots in same line?

I hope you will understand?

green line are good , red one not.

photo[^]
Posted
Comments
Sergey Alexandrovich Kryukov 14-Mar-13 23:15pm    
Yes, it's clear. What have you tried so far? The algorithm is pretty simple, but writing the code would need some time, and optimization of it is less trivial...
—SA
125Azazelo 14-Mar-13 23:53pm    
I have try to search by range of dots to see are they in range but some time i get false positive result , i was try to check is a point in line but also get some unexpected dots.
so i interested just theoretic or pseudo code what be the fastest way, or some prepossessing to minimal run time use of resource.
Matthew Faithfull 15-Mar-13 3:19am    
It sounds like you're working on something like The Travelling Salesman Problem, http://en.wikipedia.org/wiki/Travelling_salesman_problem. If so this page has lots of info on possible solutions. If you find a better one you will be famous and possibly very rich :-)
Ian A Davidson 15-Mar-13 7:01am    
Very interesting. Thanks for this link. This should be listed as the answer to this question!
Matthew Faithfull 15-Mar-13 11:33am    
OK as we haven't heard further from the author in 12 hours and no one else has proffered a solution I'll repost my comment as a solution. It sounds like the OP is wanting a TSP variant or a simplified but related algorithm rather than a striaght TSP but without a reponse I can't confirm this.

1 solution

It sounds like you're working on something like The Travelling Salesman Problem, http://en.wikipedia.org/wiki/Travelling_salesman_problem. If so this page has lots of info on possible solutions. If you find a better one you will be famous and possibly very rich :-)

I've reposted my comment as no other solution has been posted.
 
Share this answer
 
Comments
nv3 15-Mar-13 12:27pm    
Got my 5, Matthew.
H.Brydon 16-Mar-13 0:36am    
+5 from me...
J.Surjith Kumar 16-Mar-13 8:00am    
my 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900