Live data from Hacker News

Turns are better than radians

computerenhance.com

331–340 of 494 posts

Re: Turns are better than radians

#331
post #228

Earlier quoted context omitted.

I'm 27, educated in the UK, all I remember about trigonometry is SOHCAHTOA.

The Dutch version was SOSCASTOA, with a picture of a ship called the Castoa sending out an SOS because it was sinking. That picture really helped. And I even remember what it means: SOS: sine = opposing side divided by diagonal (schuine) side CAS: cosine = adjacent divided by diagonal TOA: tan = opposing divided by adjacent. I don't think I've ever used it for anything practical, but I can still reproduce it after al…

> I don't think I've ever used it for anything practical.

Just the other day I wanted to compute viewing angle and did it by hand even though there are plenty of calculators like this out there:

http://www.hometheaterengineering.com/viewingdistancecalcula...

I’d say I use it for something practical/random like that a few times a year?

Another example was placing some ceiling speakers whose tweeters had a 15° angle so that they were pointed directly at a seating position below. How far did I need to place them in front of the seating position from directly overhead.

I would guess any sort of construction you’re using it fairly often.

Re: Turns are better than radians

#332

Earlier quoted context omitted.

In my example you would not actually write it out but instead have something like this. [sin(x) for x in sample] My point is that the trig functions are abstract and useful in multiple domains and in most of these domains turns does not make sense. Turns only makes sense in geometry and maybe some physics but most of the time in these cases you might be better off working with other units, like say quaternions. The f…

To clarify my objection is with this statement > no one ever writes down numbers in the unit of radians, they already convert to half rotations or full rotations by scaling with pi That statement is true only if you are talking about geometry, If you are working in any other domain the trigonometric functions operate on real numbers and have nothing to with rotations or angles and if I call sin(1) I expect to get bac…

Still, the discussion is only about convenience. For example, e^ix = cos x + i sin x (with sin/cos taking an argument in radians) would become e^ix = cos 2pi x + i sin 2pi x (with sin/cos taking an argument in turns). It's more cumbersome than the radian-based definitions, but it's not strictly different.

Re: Turns are better than radians

#333

My favourite way of handling angles was always with either unsigned char or 16bit unsigned int that was treated as 1/nth of turn. Usually in these cases cos/sin tables were pre-calculated for speed, although that need went away to an extent. As long as as the calculations wrap around on the underlying system, it makes angles much easier to manage, because angle1 + angle2 = angle3 is always within 0 to 255 or 0 to 655…

    index = angle1 + angle2 | 0
Will keep things an integer. The | requires casting to int, the 0 makes it a no-op after the cast.

This is from asm.js which had to emulate integers so they looked through what it would take

http://asmjs.org/spec/latest/

Re: Turns are better than radians

#334

Earlier quoted context omitted.

Well it's not exactly surprising, the US is fundamentally built on arbitrary baseless measurement units so getting out of that mindset is probably difficult. A unit that could be inherently defined by math itself and not a farmer looking at their hands and feet? Preposterous!

> A unit that could be inherently defined by math itself and not a farmer looking at their hands and feet? Where do you think base ten comes from?

Base 2, 10, 3, 8, hex, radians stay radians.

Re: Turns are better than radians

#335

As already mentioned by others, radians are not arbitrary units for angles; in fact, they are the "natural" "units", so to speak. By definition, an angle is just the ratio of a circular arc ( s ) to its radius ( r ), θ = s / r (as an exercise, imagine how to apply this definition to the angle between two intersecting lines). When the length of the circular arc equals its radius ( s = r ), the angle subtended is exact…

why radius and not diameter?

Re: Turns are better than radians

#336

Radians are just half-turns, so we use turns either way. Some equations look better in turns and some in half-turns, but the math works fine either way. Instead to decide which is better think of how a new student might learn this intuitively: How far around is it? 2.5 turns. This is so much clearer than 5.0 half-turns. Turns a more clear. No one

No, radians are pi * half-turns. For example, a 90 degree angle is a quarter-turn (1/4 turns) or pi/2 radians. It is most definitely not 1/2 radians. Equivalently, radians can be said to represent tau turns: 1/4 turns is tau/4 radians.

Re: Turns are better than radians

#337
post #29

Earlier quoted context omitted.

360 comes from the Babylonians, who used base-60 for numbers much for the reasons you describe (and who gave us the 24-hour day, 60 minute hour and 60-minute second, not to mention the 7-day week). NATO forces have compasses labelled in mils or milliradians, which are not actually 1/1000 of a radian but as an approximation 1/6400 of a full turn. I still have my Silva military compass from 1989 graduated thus. https:/…

I heard that the reason is 1km away it makes a difference of 1m, so easy to figure out how far enemy troops are from each other.

It is even cooler than that. 1 milliradian is simply the distance (radius) divided by 1000, regardless of the unit of measure. So 1 km / 1000 = 1 m.

At 100 m, 1 milliradian is 1 cm.

At 1000 yards 1 milliradian is 1 yard.

At 1 mile (5280 feet), 1 milliradian is 5.280 feet.

Re: Turns are better than radians

#338

Earlier quoted context omitted.

Back in the early 80's a common thing to do in games on 8 bit computers was to implement sin and cos as lookup tables with the angles being 0-255 or 0-128 or something like that and the result also an integer that was some fixed point representation, so you'd do something like: vx = (cos[angle] * speed) >> 8; vy = (sin[angle] * speed) >> 8;

Ouch. Less than 1 degree of accuracy? Well, I guess if it’s good enough for Asteroid, it’s good enough for me

You can always do one cycle of newton-raphson to get nearly double the accuracy with only one extra lookup-multiply-add.

Re: Turns are better than radians

#339

As already mentioned by others, radians are not arbitrary units for angles; in fact, they are the "natural" "units", so to speak. By definition, an angle is just the ratio of a circular arc ( s ) to its radius ( r ), θ = s / r (as an exercise, imagine how to apply this definition to the angle between two intersecting lines). When the length of the circular arc equals its radius ( s = r ), the angle subtended is exact…

The fact that it is natural doesn't make it performant and straightforward for all applications.

For example linear algebra is the natural and general way to handle vectors. However game developers still find quaternions faster and more performant.

Re: Turns are better than radians

#340

Better than turns, radians, etc. is an `Angle` newtype AKA wrapper class. It completely eliminates misinterpretation of the value, miscalculation from [angle = angle + tau*n] as all angles are normalized, is more descriptive, and in a decent language is zero-cost. Programmers should not be using (radians: float) in modern languages which support wrapper classes

But what is the underlying representation in the wrapper class?
Post reply on HN