There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Alec Lee wrote:Thanks. I am working hard to recall my math knowledge. I show what I've done and see if it is correct or not:
Assuming the point is (xp,yp), then
From 2 point form I get the equation of the line as: (yp-y1)^2 * (x1-x2)^2 = (xp-x1)^2 * (y1-y2)^2 ......(1)
(I took square of the equation for easy substitiion with my 2nd equation)
From distance between 2 point formula: d^2 = (yp-y1)^2 + (xp - x1)^2 .......(2)
And, now it is 2 equations with 2 unknown. It could be solved by eliminiation. Since, I got (yp-y1)^2 in both equations, I can take the one in (2) and substitute it into (1) to get xp. And with xp known I just find yp from (1).
Is that correct?
Matt Cartwright wrote:just wondering ..
java.awt.geom.Point2D distanceSq(Point2D point)
Distance Formula
M