sin(3 turns) which would dispatch the unit to the optimized nsin.
Would the compiler optimize it to be overhead free though?
451–460 of 494 posts
sin(3 turns) which would dispatch the unit to the optimized nsin.
Would the compiler optimize it to be overhead free though?
Earlier quoted context omitted.
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.
>The fact that it is natural doesn't make it performant and straightforward for all applications. How does changing the scale make anything more or less performant? If anything, it makes things less performant since to use any hardware supported trig functions you now have to convert your weird angle representation into radians. For simple addition or fractions of your angle, it is just as performant as using angles…
As the article shows, in application code we are multiplying by 2 pi, and the very first step in the optimized assembly is to divide by 2 pi. Therefore changing the scale to what both sides want saves 2 operations.
And why would the optimized version want that division? It is because the next step is to reduce down to a fixed range, then use a lookup table.
> They only use quaternions for a few things, like slerp, and mostly because of gimbal lock.
And yet they still do use them.
> For everything else they still use linear algebra, and linear algebra is used much, much more than quaternions for nearly any 3d program.
> But math never decreed that sine and cosine have to take radian arguments! That is not entirely true. It comes from the relationship between those functions and the complex numbers via the Euler formula. ix e = cos x + i sin x There may be arithmetic/numerical inconveniences, but that's not all there is to "math". Let's define ncos and nsin ("nice cos, nice sin") as follows: nsin x = sin 2πx ncos x = cos 2πx So the…
IMO this is at least the most accessible argument for why radians are special, and while I don't pretend to understand complex exponentiation, I expect it's the root of why other math involving radians turns out nicely.
Earlier quoted context omitted.
I see where you're coming from, if the formulas end up having weird numbers like 535.4916 or numbers like 2.718 or 6.28318 then obviously there's something suspicious about the equation. But small correction though. You got the number wrong, it's actually much more weird than any of those mentioned. The actual equation you come to for ncos an nsin is: (-1)^(2x) = ncos(x) + i nsin(x) And yes, -1 is a very weird number…
This is a very good point, but it took me a minute to get what you were saying beneath the snark. Translating without the snark: There's a famous equation relating sin and cos to complex exponentiation. It also helps explain the Taylor expansions of sin and cos, which is one way to compute them and to find properties about them. It's a very important equation. It is: ix e = cos x + i sin x kazinator's point was that…
1^x = ncos(x) + i nsin(x)
using a multi-valued definition of the exponentiation on the left hand side.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…
It is not dimensionless.
A radian, or a turn, has a dimension: angle.
Saying 1radian=1 is just as senseless as saying 1m=1=$1.
It's true that abstract math often drops units because some things (like Taylor series) work nicely in certain units. That doesn't make the unit meaningless.
Street-Fighting Mathematics, thesis/book by Sanjoy Mahajan, shows what amazing things you can die in abstract math if you don't forget units.
Earlier quoted context omitted.
All those approximations have error and the behaviour you describe depends on where you are on Earth. Moreover, degrees are not natural from a mathematical perspective.
Out of curiosity, given a degree/calendar/time system could one localize the culture that created it?
Earlier quoted context omitted.
> Degrees are completely arbitrary Degrees are very natural in the context of ancient astronomy/astrology, where you have (1) ~365 days in a year, so that if you look at the path of something that takes a year you get about one degree change per day but with a number that is more easily divisible. (2) approximately 4y, 10y, 8y, 15y, 12y, 30y cycles for the moon and various planets. (3) A calendar with 12 months, 12 z…
All those approximations have error and the behaviour you describe depends on where you are on Earth. Moreover, degrees are not natural from a mathematical perspective.
Earlier quoted context omitted.
I see where you're coming from, if the formulas end up having weird numbers like 535.4916 or numbers like 2.718 or 6.28318 then obviously there's something suspicious about the equation. But small correction though. You got the number wrong, it's actually much more weird than any of those mentioned. The actual equation you come to for ncos an nsin is: (-1)^(2x) = ncos(x) + i nsin(x) And yes, -1 is a very weird number…
This is a very good point, but it took me a minute to get what you were saying beneath the snark. Translating without the snark: There's a famous equation relating sin and cos to complex exponentiation. It also helps explain the Taylor expansions of sin and cos, which is one way to compute them and to find properties about them. It's a very important equation. It is: ix e = cos x + i sin x kazinator's point was that…
Same way we might use electron volts rather than volts to make the equations nice.
Earlier quoted context omitted.
> Try to formally define this procedure, though. You end up going in circles. The cos(x) + isin(x) formula gives us a way to find the point on the complex plane's unit circle corresponding to an angle x, given in radians. (Plus it does more, because the argument is complex valued.) The new formula with ncos and nsin does the same thing for an angle given in turns. E.g 0.25 (90 degrees): -1^(0.5) = i. It's understanda…
>It's understandable in terms of roots of -1. You seem to have missed the point. You need the formula I gave to rigorously compute the roots of -1. Of course, you could notice that (cos(x) + i sin(x))^n = cos(nx) + i sin(nx), but that's what I meant by "going in circles". You end up defining (-1)^x in terms of sines and cosines, making the "formula" trivial. It's difficult, working this way, to understand why (-1)^(1…
But we are explicitly doing that; we have "nsin" and "ncos" on the other side, and those are explicitly defined as just cos and sin with a scale factor applied to the argument.
The goal is simply, if there is a goal, can we have a nice correspondence between complex exponentiation of some base and the scaled sine and cosine that work with turns.
Hey look; if we change the angle coordinate so that a full circle is just 1 rather than an irrational number, then the transcendental e disappears from our version of this famous equation.
Earlier quoted context omitted.
The one that I still use is the 3-4-5 rule to ensure a right angle. Still use that one to chalk off sporting fields of play.
I use that one all the time, but that's Pythagoras, not sin and cos.