Questions tagged [atan]

atan is a programming function that computes arc tangent. It returns the principle value of the arc tangent in radians in most programming languages.

atan is a programming function that computes arc tangent. It returns the principle value of the arc tangent in radians in most programming languages.

The first programming language to incorporate the atan function was fortan.

13 questions
5
votes
1 answer

Does atan2 required normalized vectors? Which is better to use acos or atan for angles between vectors?

When calculating the angle between two vectors, I have traditionally used acos, but this requires the two vectors to be normalised. atan2 can be used to accomplish the same (specifically atan2(b.y_, b.x_) - atan2(a.y_, a.x_)), does this require…
lfgtm
  • 1,037
  • 6
  • 19
2
votes
1 answer

Using atan2 to turn a range from - 1 to 1 into degrees

I'm trying to use atan2 to turn a range of - 1 to 1 into radians and then from radians into degrees. However atan2(0,1) is equal to 0 when it should be equal 90.0 what am I doing wrong here? float radians = atan2(0, 1); float degrees = (radians *…
Kingpin
  • 85
  • 8
1
vote
1 answer

how to convert Cartesian coordinates to polar with certain origin?

cart2polar assumes 0 ,0 origin; I need to know how to change it. My origin is the x and y y <- 0.23 x <- 81.05 cart2polar <- function(x, y) { data.frame(theta = sqrt(x^2 + y^2), r = atan2(x,y)) }
1
vote
1 answer

Numerical evaluation of arctangent functions

I am having difficulties to interpret results of arctangent functions. This behaviour is consistent for all implementations I came across, so I will here limit myself to NumPy and MATLAB. The idea is to have circle of randomly placed points. The…
rad
  • 157
  • 1
  • 9
1
vote
1 answer

Performing a calculation over an x,y grid in Python

I'd like to perform a calculation over an X, Y data to produce a calculated Z. My code is below: Example Data set for injection_wells.csv Name X Y Q MW-1 2517700 996400 5 MW-2 2517770 996420 5 import pandas as pd import math import…
Melanie
  • 109
  • 1
  • 9
1
vote
1 answer

C# finding angle between 2 given points

In the program that I'm working on, I have an object (the player) in the shape of a triangle, and that triangle is supposed to rotate always facing the mouse. given this two points I have tried different equations I've found online but non of them…
insignia
  • 51
  • 1
  • 10
0
votes
1 answer

Why Math.atan() and Math.atan2() are returning different results?

I have the below function returning me angles in radians from three points coded as below: function pointsToAngles(x1, y1, x2, y2, cpx, cpy) { const r1 = Math.atan((y1 - cpy)/(x1 - cpx)); const r2 = Math.atan((y2 - cpy)/(x2 - cpx)); …
Igor Shmukler
  • 1,742
  • 3
  • 15
  • 48
0
votes
1 answer

How to fit a compose-arctangent function?

I'm trying to fit a double broken profile function which consists of the arctangent function. My code doesn't seem to be working: XX=np.linspace(7.5,9.5,16) YY=np.asarray([7,7,7,7.1,7.3,7.5,8.4,9,9.3,9.6,10.3,10.2,10.4,10.5,10.5,10.5]) def…
Calandra
  • 11
  • 1
0
votes
0 answers

Conversion from cartesian to spherical coordinates and floating-point imprecision

I need to convert cartesian to spherical coordinates, but my implementation is suffering from floating-point imprecision. Here's what I'm doing until now: template Point3 cartesian_to_spherical(Point3 const&…
0xbadf00d
  • 17,405
  • 15
  • 67
  • 107
0
votes
0 answers

Weird power series coefficients in reference implementations of atan()

glibc (more precise, libm) and many other C libraries contain the following software implementation of the atan() function (see here): /* s_atanf.c -- float version of s_atan.c. * Conversion to float by Ian Lance Taylor, Cygnus Support,…
Binarus
  • 4,005
  • 3
  • 25
  • 41
-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…
-2
votes
1 answer

Javascript calculates ATAN function differently than Excel does

I was given an Excel table with couple of formulas that I need to translate into a simple javascript calculator. I'm having issues with Angle of View. Excel formula for qhAFOV= 2*DEGREES(ATAN(qhF/2*qf)) If qhf = 12; qf = 3.4; The result should be…
MarioFR
  • 11
  • 1