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
8
votes
1 answer

How are sin and cos implemented hardware wise?

I have been doing some research as to how sine and cosine can be calculated. I found a couple of "standard" methods, including a lookup table, a CORDIC algorithm, and Taylor series. I also found that most modern processors have an assembler…
Borgcube
  • 83
  • 1
  • 3
8
votes
4 answers

Python Uniform distribution of points on 4 dimensional sphere

I need a uniform distribution of points on a 4 dimensional sphere. I know this is not as trivial as picking 3 angles and using polar coordinates. In 3 dimensions I use from random import random u=random() costheta = 2*u -1 #for distribution between…
8
votes
1 answer

Find corner points of a Quadrilateral from set of points

I try to get the corner points of a Quadrilateral from set of points. The set of points are ordered and describe an outline Sometimes the outline has some noise (see 2nd picture) The searched corner points don't have to be points out of the given…
Schaltfehler
  • 140
  • 11
7
votes
3 answers

Java: Finding the Outermost Vertices of a Convex Polygon

Original post: I'm trying to find the outermost vertices of a convex polygon (with relation to a point P outside the polygon). For now, I'm only concerned with rectangles (however, I'd like an algorithm that works with any convex polygon). My plan…
Peter
  • 4,021
  • 5
  • 37
  • 58
7
votes
7 answers

How to determine the accuracy of Pi (π)

Optimizing a game we're developing, we're running into the phase where every CPU cycle won counts. We using radians for position calculations of objects circling around other objects and I want to cut the needless accuracy in my lookup tables. For…
Kriem
  • 8,666
  • 16
  • 72
  • 120
7
votes
1 answer

3d rotation around the origin

I know there are plenty of questions about 3d rotation that have been answered here but all of them seem to deal with rotational matrices and quaternions in OpenGL (and I don't really care if I get gimbal lock). I need to get 3d coordinates…
Mac Goldwhite
  • 73
  • 1
  • 1
  • 4
7
votes
2 answers

Cosine Similarity Code (non-term vectors)

I am trying to find the cosine similarity between 2 vectors (x,y Points) and I am making some silly error that I cannot nail down. Pardone me am a newbie and sorry if I am making a very simple error (which I very likely am). Thanks for your help …
Mikos
  • 8,455
  • 10
  • 41
  • 72
7
votes
1 answer

Accuracy of FSIN and other x87 trigonometric instructions on AMD processors

On Intel processors, x87 trigonometric instructions such as FSIN have limited accuracy due to the use of a 66-bit approximation of pi even though the computation itself is otherwise accurate to the full 64-bit mantissa of an 80-bit…
bwDraco
  • 2,514
  • 2
  • 33
  • 38
7
votes
2 answers

How to calculate sine, cosine in Less?

Trying to convert the following php method to use in a .less stylesheet: In Less, how I might one implement a…
tester
  • 22,441
  • 25
  • 88
  • 128
7
votes
4 answers

Triangle Trigonometry (ActionScript 3)

I am trying to write a formula in ActionScript 3 that will give me var "z" (please see image below) in degrees, which I will then convert to radians. I will already know the value of vars "x" and "y". Using trigonometry, how can I calculate the…
tags2k
  • 82,117
  • 31
  • 79
  • 106
7
votes
2 answers

NAudio playing a sine wave for x milliseconds using C#

I am using NAudio to play a sinewave of a given frequency as in the blog post Playback of Sine Wave in NAudio. I just want the sound to play() for x milliseconds and then stop. I tried a thread.sleep, but the sound stops straightaway. I tried a…
amcashcow
  • 724
  • 1
  • 6
  • 16
7
votes
3 answers

C++ - Play back a tone generated from a sinusoidal wave

Hey everyone, I'm currently trying to figure out how to play back a tone I have generated using a sinusoidal wave. Here's my code: #include #include #include #include using namespace std; int main…
Moonlight293
  • 197
  • 1
  • 5
  • 13
7
votes
2 answers

MySQL Bug? (Trigonometry)

I was optimizing a query by precalculating some trigonometry-funnctions for the fields in a table, when I stumbled on this: SELECT 6371 * acos( 0.793521289617132 * 0.793521289617132 + 0.608542490648241 * 0.608542490648241 * cos( 0.235244203230056 -…
Dexter
  • 3,072
  • 5
  • 31
  • 32
7
votes
1 answer

Webassembly trig functions possible?

Does webassembly have support for trig functions? I mean like built in support because it seems we have to import those from javascript. It would be great if we had things like: f32.sin f32.cos If it makes any sense. If they dont exist I assume its…
Asperger
  • 3,064
  • 8
  • 52
  • 100
7
votes
4 answers

Draw square with polar coordinates

I have a square, where the closest points are 1 unit away from the center. See my ascii diagram below: +-----------+ | | | x | |-----+ | | | | | +-----------+ Therefore, the distance from the origin to the…
Joel
  • 2,654
  • 6
  • 31
  • 46