Questions tagged [atan2]

A function in many programming languages for computing the arctangent with two arguments

A function in many programming languages for computing the arctangent with two arguments

152 questions
0
votes
1 answer

Calc atan2 with neon

I have been found a lib but there was not void atan2fv_neon_hfp(float *y, float *x,float *res,int len) to calculate len floats once. How can I write a neon version for atan2fv_neon_hfp ?
0
votes
2 answers

atan2 (y,x) when y & x are very small

I tried atan2 in C with argument of about 10-14. It gives a wrong answer: around 90 instead of zero, e.g.: void main() { double a =3.4e-14; double b=9e-10; atan2(3.4e14,9.0e-9); // returns ~90 instead of zero or Not a number }
JISHY
  • 1
0
votes
1 answer

Rotation using atan2 is acting strangely

I'm trying to create a basic model editor but either I'm not understanding atan2 or it's not the right solution for me to be using, because it is returning unpredictable and frustrating results. I've been using a bit of code borrowed from another…
cstream24
  • 25
  • 7
0
votes
2 answers

Why did atan2 give me different values from asin?

I was trying to calculate the value of an angle of a right triangle. The sides were the opposite, and the hypotenuse, which happens to be adjacent to the angle as well. One code written in Java used atan2 to get the angle. When I used atan2 in C, I…
0
votes
1 answer

Fast trigonometric approximations in python

I am using python for trajectory comparison calculations that require a lot of great circle computations. These calculations require a lot of trigonometric functions and the script is currently very slow with the regular math.atan2 etc.…
0
votes
2 answers

how to use atan2 in my android game

I am making a side scroller shooting game. I currently have my character shooting horizontally to the right. I would like to get him shoot anywhere on the screen. I understand that I should use atan2 to figure what angle my bullet will be shot at…
-1
votes
1 answer

Pointing to mouse position Jquery

I am trying to make a pointer that moves according to the position of your mouse. I am using Jquery and transforming the radians to degrees, and a plugin for jquery that is called rotate.I set up all the conditions butt the pointer will not have a…
John the horn
  • 131
  • 16
-1
votes
1 answer

Atan2 Precision Problems

when I tried to calculate the homogeneous matrix in two different ways, there was a very small discrepency, 0 and 0.000000000000000061229677524420688 are in the same location of the two matrice. The number 0.000000000000000061229677524420688 is…
Liu
  • 413
  • 4
  • 11
-1
votes
2 answers

Finding angle of a line between two revolving points in two orbits, from one pont to other and not viceversa in JavaFX

I am new to JavaFX and really weak in Trigonometry and Math and have been trying to find the angle (of a line) between two points. These two points revolve around a common central point in two different perfect circular orbits. These points…
-1
votes
4 answers

Convert standard 360-degree to atan2

I need to reverse calculation of standard 360 angle to atan2. It's my standard angle calulation Standard angle = (int) Math.toDegrees(Math.atan2(y,x)); if(angle < 0) angle += 360; I need Math.atan2 value from angle how to achieve that.
sabish
  • 31
  • 1
  • 8
-1
votes
1 answer

Java Atan2() Sort violates general contract?

I'm having trouble with a comparison method being used in Java/Processing. It says it violates its general contract, which I understand means it doesn't work on the relationships between the items consistently... But I don't understand why. Since it…
-1
votes
2 answers

How to change the "0°" position of a Knob in Snap.svg Library

I created a Knob (basically a circle) using the Snap.svg library which I rotate using Snap's transform function and rotate parameter. I use two Snap built in functions, Snap.deg() and Snap.angle() to rotate the knob to a certain position (so that…
Startec
  • 12,496
  • 23
  • 93
  • 160
-2
votes
1 answer

Java a way to get from an angle the atan2 value (alpha)?

double dx = mx - px; double dy = my - py; double alpha = Math.atan2(dy, dx); float angle = (float) Math.toDegrees(alpha); angle += 10; Now I want to convert the angle to the alpha value (atan2) is there a way how i can do…
CodingJava
  • 17
  • 2
-2
votes
1 answer

radian atan2 is showing opposite values then what they need to be

double shootx = vx + dx / t0; double shooty = vy + dy / t0; double radians = atan2((double)-shooty, shootx); deg_to_aim = (int)((radians * 360) / (2 * 3.141592653589793238462)); myprintf("(A) radians = %f deg to aim = %d\n", radians,…
SSpoke
  • 5,656
  • 10
  • 72
  • 124
-3
votes
2 answers

Math.Atan2 gives incorrect value when converting to degrees

I'm trying to measure the angle between two points relative to the X-axis, in degrees. From looking at other posts on stack overflow, I've been using the following code: private double GetAngleBetweenTwoPoints(double x1, double y1, double x2, double…
1 2 3
10
11