Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

java geometry

Thread view: 
rmacnak@gmail.com - 21 Oct 2006 23:11 GMT
If I have Shape S and Point P.  How do I find the point on the
perimeter of S that is closest to P?
Luc The Perverse - 22 Oct 2006 00:54 GMT
> If I have Shape S and Point P.  How do I find the point on the
> perimeter of S that is closest to P?

Um?  Distance formula/brute force?

--
LTP

:)
Chris Uppal - 22 Oct 2006 12:11 GMT
> If I have Shape S and Point P.  How do I find the point on the
> perimeter of S that is closest to P?

Too little information even to guess.  Some questions:

How are the shapes defined.?  Lines connecting points ?  Splines ?  Some other
kind of curve ?

Or maybe there's just a list of basic shapes to choose from (rectangle, circle,
etc) ?  Or maybe the shapes are defined by bitmaps (pixels with a value > some
threashold are "inside", everything else is outside) ?

Are the shapes concave ?  Is self-intersection possible ?  Are they connected
(equivalent to asking if there may be more than one S at a time) ?

What if there is more than one closest point ?

If edges intersect at sharp angles, is the intersection point eligible ?

(There are probably more geometrical questions than that -- I'm too lazy to
think of more.)

How fast do you want the search to be ?

How much data is required to define a typical shape (or groups of shapes) ?

Are you likely to ask for the answer with the same S (or Ss) but different P
often (so it may become worthwhile pre-processing S for faster lookup) ?

Are there any frequently-occuring special cases which could be identified and
handled specially (to save space or time) ?

And so on...

   -- chris
Filip Larsen - 22 Oct 2006 13:24 GMT
rmacnak@gmail.com

> If I have Shape S and Point P.  How do I find the point on the
> perimeter of S that is closest to P?

I haven't really tried to solve this problem, but it looks like the
Shape.getPathIterator() method and PathIterator class can be useful here
combined with some formulas for calculating point distance from the
curve segment types that PathIterator can return.

Regards,
Signature

Filip Larsen



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.