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
17
votes
7 answers

making a sine wave steeper?

I've written a a little function that gives me out a value based on a sine wave when I put in a float between 0 and 1. I'm using it to lerp things around in a game. public static class Utilities { public static float SineMe(float prop) { …
Guye Incognito
  • 2,726
  • 6
  • 38
  • 72
16
votes
3 answers

How to find x and y coordinates on a flipped circle using javascript methods

I am trying to find the X, Y points on a circle where 0 degrees starts at the top of the circle and moves clockwise. Typically, to find the x, y coordinates on a circle with a known radius and angle you could simply use the formula x =…
gwydion93
  • 1,681
  • 3
  • 28
  • 59
16
votes
3 answers

Proper Trigonometry For Rotating A Point Around The Origin

Do either of the below approaches use the correct mathematics for rotating a point? If so, which one is correct? POINT rotate_point(float cx,float cy,float angle,POINT p) { float s = sin(angle); float c = cos(angle); // translate point back…
Joshua
  • 6,643
  • 15
  • 55
  • 76
16
votes
8 answers

Inner angle between two lines

I have two lines: Line1 and Line2. Each line is defined by two points (P1L1(x1, y1), P2L1(x2, y2) and P1L1(x1, y1), P2L3(x2, y3)). I want to know the inner angle defined by these two lines. For do it I calculate the angle of each line with the…
osanchezmon
  • 544
  • 1
  • 4
  • 18
16
votes
4 answers

Why are there no asin2() and acos2() functions similar to atan2()?

From my understanding, the atan2() function exists in programming languages because atan() itself cannot always determine the correct theta since the output is restricted to -pi/2 to pi/2. If this is the case, then the same problem applies to both…
user4096893
16
votes
14 answers

Calculating Distance Between 2 Cities

How do you calculate the distance between 2 cities?
Krishna Kumar
  • 4,834
  • 13
  • 46
  • 46
16
votes
5 answers

Using "sincos" in Java

In a lot of situations I not only need the sine, but also the cosine of the same parameter. For C, there is the sincos function in the common unix m math library. And actually, at least on i386, this should be a single assembly instruction,…
Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
16
votes
7 answers

C++ (and maths) : fast approximation of a trigonometric function

I know this is a recurring question, but I haven't really found a useful answer yet. I'm basically looking for a fast approximation of the function acos in C++, I'd like to know if I can significantly beat the standard one. But some of you might…
Seub
  • 2,451
  • 4
  • 25
  • 34
15
votes
7 answers

Sine Wave Sound Generator in Java

What's the simplest way to generate a sine wave sound at any frequency in Java? A sample size more than 2 bytes would help, but it doesn't really matter.
milo
  • 555
  • 2
  • 7
  • 13
15
votes
2 answers

RuntimeWarning: invalid value encountered in arccos

I am new to using Python but getting along with it fairly well. I keep getting the error you see below and not sure what the problem is exactly as I believe the values are correct and stated. What do you think the problem exactly is? I am trying to…
Ali R.
  • 433
  • 2
  • 4
  • 11
15
votes
3 answers

Radian measure in sin in R?

I want to calculate the following in R: sin(52.517°) and this should be equal to 0.79353. But when I code sin(52.517) I get 0.777119 So how can I get the 0.79353. I am not good in math, but I know something is not working with degrees and the…
Jen Bohold
  • 1,038
  • 2
  • 10
  • 17
15
votes
7 answers

get cosine similarity between two documents in lucene

i have built an index in Lucene. I want without specifying a query, just to get a score (cosine similarity or another distance?) between two documents in the index. For example i am getting from previously opened IndexReader ir the documents with…
maiky
  • 3,503
  • 7
  • 28
  • 28
15
votes
4 answers

Find the normal angle of the face of a triangle in 3D, given the co-ordinates of its vertices

As you may be able to tell from this screenshot, I am trying to make a physics engine for a platformer I am working on, but I have run into a definite problem: I need to be able to find out the angle of any one of the triangles that you can see make…
Chris
15
votes
1 answer

More elegant way to resize a sector path using Raphaël JS and SVG?

I am using Raphaël for the first time with little svg experience and I need someone who is really knowledgeable with these two to help me. I have created a pie chart with dynamic sectors. The sectors can be resized by dragging on the round buttons.…
T. Junghans
  • 11,385
  • 7
  • 52
  • 75
15
votes
4 answers

Most efficient way to find distance between two circles in java?

So apparently calculating square roots is not very efficient, which leaves me wondering what the best way is to find out the distance (which I've called range below) between two circles is? So normally I would work out: a^2 + b^2 = c^2 dy^2 + dx^2…
kiman
  • 359
  • 5
  • 13