Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C
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 14-Mar-13 18:11pm
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 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 at 15-Mar-13 7:01am
   
Very interesting. Thanks for this link. This should be listed as the answer to this question!
Matthew Faithfull at 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.
125Azazelo at 4-Apr-13 21:58pm
   
Is just some small project but i not use any of this listed systems if i manage to be bug free i will share it.it take whit bugs(0.2sec for 2000 dots) and ~20% false hits.Thank you for this and info about be rich :) .

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 Smile | :)
 
I've reposted my comment as no other solution has been posted.
  Permalink  
Comments
nv3 at 15-Mar-13 12:27pm
   
Got my 5, Matthew.
H.Brydon at 16-Mar-13 0:36am
   
+5 from me...
J.Surjith Kumar at 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)

  Print Answers RSS
0 BillWoodruff 330
1 Mathew Soji 309
2 Maciej Los 295
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 217
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,025


Advertise | Privacy | Mobile
Web02 | 2.8.1411019.1 | Last Updated 15 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100