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).

169 questions
70
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
  • 174,939
  • 50
  • 355
  • 478
53
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
  • 1,072
  • 3
  • 10
  • 22
35
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
  • 377
  • 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
  • 19,726
  • 29
  • 111
  • 175
16
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
  • 48,006
  • 27
  • 136
  • 235
11
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
  • 572
  • 1
  • 5
  • 12
8
votes
2 answers

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
  • 3,066
  • 3
  • 32
  • 47
7
votes
2 answers

How to convert a degrees calculation to radians? (Kawa to Java)

I have tried to convert a calculation from an app I made using MIT AppInventor which uses Kawa to Android using Java.The problem I'm facing is that the trigonometric parts of the calculation in Kawa are using degress.My question is how do I…
Brian Var
  • 6,029
  • 25
  • 114
  • 212
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,263
  • 3
  • 20
  • 38
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
  • 13,758
  • 9
  • 81
  • 91
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
  • 141
  • 1
  • 2
  • 6
6
votes
5 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
  • 5,214
  • 5
  • 42
  • 83
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
  • 6,612
  • 8
  • 43
  • 71
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
1
2 3
11 12