Questions tagged [radians]

Questions regarding angular sizes, arguments for trigonometric functions geometry etc.

Radian is a unit of angular measure. It is measured as the ratio between the length of the corresponding arc and its radius. It is often used as an argument to trigonometric function (e.g., sin, cosine etc.). It is also used as an angular measure for frquency analysis of signals (e.g., in Fourier space).

144 questions
69
votes
5 answers

Why does OpenGL use degrees instead of radians?

The OpenGL designers were never afraid of mathematics, and knowledge of linear algebra is essential for all but the simplest OpenGL applications. I think it can safely be assumed that OpenGL programmers are familiar with angles in…
Thomas
  • 150,847
  • 41
  • 308
  • 421
44
votes
3 answers

Convert radians to degree / degree to radians

Are there build-in functions in R for the conversion of radians to degree and degree to radians? So far I wrote my one own functions: rad2deg <- function(rad) {(rad * 180) / (pi)} deg2rad <- function(deg) {(deg * pi) / (180)} #test: rad2deg(pi)…
Iris
  • 912
  • 2
  • 9
  • 21
29
votes
2 answers

swift trigonometric functions (cos, tan, arcsin, arcos, arctan)

hello I have to differenciate calculations in degrees and I have the following code but I doesn't return me the exact values. The only one right is the value of sin90 in degree = 1 //////***** DEGREES ******////// var sinus = sin(90.0 * M_PI /…
kepi
  • 309
  • 1
  • 3
  • 7
21
votes
4 answers

Convert kilometers to radians

I need to convert kilometers to radians. Is this correct formula? I need radians for nearsphere in MongoDB. If I need to convert 5 kilometers to radians I do this: 5/6371 And I get this result (does it seem correct): 0.000784806153 UPDATE This is…
Jonathan Clark
  • 15,668
  • 29
  • 101
  • 166
15
votes
2 answers

Standard way to normalize an angle to +/- π radians in Java

Is there a library function or a well-known quick efficient way in Java to normalize an angle to +/- π — e.g. when adding two angles? What I've got now (based on this answer) is basically the code below... private static final double TWO_PI = 2 *…
David Moles
  • 39,436
  • 24
  • 121
  • 210
10
votes
4 answers

How can I set the y axis in radians in a Python plot?

I would like to write the radian units of the axes as proportional to \pi: something like $\frac{\pi}{4}$, $\frac{\pi}{2}$, ... in place of 0.785, 1.5707 ... Is there any standard way? As an example, what should I add to the following…
DdD
  • 532
  • 1
  • 4
  • 12
7
votes
4 answers

JavaScript atan2() function not giving expected results

Normally, polar coordinates go from 0 to π to 2π (just before 2π really, as it equals 0 again). However, when using the JavaScript atan2() function, I'm getting a different, weird range: Cartesian X | Cartesian Y | Theta…
TerranRich
  • 1,251
  • 2
  • 19
  • 35
7
votes
1 answer

Why do we use radians in programming?

I like radians just as much as the next guy, and typically prefer to use them over degrees, but why do we use radians in programming? To rotate something 180 degrees, you need to rotate it by 3.14159265.... Sure, most languages have some kind of…
Tom Marthenal
  • 2,856
  • 3
  • 27
  • 45
6
votes
6 answers

cos of degrees not matching the cos of equivalent radians

All math functions in JavaScript use radians in place of degrees. Yet they are either unequal, or I am way off base. The conversion from degrees to a radian is: var rad = angle * Math.PI / 180 A 90 degree angle equals 1.57079633 radian The cosine…
SamGoody
  • 11,846
  • 8
  • 70
  • 84
6
votes
1 answer

MATLAB sin() vs sind()

I noticed that MATLAB has a sin() and sind() functions. I learnt that sin() accepts the angle in radians and sind() accepts the angle in degrees. The only difference I know is sind(180) gives 0 but sin(pi) doesn't: >> sin(pi) ans = 1.2246e-016 >>…
barney
  • 131
  • 1
  • 2
  • 5
6
votes
4 answers

How to use atan2() in combination with other Radian angle systems

I am struggling with this in JavaScript, but this problem applies to many other languages/environments as well. I want to have one object rotating towards the position of another object, and I use: atan2(obj1.dy, obj1.dx) - obj2.getRotation() to…
Qqwy
  • 4,675
  • 4
  • 31
  • 68
6
votes
4 answers

Calculate average of wind direction in MySQL

I have a table with the wind direction (among other weather values) every 10 seconds on a new row. The direction is stored as degrees: 0 - 360. Purpose What is the meaning of this average? The database stores every 10 seconds a row with…
stUrb
  • 5,635
  • 5
  • 35
  • 63
5
votes
1 answer

How to associate days (1 to 365.25) to radians in perl?

I have number of days from 1 to 180 days, decreasing and increasing dates from the date $epoch='2020-05-11'. The full period = 365.25 days, an amplitude, a frequency and a phase will be added later in the end to create a sine wave. This is not the…
Peri
  • 81
  • 2
5
votes
1 answer

Calculation of degrees is inaccurate

I'm using the following code to convert radians to degrees and do some arithmetic on the same. private double getDegrees(double rad) { double deg = rad * Mathf.Rad2Deg; double degree = (-135 - deg) % 360; return degree; } The value…
user6038900
4
votes
2 answers

Radians to degrees Matlab

I want to convert angles from radians to degress. I know that Matlab 2014 has a build-in function to do that, but that function is not good enough in my specific case. Basically, the angle pi/2 is 90deg and -pi/2 is also 90deg, however I need 270deg…
user5489
  • 123
  • 2
  • 7
1
2 3
9 10