|
Because of uniform grid size, for coordinate pairs between C and U verticals you can use euclidean distance taking into account the correct vertical and horizontal offsets. Outside of those ranges you have to maintain a list of width/height to accurately calculate intersected distance over those grids. There is a paper about UTM by a guy called Redfern, has some interesting notes.
|
|
|
|
|
michela wrote: is there any formula and algorithm to calculate the distance between two points
on the earth using mercator coordinates (x,y) instead of WGS coordinates (Lat, lon)?
Why on earth (heh) would you want distances to be calculated in Mercator coordinates?
Since it's a conformal cylindrical projection, the metric (i.e. distance between two points) will be awfully messy to calculate. It's much simpler to convert the coords and do the calculation that way.
|
|
|
|
|
|
I know that converting it on lat lon would result in a much simpler
way to do this!!! Unfortunately I have my Mercator coordinates and
I cannot convert tham back to WGS (also due to computational speed
issues) so I was looking for a formula who allows calculating distance
using only Mercator coordinates...
|
|
|
|
|
michela wrote: I have my Mercator coordinates and
I cannot convert tham back to WGS
Besides speed issues (although I can't imagine why the conversion would cause a speed issue ) why can't you convert them? It's a trivial calculation that can't possibly be CPU intense. I'm sure the calculation time is on the order of milliseconds or less. See here[^].
Doing the calculation in Mercator coords will require a look-up table of ratios and certainly require more calculation time than converting the coords. Furthermore, the distance calculation in Mercator units will not be a simple computation...
EDIT: if you're going to vote me a '1', at least give some reason as to why my answer was no good.
modified on Sunday, June 8, 2008 2:48 PM
|
|
|
|
|
Also having a table of ratio would be better than converting to WGS
and then using Vincenty formula to calculate distance between two points.
Do you know if there is any way to calculate these ratio factors?
Thanks.
|
|
|
|
|
michela wrote: Also having a table of ratio would be better than converting to WGS
Not only would the calculation be slower, it would also be difficult to implement and would produce inaccurate results.
michela wrote: Do you know if there is any way to calculate these ratio factors?
I am sure there is, but it is more difficult and less accurate than just converting to x,y...
|
|
|
|
|
How would I measure the 'entropic value'1 of a salt token added to a password before hashing with SHA-256? Should I be more concerned with the length of the salt, or its composition?
1 I just made up that term. Please feel free to enlighten me regarding the correct term.
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Information entropy in a very general and oversimplified definition relates to compressibility of a sequence when the source is unknown.
When generating salt one assumes the source is random, hence the salt should have an entropy of 1. The length is not taken into account. If the salt is the result of a pattern or other known means then it will have a low entropy, something limiting to 0.
The end result is the entropy of the salt is of very little relevance when using a "decent" MD such as the one you have suggested, when hashing passwords.
|
|
|
|
|
Fascinating, thanks. I'd actually like to know more about this, so could you please suggest some online resources for a noob like me?
So am I correct in guessing that if the entropy is 1, a sequence cannot be decompressed at all, and at 0, it can always be decompressed?
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Does anyone know the algorithm behind Windows Update, and other auto-update mechanisms?
Does the client browse a list of available updates on the server, or does the server receive an inventory from the client, and then the server decides what updates are to be applied?
“Cannot find REALITY.SYS...Universe Halted.”
~ God on phone with Microsoft Customer Support
|
|
|
|
|
I don't know about the windows update, but an online game server that I know checks a file in game folder, where some paramters are written by the update. If the parameters don't pass the test, the launcher ask you to make an update, and gives a shortcut to the updater. But it is not "auto", it requieres user confirmation. But if it is not updated, it may avoid the server connection (depending on what the new update changes)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I'm looking for some code that determines from a series of
2D points, whether the points draw a:
- ellipse
- line
- rect
- polygon
if none of the above then just a assume a free form polyline. If the
function determines a ellipse, line or rect, then return a rect for
the bounds. Doesn't have to be super accurate, as it's for a demo program.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Assuming the ellipse, rectangle and line will be made from points ordered uniformly around their 'perimeter'...
If they represent...
1) An ellipse: the distances from the geometric centre to each point will be linearly distributed... ie: the average distance from the centre should be within an epsilon amount to half way between the maximum and minimum distances.
2) A line: take any two points and calculate the 'linear line equation' y=mx+c... then see if all other points fit the equation.
3) A rectangle: the points would fit into four 'linear line equations', one for each side; find a pair of points that at least one other points fits into, repeat with the remaining points until four sides have been found and there are no points left. (This is the hardest of the three... there may be a better way).
4) A polygon... if none of the other conditions apply.
Calculating the bounding rectangle is simple... look for maximum/minimum points in both the vertical/horizontal directions.
I believe I've done something like this before... I'll see if I can find some code.
Hope this helps.
Matthew Butler
|
|
|
|
|
Matthew Butler wrote: points ordered uniformly
I don't think you could assume this. The points would be collected while the user drags the mouse with the main button help down. So some of the points will be "closer" to each other than others because the speed at which the user moves the mouse will probably not be very even.
Thanks for the other suggestions though!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
To solve the 'random mouse speed' you could only draw the next point when it is a pre-determined distance from the last... however that may not fit in with your design.
However a better way may be to look at the angles between successive points...
(This is how I did it)...
For a line, the angles would be around 180 degrees.
For a rectangle, there will be (over a few points), 3 x 90 degree turns, with the rest 180 degrees. (The end point will be in proximity to the first).
For an ellipse, the angles will always be either below or above 180 degrees... depending on whether it is drawn clockwise or not.
And a polygon will not follow any of the previous patterns.
... self explanitory.
I stored each shape's pattern and iterated through them looking for a match... similar to a regex... but geometrically, with an 'accuracy' value.
If not accurate enough (<75%), I assumed it to be random.
Hope this helps.
Matthew Butler
|
|
|
|
|
Matthew Butler wrote: For an ellipse, the angles will always be either below or above 180 degrees... depending on whether it is drawn clockwise or not
All it takes is a well drawn spiral, and BOOM!
Semicolons: The number one seller of ostomy bags world wide. - dan neely
|
|
|
|
|
Oops. So much for testing... I missed that one.
-one quick copy and paste later-
if (CalcLength(points[0], points[points.Length - 1]) > maxDev) return false;
Checkmate.
Matthew Butler
|
|
|
|
|
The maximum and minimum X Y coordinates will not do for an ellipse, you need to determine the equation for the ellipse and then take the end points of the axes.
|
|
|
|
|
I was refurring to the maximum and minimum distances between the points and the geometric centre... not the bounds of the ellipse.
......ooooooooooo......
...ooo.....|.....ooo...
..o........m........o..
.o.........|.........o.
.o.........X----M----o.
.o...................o.
..o.................o..
...ooo...........ooo...
......ooooooooooo...... m is the 'minimum' radius of the ellipse.
M is the 'maximum' radius of the ellipse.
If it was an ellipse, the average distance between each point and the centre, X, would be approximately equal to the (M + m) / 2;
This was my original idea... I posted my alternative method (my prefured way and the method I actually got running - in a past program) as a different reply.
I believe I saw this method a while ago, but I can't remember where.
Matthew Butler
|
|
|
|
|
In your definition wouldn't an ellipse or a rect be a polygon? so all you want to really know is if a set of points represent a line or a polygon.
Hence the simple solution is if the points aren't all collinear then they represent a polygon, otherwise they represent a line or line-segment.
|
|
|
|
|
You might want to try finding line segments (assuming points are dense), and than base your recognition on the segment.
A trick for this is to use Hough Transforms to find significant line segments. [^]
Lines end up as local maxima in the Hough space. You can pick the segment with above value above mode, normalize them, and use the number of segments, as well as the segment values, as a discriminator.
This does a reasonable job, I used it for OCR back in the 90s.
Now that I think about it,look for mouse gesture recognition articles on CP, I think there are a couple, and it is what you are doing.
Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.
|
|
|
|
|
Hi,
Im trying to work out a fourier series for a wave of period T.
The wave rises in a linear fashion from 0 to T/2, to reach a value of 1
(so its a saw tooth).
From T/2 to T it is 0.
Im trying to work out Ao, Bn, and An for the general formula:
If I integrate (!), im integrating from 0 to T
<br />
Note: ! means integral<br />
<br />
Ao = 1/(2*PI)*!f(x)<br />
Bn = 1/(PI)*!(f(x)*sin(n*t)<br />
An = 1
Now, my equation and solution I got:
<br />
<br />
Waveform equation:<br />
f(t) = t/(T/2), for 0 -> t -> (T/2)<br />
f(t) = 0, for (T/2) -> t -> T<br />
<br />
Coefficients:<br />
For Ao I got: 1/4<br />
For Bn I got: -cos(n*t)/((T/2)*n)<br />
For An I got: (1/(PI*n^2)*(cos(n*PI)-1)<br />
<br />
f(x) = Ao + SUM(An*cos(n*t)) + SUM(Bn*sin(n*t))<br />
<br />
To work out An and Bn, I was using the integration shortcuts
<br />
<br />
!t*sin(n*t) = -(t*cos(n*t)/n + sin(n*t)/(n^2) + c<br />
!t*cos(n*t) = (t*sin(n*t)/n + cos(n*t)/(n^2) + c<br />
<br />
I wont post all the work because it will be too messy to follow online. I know the above answers are wrong because the harmonics don't sum to build the original wave.
If anyone who's switched on with fouriers feels like some 'revision', I'd love to know what you come out with ... (i'll even check your answer for you )
Cheers,
Mark.
|
|
|
|
|
Since your function isn't defined on the interval [-pi,pi] are you doing the change of variables properly? That is, if you are on an interval T rather than pi, you should transform according to:
x = pi * x'/T
dx = pi * dx'/T
|
|
|
|
|
Hmmm ok, i'll try that.
My line of thought was that if i'm counting t, from 0 -> T. When t gets to (T/2), the result of
<br />
f(t) = t/(T/2)<br />
will be a linear rise from 0 to 1.
I hate Fourier's
Cheers,
|
|
|
|