Re: How can I determine if a point is a given distance from a second point?



On Mar 31, 2:15 pm, Israel <israeldip...@xxxxxxxxxxx> wrote:
On Mar 31, 2:58 pm, thomasnguyencom <thomasnguyen...@xxxxxxxxx> wrote:



On Mar 31, 1:24 pm, "Tom P." <padilla.he...@xxxxxxxxx> wrote:

I am writing a drawing program but I want to keep the scale down
(there could end up being several hundred objects on the screen).

I want to limit the points collected to a certain distance from other
points already collected, in other words, if you're drawing a line it
will only record points on the line every 6 pixels. How do I determine
how far away one point is from another? if they are restricted to
straight lines that's fine but as soon as they draw at an angle I'm
faced with determining how far away one point is from another in co-
ordinate space.

Any help would be appreciated.

Tom P.

Point x = new Point(1, 2);
Point y = new Point(3, 4);
double distance = Point.Distance(x, y);

I hope that helps.

goodluck,
-tom

If the distance cutoff is constant you're going to be executing this
many times or for many points you might want to do the math manually
and then compare against distance squared instead e.g. distance^2 =
(x2-x1)^2 + (y2-y1)^2

This is what I'm going to be using. I'll just do the math myself. I
never did find the method referred to, I don't know where tom got it
but he's got me beat.

Thanks for the help guys.

Tom P.
.



Relevant Pages

  • Distance, Duration & Action, oops camera
    ... Bill goes to near the bottom of a gravity ... potential well and Tom goes to near the top. ... He calculates his rod and it measures one distance. ...
    (sci.physics.relativity)
  • Re: Tom Van Flandern and Newtonian Gravity
    ... Tom Van Flandern: ... Did you mean to say spacetime, ... turned time into a space-like coordinate..." ... We aren't talking about a hamming distance or some other measure ...
    (sci.physics.relativity)
  • Re: LIGO.
    ... Tom has carefully answered your question using the correct ... You are falling into the trap of expecting distance to be ... the distance between two marks on a platinum alloy bar kept ... in Paris (this is the constant spacelike proper distance Tom ...
    (sci.physics.relativity)
  • Re: What is Maslows hierarchy really?
    ... >> Tom wrote: ... >> but distance and make the explaination clear. ... > travels (with that which travels the fastest as the most exact basis ... Momentum has no meaning without ...
    (comp.ai.philosophy)
  • Re: ORDER BY Zip Code Distance
    ... > Tom, thanks for your response. ... > Commenting the last two lines makes the query servicable again. ... >>> I then calculate the actual distance using the latitude and longitude ... You need to put the calculated value selection in the 'SELECT' clause, ...
    (comp.lang.php)