Questions tagged [trigonometry]

Trigonometry is a branch of mathematics that studies triangles and the relationships between their sides and the angles between sides

Trigonometry is a branch of mathematics that studies triangles and the relationships between their sides and the angles between sides. Trigonometry defines the trigonometric functions, which describe those relationships and have applicability to cyclical phenomena, such as waves.

Trigonometry can be implemented into many programming languages, such as python. Trigonometry can be used to find an angle in a triangle using the side lengths etc.

References:

3369 questions
14
votes
1 answer

C++ library for integer trigonometry, speed optimized with optional approximations?

I've reached the point in a project where it makes more sense to start building some support classes for vectors and misc trigonometry than keep using ad-hoc functions. I expect there to be many C++ libraries for this, but I don't want to sacrifice…
porgarmingduod
  • 7,668
  • 10
  • 50
  • 83
14
votes
4 answers

Find angle of point on circle

Imagine I have drawn a circle with center coordinates (cx,cy) on the screen and a random point (A) is selected on the circle. By having the the coordinates of point A, I need to find the angle of (a). Update: I have tried using the following…
2hamed
  • 8,719
  • 13
  • 69
  • 112
14
votes
14 answers

How can I work around the fact that in C++, sin(M_PI) is not 0?

In C++, const double Pi = 3.14159265; cout << sin(Pi); // displays: 3.58979e-009 it SHOULD display the number zero I understand this is because Pi is being approximated, but is there any way I can have a value of Pi…
Adam
  • 647
  • 2
  • 8
  • 19
14
votes
3 answers

Calculating evenly spaced points on the perimeter of a circle

The math behind this question has been asked numerous times, so that's not specifically what I'm after. Rather, I'm trying to program the equation for determining these points into a loop in JavaScript, so that I can display points the evenly…
SalarianEngineer
  • 624
  • 4
  • 10
  • 20
14
votes
5 answers

How to create an "intercept missile" for a game?

I have a game I am working on that has homing missiles in it. At the moment they just turn towards their target, which produces a rather dumb looking result, with all the missiles following the target around. I want to create a more deadly flavour…
Rik Heywood
  • 13,816
  • 9
  • 61
  • 81
13
votes
4 answers

Converting polar coordinates to rectangular coordinates

Convert angle in degrees to a point How could I convert an angle (in degrees/radians) to a point (X,Y) a fixed distance away from a center-point. Like a point rotating around a center-point. Exactly the opposite of atan2 which computes the angle of…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
13
votes
1 answer

Find new coordinates of point on line in javascript

Let's say I have two points which I know: x1,y1 and x2,y2. I know I can easily calculate the length of this line with Pythagorean, but what if I want to calculate a shortened version of the line. For example, I would like the x,y coordinates 10…
jrue
  • 2,522
  • 4
  • 19
  • 25
13
votes
5 answers

Java BigDecimal trigonometric methods

I am developing a mathematical parser which is able to evaluate String like '5+b*sqrt(c^2)'. I am using ANTLR for the parsing and make good progress. Now I fell over the Java class BigDecimal and thought: hey, why not thinking about precision…
Marco
  • 133
  • 1
  • 1
  • 5
13
votes
2 answers

Calculating the Viewing Frustum in a 3D Space

I have drawn diagram after diagram of how to calculate the bounding points of the viewing frustum in a three-dimensional space. To start, I have a two sets of data containing three values each: the xyz coordinates of the camera and the rotation…
CoderTheTyler
  • 839
  • 2
  • 11
  • 30
13
votes
4 answers

Assembly code for sin(x) using Taylor expansion

In x86 Linux, how can I implement sin(x) in assembly code using Taylor Expansion?
Hamid
  • 181
  • 1
  • 2
  • 5
12
votes
10 answers

Shortest distance between two degree marks on a circle?

I'm looking for a formula to find the shortest distance in degrees between two degree marks on a circle: for instance, 30 degrees and 170 degrees (140 degrees). The two degree marks can be virtually any real number, and isn't necessarily between 0…
Joe Lyga
  • 733
  • 2
  • 7
  • 17
12
votes
9 answers

Approximating inverse trigonometric functions

I have to implement asin, acos and atan in environment where I have only following math tools: sine cosine elementary fixed point arithmetic (floating point numbers are not available) I also already have reasonably good square root function. Can I…
Matěj Zábský
  • 16,909
  • 15
  • 69
  • 114
12
votes
3 answers

how to solve cos 90 problem in java?

I have some problems with calculating cosinus 90 in Java using Math.cos function : public class calc{ private double x; private double y; public calc(double x,double y){ this.x=x; this.y=y; …
David King
  • 123
  • 1
  • 1
  • 4
12
votes
8 answers

Java Strange Behavior with Sin and ToRadians

I have been given the task of using java to produce a Sin table, however I seem to get some very weird results for some values of the input. I am using the below System.out.println("| sin(" + currentPoint + ") = " +…
Pez Cuckow
  • 14,048
  • 16
  • 80
  • 130
12
votes
1 answer

JavaScript: cotangent and arccotangent

I had searched on the internet and I could not find the method of the Math object that returns the ctg and arcctg of an angle. Is there such a method or should I just create my own function using these mathematical formulas:
s.dragos
  • 582
  • 2
  • 8
  • 24