172 questions
-4
votes
1
answer
113
views
Pygame image not facing the mouse [duplicate]
Here is my rotating code:
pos = pygame.mouse.get_pos()
x_dist = pos[0] - self.rect.centerx
y_dist = -(pos[1] - self.rect.centery)
self.angle = math.degrees(math.atan2(y_dist, x_dist))
self.image = ...
2
votes
3
answers
291
views
Want to convert degrees to radians and have the answer output symbolically
I am using the Sympy library in Python, and I'm trying to convert degrees to radians, and have the output rendered symbolically. Sympy does not have a function for converting degrees to radians, but ...
0
votes
0
answers
40
views
Using Positioned with Offset.fromDirections in Flutter
I am currently trying to place Image.asset widgets in a circle based on the degrees. I have tried using the Positioned and Offset.from Direction, but the values seem to be off.
I have split the ...
33
votes
2
answers
4k
views
Why do trigonometric functions give a seemingly incorrect result? [duplicate]
When attempting to use a trigonometric function in my programming language, I get a seemingly wildly incorrect result.
For example,
sin(90) = 0.8939966636005579
But I would expect sin(90) to be 1. ...
0
votes
0
answers
344
views
Do we have an equivalent of rad2deg() in C++?
Do we have an equivalent of rad2deg() in C++ ?
rad2deg() is available in php, perl, Matlab, numpy-python, etc.
It converts radians to degrees. This is the relationship:
π radian = 180°
0
votes
1
answer
2k
views
trying to print degree symbol after integer
I am trying to do the find-angle challenge in hacker rank, I got the value of the angle as an integer but hacker rank requires me to give the output with " ° " symbol at the end, how do I ...
1
vote
1
answer
81
views
Angle to cursor, with different orientation of zero degrees
I'm trying to make a utility function to determine the angle from an element to the mouse cursor, but allow our devs to change where 0 is located. So this needs to return the angle as degrees between ...
-1
votes
1
answer
769
views
Get closest coördinates from a list based in Google Sheets
I have seen a similar question here, but that answer did not to the job for me yet. We have a Google Sheets doc with 46 adresses, and converted longitude and latitude from that location.
Now we would ...
0
votes
1
answer
806
views
How to convert radians to degrees where 0° is north
Technology
MySQL
Problem
Given is a radian value that defines the direction.
This radian can be easily converted to degrees (f.e. 1 radian = 57.296°).
But this would result in the following:
0° would ...
0
votes
1
answer
243
views
OpenGL Drawing 2 vectors with a given angle between them
I'm trying to draw in OpenGL 2 vectors with a given angle (in radians) between them, something like this:
I managed to draw the vectors but I'm not sure how to place them at the specific angle:
...
0
votes
2
answers
484
views
get an angle between 2 points and rotate a point about an other point with this angle - C++
I'm basically trying to create 2D lines based on points from bezier curves.
All the points of the bezier curves are well placed and everything seems in order.
Starting with these points I'm creating 2 ...
0
votes
1
answer
649
views
How would you write a javascript function that slowly declerates a spin wheel to a pre-determined position?
I'm coding a spin wheel where the result is already determined server-side. Having the wheel land on the pre-determined result is easy. You just set the number of radians at which the wheel stops ...
1
vote
1
answer
2k
views
how to make this type gauge in flutter with dynamic section
return SfRadialGauge(
title: GaugeTitle(
text: 'Speedometer',
textStyle:
const TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold)),
axes: <RadialAxis>[
...
0
votes
1
answer
120
views
Calculate pi of a radian that can be negative or positive?
I have a variable A which is a radian angle value. I also have a variable B that should always be PI away from A. How can I verify that B is PI off of A with 0.01 accuracy in negative or positive ...
0
votes
1
answer
640
views
how to format radians units in x axis in MATLAB?
I have a data file of 77*1 which is changing based on radians. I plotted my data and its ok in terms of figure itself. however, the x axis turned to be some random numbers. How can I define the thick ...
0
votes
1
answer
971
views
Calculating degrees to radians in terms of pi
I made a code converting degrees to radians following my teacher's format but I want to try to make it in terms of pi. Right now when I plug in 30 as my degrees the output is a loooong decimal but I ...
-4
votes
1
answer
643
views
Why Java Math.toRadians() is not accurate and how to solve it?
I'm creating own Turtle app similar to python in Java. The angles taken in the instructions is in degrees. While drawing it, I have to use sin and cos which requires the angle to be in radians. So, I ...
0
votes
1
answer
96
views
Orbit Simulator in Java returning odd values for velocity etc. despite correct math
I am using LibGDX to make an orbit simulator (elliptical as planets possess their own initial velocity) and I have the physics mapped out like so:
public void move(float deltaTime, Planet planet) {...
-1
votes
2
answers
161
views
How do I make my calculator this to calculate in degrees rather than radians
I have been stuck on this for a very long bit of time. How do I make my calculator calculate in degrees rather than radians. I tried Math.toDegrees but it did not work. Thank you if you decide to help....
-1
votes
1
answer
415
views
Why does my cosine of 90 degree shows as -4.371139E-08 in output [duplicate]
This is the code
This is the Output I am getting
Console.Write("Enter angle in degrees: ");
// angle == 90
float angle = float.Parse(Console.ReadLine());
float radian = angle * (MathF.PI / ...
0
votes
1
answer
180
views
How to format radian units in y-axis
I would like to format pi-based the y-axis which is in radians. However, when I try to test a previous solution How can I set the y axis in radians in a Python plot?, the result changes the scale ...
1
vote
0
answers
33
views
Inaccurate calculations using mathematic formulas [duplicate]
I try to work with forms using CGI-scenarios. I have file servercgi.py which i use to start my server. I have form where I input three numbers. Here is code from html:
<form action="/cgi-bin/...
1
vote
4
answers
109
views
Making a clock that takes 2560ms to complete a revolution in JavaScript
I'm trying to make a clock for a Libet task - a cognitive task used by psychologists. By convention these clocks take 2560 ms to complete a revolution. Mine seems to be running quite a lot slower and ...
0
votes
1
answer
241
views
Converting from degrees to radians and back leaves a very small leftover
So I have the following javascript code:
function dosine(){
var num = document.getElementById('num').value;
console.log(num);
num = (num*Math.PI)/180;
num = Math.sin(num);
...
2
votes
3
answers
642
views
Why doesn't mean square error work in case of angular data?
Suppose, the following is a dataset for solving a regression problem:
H -9.118 5.488 5.166 4.852 5.164 4.943 8.103 -9.152 7.470 6.452 6.069 6.197 6.434 8.264 9.047 2.222
...
0
votes
3
answers
385
views
Python: Not being able to compare radians with pi values
I am writing an algorithm which should be able to determine in which quadrant a radian is based on two values that the user inputs. I think that the code is calculating the radian but I know that ...
1
vote
1
answer
412
views
Calculating the angle based on point coordinates provided in the console
using System;
namespace ProgrammingAssignment2
{
/// <summary>
/// Programming Assignment 2
/// </summary>
class Program
{
// x and y coordinates for points
...
-1
votes
3
answers
270
views
How to move an angle closer to another angle?
If I have an angle theta (radians), a small angle delta (radians) and a target angle theta prime (radians), how can I increment/decrement theta by delta such that it would move closer to the angle ...
0
votes
0
answers
409
views
Calculating distance between 2 coordinates in MS Access
Currently I am trying to populate the distance between 2 coordinates in Access. I found a VBA function online that allows me to use ACOR and RADIANS in access. The function worked, but when I attempt ...
0
votes
0
answers
80
views
Formula conversion Octave to NumPy
I am calculating the following lines in Octave:
DOA = [2.44511697; 171.03810943; -54.15891743; -106.57844237];
alfa = tand(DOA);
0.042701
-0.157703
-1.384441
3.359049
in radians I get the ...
0
votes
2
answers
68
views
Incorrect values are written to the text file
I want to write the values of a sine function to a text file. The function is
In my graphing calculator, I also have to add π if I want to plot the function in radians.
How do I have to write this ...
0
votes
3
answers
200
views
Running into errors while executing circle program in java
I am having trouble inputting the radius of a circle and angle of a circle (deg) while receiving the output with the values given plus the angle in radians, arc length and polar area all as floats. ...
4
votes
2
answers
38k
views
How do I convert degrees to radians?
I have the following function to convert from radians to degrees:
float DegreesToRadians(float degrees) {
return degrees * (PI / 180);
}
When I now do:
sinf(DegreesToRadians(90));
This returns 1,...
3
votes
1
answer
4k
views
Three.js How to convert values to degrees in the control panel using dat.GUI?
I made a simple slider in control panel to modify the position and rotation of an object.
I have no problem with the position, as the values are relative, but I'd like to show the rotation's values in ...
0
votes
3
answers
6k
views
How can I convert a degrees angle to radians effectively in Python?
i'm writing a code in Python 3 to do some calculus with some parameters that user enters with keyboard.
When I was testing the program I faced and isolated the next problem:
Evaluating the angle in ...
0
votes
0
answers
29
views
Limits of view, ignore whats behind view
there is a lots of material about this, its just my english skills of issue that mostlikely now confuses me.
I have a character, position x, y. It's angle is a. a is in angles (0 - 359). View of sight ...
2
votes
1
answer
441
views
How to convert string to radians in pandas to calculate distance between two points
I have a dataframe df:
{'city': {0: 'Adak', 1: 'Akiachak', 2: 'Akiak', 3: 'Akutan', 4: 'Alakanuk'},
'latitudedegrees': {0: '51.87957',
1: '60.88981',
2: '60.911865',
3: '54.098693',
4: '62....
0
votes
0
answers
267
views
Vector to angle conversion function sometimes returns radians and sometimes degree
I tried to write a program where a vector is calculated that bisects the angle between two lines that share one common point.
For that I've come up with some code (Since this it not the only thing I'm ...
0
votes
2
answers
250
views
Mysql query inside radians function not working. Why?
This works:
SELECT
(
radians(
44.43763930
)
)
This doesn't:
SELECT
(
radians(
SELECT
latitude
FROM
...
2
votes
2
answers
1k
views
How can I make an output in radians with pi in it?
I want to give out an angle in radians in python. I also know how to do that but is it posible to make the output like that 1 * pi instead of 3.14159 without programming it myself?
Thx for help.
2
votes
2
answers
2k
views
JS | How to lerp rotation in radians?
function lerp(start, end, amt) {
return (1-amt)*start+amt*end
}
This lerp function works perfectly with coords. I can easily lerp X from 1 to 10.
But problems appear when it comes to rotation. ...
5
votes
1
answer
161
views
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 ...
0
votes
2
answers
573
views
convering degrees to radians inside an array
I have an array A,
array([[ 1, 2, 25],
[ 3, 4, 23],
[ 2, 6, 55],
[ 9, 7, 78],
[11, 5, 47]])
I changed the last column of the array, supposedly degree values (25,23,55,...
0
votes
1
answer
1k
views
javascript canvas - line that follow mouse position
im trying to make line in canvas to follow mouse position in 360 degrees, starting from circle center.
This is my code so far but i cant make right angles. Any solution thanks.
https://jsfiddle.net/...
0
votes
1
answer
1k
views
Radians to degrees with a roundoff value between 0-360 degress
I want to convert radians to degrees with a round off function.
The degrees should come between 0-360 for all the radian values.
Say, the value I want to convert is 300(in radians)
So,
300*57.3 = ...
0
votes
1
answer
701
views
How to save a conversion from degrees to radians to variable in Python
I have little bit awkward question but I couldn't figure it out by myself. I'm working on a dataset generator for my NN in Keras, and I'm feeding it with values represented as degrees (it must be ...
0
votes
1
answer
672
views
How to switch between radians and degrees in SAS
just looking for an easy way to run trig functions in SAS without having to manually correct in each calculation. Below is what I am working with.
I am running this in SAS 9 probably, the SAS Studio ...
0
votes
0
answers
35
views
Polar coordinates and circular player scrub
I'm having issues positioning the cursor at the right point in this circular time scrubber:
I'm calculating angle with simple formula: Math.atan2(y, x).
This gives me the angle in radians, then I map ...
0
votes
1
answer
1k
views
Python Arcsin Arccos radian and degree
I am working on wind power and speed
u and vare zonal and meridional wind. (I have the values of these 2 vectors)
The wind speed is calculated by V = np.sqrt(u2*v2)
Wind direction is given by α ...
5
votes
1
answer
355
views
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 = (-...