Tag Info

New answers tagged

4

If the area where the nodes can be is small (relatively, the size of half the US is small enough) and away from the poles then you can reasonably approach the problem using just the longitude and latitude as X/Y coordinates. Near the poles you can treat them as polar coordinates with the 90°-latitude as the distance from center and the longitude as the angle ...


0

I'll try to give you an idea of how digital circuits are designed to solve digital processing problems by using the problems you pose: how do CPUs implement additions and multiplications. Firstly, lets get the direct question out of the way: how does a programming language efficiently evaluate multiplications and additions. The answer is simple, they ...


0

I was thinking too complicatedly when all I had to do was use Unity's transform.forward and transform.right. They did all the work for me :p


1

Translate the plane's origin to your 3d coordinate system. If your translation is constant you can do this just once, otherwise you will have to repeat this once per frame. Translate the velocity vector as if it were a point on the plane, and subtract the translated origin from it. This is your 3d velocity.


0

Any angle is equivalent to the angle + 360 degrees. So if you are increasing a, but a > b (numerically), then add 360 to b at the start. Now a < b works for your loop. e.g. a = 270 b = 45 b += 360 // = 405 while (a < b) a += ... // 270 up to 405 If you are decreasing a but b > a (numerically), then add 360 to a at the start. Now a > b ...


0

I don't completely understand the problem being posed, but I suspect that it would be useful to find the smallest angle between AngleA and AngleB, where the smallest angle is in the range -180 to 180. This can be done with modulo arithmetic. Most programming languages have some form of a modulo function, but their behavior varies, see wikipedia page. In ...


1

If the question is How do I detect whether A has crossed B? you might use the following logic: a := A mod 360. b := B mod 360. prev := a > b. A := A + 13. a := A mod 360. current := a > b. Return: current not = prev The pseudo-code above returns with TRUE if, and only if, A has crossed B. This means that you should update ...



Top 50 recent answers are included