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
22
votes
5 answers

c++ libstd compute sin and cos simultaneously

In C library math.h, there was a sincos function which was pretty efficient, because it computed both sine and cosine in a time closer to a single call to sin() or cos() than to the total time of calling both. Is there such function in C++ standard…
galinette
  • 8,896
  • 2
  • 36
  • 87
22
votes
2 answers

Rotate a point around another point

I have a task to draw a specific graphic. As part of this task I need to rotate some dot's on 45 degrees. I've spent already 2 days trying to calculate a formula, but just couldn't get it right. I've been searching all over the place including this…
Allan Spreys
  • 5,287
  • 5
  • 39
  • 44
22
votes
5 answers

Inverse of math.atan2?

What is the inverse of the function math.atan2 I use this in Lua where I can get the inverse of math.atan by math.tan. But I am lost here. EDIT OK, let me give you more details. I needed to calculate angle between 2 points (x1,y1) and (x2,y2) and…
SatheeshJM
  • 3,575
  • 8
  • 37
  • 60
21
votes
8 answers

Computational cost of trig functions

Possible Duplicate: How do Trigonometric functions work? What actually goes into the computation of trig functions like Sin, Cos, Tan and Atan? I think I've found an optimization in my code where I can avoid using any of these functions and base…
ack
  • 14,285
  • 22
  • 55
  • 73
20
votes
4 answers

Detecting if angle is more than 180 degrees

I'm working on a problem that the professor assigned, and I'm having a problem looking for a way to detect if the angle between 3 points is more than 180 degrees, e.g: I want to detect if alpha is more than 180 degrees. Anyways, my professor has a…
Richie Li
  • 1,257
  • 2
  • 13
  • 20
20
votes
12 answers

Fast transcendent / trigonometric functions for Java

Since the trigonometric functions in java.lang.Math are quite slow: is there a library that does a quick and good approximation? It seems possible to do a calculation several times faster without losing much precision. (On my machine a…
Dr. Hans-Peter Störr
  • 25,298
  • 30
  • 102
  • 139
20
votes
7 answers

Angle between 3 points?

Given points ABC, how could I find angle ABC? I'm making a feehand tool for a vector drawing application and to minimize the number of points it generates, I wont add a points unless the angle of the mouse position and the last 2 points is greater…
jmasterx
  • 52,639
  • 96
  • 311
  • 557
20
votes
5 answers

Given an angle and length, how do I calculate the coordinates

Assuming the upper left corner is (0,0) and I'm given an angle of 30 degrees, a starting point of (0,300), a line length of 600, how do I calculate the ending point of the line so that the line is representative of the angle given. The C…
amanda
  • 601
  • 2
  • 8
  • 14
19
votes
2 answers

Calculate center of SVG arc

I have the following information: radiusX (rx) radiusY (ry) x1 y1 x2 y2 The SVG spec allows you to define an arc by specifying its radius, and start and end points. There are other options such as large-arc-flag and sweep-flag which help to define…
James
  • 109,676
  • 31
  • 162
  • 175
19
votes
1 answer

Implementation of sinpi() and cospi() using standard C math library

The function sinpi(x) computes sin(πx), and the function cospi(x) computes cos(πx), where the multiplication with π is implicit inside the functions. These functions were initially introduced into the C standard math library as an extension by Sun…
njuffa
  • 23,970
  • 4
  • 78
  • 130
19
votes
3 answers

How is arctan implemented?

Many implementation of the library goes deep down to FPATAN instuction for all arc-functions. How is FPATAN implemented? Assuming that we have 1 bit sign, M bits mantissa and N bits exponent, what is the algorithm to get the arctangent of this…
19
votes
11 answers

Determine if angle lies between 2 other angles

I am trying to figure out whether a angle lies between 2 other angles. I have been trying to create a simple function to perform this but none of my techniques will work for all possible values of the angles. Can you help me edit my function to…
sazr
  • 24,984
  • 66
  • 194
  • 362
18
votes
7 answers

Is there a fast Way to return Sin and Cos of the same value in Python?

I need to return the sin and cos values of every element in a large array. At the moment I am doing: a,b=np.sin(x),np.cos(x) where x is some large array. I need to keep the sign information for each result, so: a=np.sin(x) b=(1-a**2)**0.5 is not…
rylirk
  • 179
  • 2
  • 6
18
votes
3 answers

Calculating angles between line segments (Python) with math.atan2

I am working on a spatial analysis problem and part of this workflow is to calculate the angle between connected line segments. Each line segment is composed of only two points, and each point has a pair of XY coordinates (Cartesian). Here is the…
Alex Tereshenkov
  • 3,340
  • 8
  • 36
  • 61
17
votes
2 answers

rotating a quaternion on 1 axis?

I have a model rotated by a quaternion. I can only set the rotation, I can't add or subtract from anything. I need to get the value of an axis, and than add an angle to it (maybe a degree or radian?) and than re-add the modified quaternion. How can…
William
  • 8,630
  • 23
  • 77
  • 110