I have a list of x,y points in a DB, and I want a user to be able to click anywhere on an image button, and get back a value of the closest point. Anything built into GDI+ that may help me out with this? Thanks guys. -glog-
I don't think GDI is what you should be using here. sutely it's just a SQL issue? if you click an input type="image" /> you get the x, y passed to the next page - plug these coords into a SQL statement with some math and you can get the rows back in order of
proximity. I'll see if I can work up a SQL trick for this. can't recall off the top of my head how it's done.
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable
glog
Member
330 Points
66 Posts
Finding Closest Point
Mar 24, 2004 08:22 PM|LINK
Atrax
All-Star
18705 Points
3733 Posts
Re: Finding Closest Point
Apr 02, 2004 08:23 AM|LINK
Jason Brown - MVP, IIS
Jigar
Contributor
4629 Points
935 Posts
How to find distance.
Apr 02, 2004 01:21 PM|LINK
public double Distance(System.Drawing.Point p1,System.Drawing.Point p2){ double dx = p1.x - p2.x; double dy = p1.y - p2.y; return Math.Sqrt((dx * dx) + (dy * dy)); } And this is how its works. * p2 / | / | / | dy / | / | / | *---------# p1 dx distance = SquareRoot((dx x dx) + (dy x dy))-----------------------
Do not forget to "Mark as Answer" on the post that helped you.
Atrax
All-Star
18705 Points
3733 Posts
Re: How to find distance.
Apr 03, 2004 12:41 PM|LINK
Jason Brown - MVP, IIS
Jigar
Contributor
4629 Points
935 Posts
Find Closest point using DB
Apr 03, 2004 04:51 PM|LINK
-----------------------
Do not forget to "Mark as Answer" on the post that helped you.