Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

finding closest point

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
i wanna implement a operation that calculate a closest point to a Line from one point.
the signature of the operation should be
public Point getClosestPoint(Point p1, Point p2, Point target);
the point 1 and point 2 form a line , the method should return a point on the line that is closest to the target.
I just use some stupid method to do that.
Anyone have smart algoirthem or method to do it ?
Thanks for your help
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't post the same question in multiple forums - other posters may waste their time replying to something that has already been answered elsewhere. Continue the discussion here. Thanks.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic