Log in

No account? Create an account

Previous Entry | Next Entry

I am simply exhausted today. Not enough sleep last night, I hate hotel beds. And tonight I'm pretty much packing stuff up to take out to the truck.

Lots of work today. Kind of the norm-- very full days, and it's only going to get more busy as we go.
Helmut (the "new" guy) is getting a good handle on the system. We've been batting some ideas and questions back and forth, which is good because it's so new to both of us.

I have a big design-type question that has to do with the mention of a "best-fit line", so this is probably aimed at revdj more than anybody:

I have a series of points in a plane.
One point is defined as the center of a circle.
The rest of the points are contained within the circle.
The number of points is not known, but it is finite.
using the center point as the endpoint of a line segment, I need to define a single line that is a "best fit" for the remaining points.
However, the points are weighted. The points farther out toward the edge of the circle are "heavier". The weighting is somewhat arbitrary, but for the purpose of this analogue, the weighting can be considered linear with radial distance from the center point.

What I end up needing is the direction of the "best fit" line that passes through the center point.

My current plan is to create a vector from the center to each point, then extract a "mean" vector from all of those.

Is there an easier way?


( 3 comments — Leave a comment )
Mar. 18th, 2004 05:35 pm (UTC)
DISCLAIMER: I'm not an applied mathematician. The following is just off the top of my head.


I am not convinced your method will give the best fit. You are taking the mean of only the lines that go through at least two of the points. I don't see how this will necessarily give you the best fit.

Here are my two suggestions:

Assume without loss of generality that the center point is (0,0). Your friend is the fact that if you let f(theta) be the error as a function of the line going through the origin with angle theta with the x axis, then f(theta) is going to be a continuous function. This is a BIG DEAL and will allow you to do this well.

If you have a lot of computing power, then you can actually find f(theta) explicitly given your points, and then maximize it as a single-variable calculus problem.

If you don't have a lot of computing power, you can get a good solution (not necessarily the best) this way...

Find f(theta) for theta = 10, 20, 30, ... , 360. Now pick the top one or two theta values. These are your first guesses. Assume you get your minima at 20 and at 50.

Now test 15, 16, 17, ... , 23, 24, 25 and 45, 46, 47, ..., 54, 55. (refining your guess)

You see where I am going with this. In retrospect, I think the first idea may take even less computing power, and therefore give you the exact answer quickly.

My number is in the phone book, and I will be glad to discuss things further.

Mar. 18th, 2004 06:09 pm (UTC)
Good god man, it isn't tested!
I still have to test this, but I believe I am correct:

If the point is (r,s) and the line goes through (0,0) and makes an angle theta with the x axis, the distance between the point and the line is

cos(theta) * abs (r * tan(theta) + s)
Mar. 18th, 2004 06:35 pm (UTC)
This is right. For real.
abs(cos(theta) * (-r * tan(theta) + s))
( 3 comments — Leave a comment )

Latest Month

April 2012


Page Summary

Powered by LiveJournal.com
Designed by Tiffany Chow