343 reputation
149
bio website tgohome.com
location Basingstoke, United Kingdom
age
visits member for 3 years, 10 months
seen May 12 '11 at 19:28

Ubuntu 10.04 User.

Uses Windows XP sometimes. Hates Vista with a passion. Interested in Windows 7, though haven't tried it much.

Programs PIC microcontrollers in C and assembly. Favours dsPICs at the moment, but hasn't tried any other microcontroller yet.

Prefers Python any day!


Dec
4
comment Lat/Lon/Alt to spherical or cartesian coordinates
@whuber: These errors are tolerable.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
Actually, I created a second question for this, because it sounds like a good optimisation: gis.stackexchange.com/questions/4147/…
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
Do you have any tips on converting the coordinates? The position of the viewer may move so these would have to be updated, but if the cost is only a few sin or cos calculations when the coordinates change it would probably be worth it.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber: Yep, it's probably a better idea because the fixed point library also uses the 40-bit accumulators which support add, subtract, multiply, multiply-accumulate, euclidean distance etc. But these are only available on the dsPIC33F processors and I'm hoping to migrate to PIC24 after a while, which doesn't have these accumulators. So I might have to stick with floating point for now. It renders at about 20-30 frames per second, which is fast enough for me.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber: My MCU manufacturer (Microchip) have a software fixed point Q16 library. I was considering using it; it might be faster. It has most trig functions.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber Don't have Excel, but I think OpenOffice.org Calc has a solver like function. Or I could use Python.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber Thanks for the approximation. I could also use this to rotate the viewport. Every cycle counts! Do you know of one from 45..90 degrees?
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber, Without a hardware FPU, a division is about 300 cycles; atan2 is about 800 cycles. Cosine is about 500 cycles; plus two divides and it might be about as fast. I like this solution though because it works well enough. A future version will have a more powerful (about 8x faster) processor so I might be able to slip some more operations in. Maybe I could even find one with a hardware FPU, or switch to using fixed point math.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber: How many entries? More entries = more precision, but more program memory. 128KB doesn't go far...!
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber Comes down to processing speed really. Most people will be in the same area (it's for model planes), so distortions in FOV can be accounted for on start up if necessary.
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
@whuber Ah, but it does! I am only using very short distances, and distortion is acceptable. If you want to see very similar code in action: (in Python) youtube.com/watch?v=V_fjUtqqX0M It's for augmented reality, so any distortions converge to zero as you approach the waypoints; therefore, distortions don't matter (as long as they aren't overwhelming.)
Dec
3
comment Quick way to determine if facing a given lat/lon pair with a heading
My processor has no hardware FPU, so all operations are done in software. It currently fits in 5,940 cycles for each waypoint and is accurate enough. I don't need high accuracy, and I'm sure there's at least a way to approximate it. Have a look at how I did it with my code sample.
Oct
27
comment Algorithm for offsetting a latitude/longitude by some amount of meters
Good point - must remember to convert to radians!
Oct
27
comment Algorithm for offsetting a latitude/longitude by some amount of meters
So with the formula if I wanted to move +100m in the y direction from say 10.0 N, 10.0 E, would I just add 100 / 111111? If moving in the x direction +100m, would it be 100÷(111,111×(cos 10))? Just making sure I've got this right.
Oct
27
comment Algorithm for offsetting a latitude/longitude by some amount of meters
Thanks! Within 0.4 degrees is much better than I could have hoped for.
Oct
27
comment Algorithm for offsetting a latitude/longitude by some amount of meters
I suppose this could work; what would the range be - within 10 degrees of the poles?
Oct
27
comment Algorithm for offsetting a latitude/longitude by some amount of meters
Thanks for this - looks ideal. Though I can't figure out if the distance is in meters or some other measurement.
Oct
26
comment Algorithm for offsetting a latitude/longitude by some amount of meters
Yeah, that would be fine as I'm expecting <1km offsets.