Re: I'm lost in translation
If you have the bearing in 360 degrees and the position in two Single vars (not in degrees and minutes, X increases to the right/East, Y increases to the top/North) you can use this:
Code:
Public Point_Type
X as Single
Y as Single
End Type
Public Const PIDiv180= 3.14159265358979/180
Public Function EndPoint (StartPoint as Point_Type, Bearing as Single, Distance as Single) as Point_Type
EndPoint.X = Sin(Bearing*PIDiv180)*Distance+StartPoint.X
EndPoint.Y= Cos(Bearing*PIDiv180)*Distance+StartPoint.Y
End Function
Re: I'm lost in translation
If you're at the origin, then your coordinates have no impact on those of the object N. All that matters is your heading.
Since the relative bearing is B and your heading is H, then the actual bearing of N relative to 0o (i.e. due East) is just B + H (mod 360, and assuming that there is a proper 360 degree or negative convention). If your bearing is taken from a different point, just include the offset from your "local" 0o as a constant, e.g. if bearing is from "straight ahead", then add on 90o.
Now that you've got the angle from 0o (true East) and the distance from the origin, you just want the sin and cos to get x and y.
zaza
Re: I'm lost in translation
Hi zaza, did I miss something, as far as I undeerstood B stands for bearing and not relative bearing!
Also I have to state that my code goes for bearings 0 to 360 degrees, where 0 is North and 90 is East!!!
BTW: I'm an old fashioned airborne-navigator, I was trained using an sextant to shoot the stars and using Loran, so please don't make me change this habbit!
Re: I'm lost in translation
My understanding is that bearing is with respect to the direction in which you are travelling, hence you need to account for heading. I normally take coordinates and angles with respect to the x-axis, which is why I included the bit about accounting for your "local" 0o.
Shaggy's a smart bloke though, I'm sure he already knows all this.
Re: I'm lost in translation
Quote:
I normally take coordinates and angles with respect to the x-axis, which is why I included the bit about accounting for your "local" 0o.
Note that you probably count from 0 (east) to 90 (north), whereas I'm counting from 0 (north) to 90 (east), which is the otherway around! (I had to learn this kind of "false" directions the hard way at a time!)
Quote:
Shaggy's a smart bloke though, I'm sure he already knows all this.
I know that, I've read enough of his post's.
It's always a pleasure to help (or to try to help) one of the guru's of this forum!
BTW. What's the meaning of "D'OH"?
Re: I'm lost in translation
Quote:
Originally Posted by opus
Note that you probably count from 0 (east) to 90 (north), whereas I'm counting from 0 (north) to 90 (east), which is the otherway around! (I had to learn this kind of "false" directions the hard way at a time!)
Correct, but to be honest that's only a fixed 90 degree offset. It doesn't require any more complex a calculation.
Quote:
Originally Posted by opus
BTW. What's the meaning of "D'OH"?
Ask Homer Simpson.
Re: I'm lost in translation
Man, I'm tired. I really want to get back to this.....but I can't for a couple of days. You both made good points, however, here's my perspective on it: I'm an old navigator, too, but map and compass on ground work, so 0 is North, and 90 is east for me, as well. Also, this is my robot project, and the robot has a compass, so 0 will generally be north.
However, to wander off onto a totally irrelevant tangent, I am wondering how well my navigation will even work (I hope to find out in the next month). The compass is a sensitive electronic one. I will have to be watching to see whether things like the refrigerator cause my perceived heading to begin veering. It would be interesting to make a map of magnetic deviation around the house, but it will be a heckuva challenge doing navigation if every sensor has variable, non-random, error over the course of a straight line. I'm fairly eager to find out whether this will be a problem, but right now I'm still throwing a track whenever I turn a corner. More parts in the mail, might have a workable solution this weekend. Pictures in a month or so.
Then getting back to the topic at hand:
In this case, I do have only a relative bearing (and a true heading), but converting that to an absolute bearing in my 0 degrees N frame of reference is pretty simple math.
Yeah, it turns out it is a D'OH moment, and yes, that is a Homer Simpsonism. I think I'm no less sleepy now than I was when I wrote that first post, but even as fogged as I am I realize that once I get the true bearing the position of the point is simple.
By the way, I think there is already a Point structure tucked somewhere into .NET. I may find it, or I may not bother. In any event, I will be doing everything in integers ultimately, because the error in all of my measurements is such that even a single decimal place is pseudo-precision.
Thanks for the help, though, it was useful to me.