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
9
votes
8 answers

Trigonometry and Game Development

I understand what sin and cos (and some other trigonometric functions) means, but I don't really get what kind of problems they solve. Can you show me some real world examples when you'd use some of these functions in game development (specifically…
Alon Gubkin
  • 56,458
  • 54
  • 195
  • 288
9
votes
4 answers

How to compute the sine of huge numbers

For several days, I've been wondering how it would be possible of computing the sine of huge numbers with magnitude around 100000! (radians). The factorial is just an example the number itself can be any not just a factorial product ...) I obviously…
borchero
  • 5,562
  • 8
  • 46
  • 72
9
votes
3 answers

Using python to calculate radial angle, in clockwise/counterclockwise directions, given pixel coordinates (and then vice-versa)

For a context I won't get into, I need two functions that are essentially reciprocals of each other. angle_to() should return the number of degrees a clockhand would have to turn to travel from 0° to the line connecting p1 to p2 (ie. p1 is the…
Jonline
  • 1,677
  • 2
  • 22
  • 53
9
votes
1 answer

Calculate rotation velocity and naturally rotate view iOS

I have a circle-shaped view and have it rotate via the following code overriding touchesBegan(touches:, withEvent:) and touchesMoved(touches:, withEvent:). var deltaAngle = CGFloat(0) var startTransform: CGAffineTransform? override func…
Big_Mac
  • 2,975
  • 4
  • 20
  • 36
9
votes
1 answer

How Were These Coefficients in a Polynomial Approximation for Sine Determined?

Background: I'm writing some geometry software in Java. I need the precision offered by Java's BigDecimal class. Since BigDecimal doesn't have support for trig functions, I thought I'd take a look at how Java implements the standard Math library…
freefall83
  • 145
  • 1
  • 7
9
votes
2 answers

R: How to generate a noisy sine function

I am still pretty new to the whole R-thing. I have the following aim; I have a sine function that describes a calcium particle number over time: something like y = a * sin (b*t) + c Since in reality the generation and removal of calcium is described…
Arne
  • 337
  • 1
  • 6
  • 17
9
votes
5 answers

Calculation sine and cosine in one shot

I have a scientific code that uses both sine and cosine of the same argument (I basically need the complex exponential of that argument). I was wondering if it were possible to do this faster than calling sine and cosine functions separately. Also I…
Gappy Hilmore
  • 440
  • 4
  • 13
9
votes
3 answers

Calculating magnetic heading using raw accelerometer and magnetometer data

I have an accelerometer and magnetometer each producing raw X, Y and Z readouts. From this I need to determine the magnetic heading of an object. I'm not that great at trig, but I've put together a formula that does respond pretty well to the…
M. Ryan
  • 6,973
  • 11
  • 52
  • 76
9
votes
2 answers

Rotate point in rectangle

I have a point in a rectangle that I need to rotate an arbitrary degree and find the x y of the point. How can I do this using javascript. Below the x,y would be something like 1,3 and after I pass 90 into the method it will return…
Dested
  • 6,294
  • 12
  • 51
  • 73
9
votes
3 answers

Java Math.cos() Method Does Not Return 0 When Expected

Using Java on a Windows 7 PC (not sure if that matters) and calling Math.cos() on values that should return 0 (like pi/2) instead returns small values, but small values that, unless I'm misunderstanding, are much greater than 1 ulp off from…
dimo414
  • 47,227
  • 18
  • 148
  • 244
9
votes
4 answers

tan 45 gives me 0.9999

Why does tan 45(0.7853981633974483 in radian) give me 0.9999? What's wrong with the following code? System.out.println(Math.tan(Math.toRadians(45.0)) ); I don't think there's any typo in here. So what's the solution here?
siaooo
  • 1,827
  • 3
  • 23
  • 25
9
votes
2 answers

math.sin incorrect result

>>> import math >>> math.sin(68) -0.897927680689 But sin(68) = 0.927 (3 decimal places) Any ideas about why I am getting this result? Thanks.
Strigoides
  • 4,329
  • 5
  • 23
  • 25
8
votes
5 answers

Best way to get cos(a) from sin(a)

Having s as sine of some (unknown) angle "a", what is the fastest way to get the "cosine of a"? I know two obivious ways: c = cos(asin(s)); and c = sqrt(1 - s*s); But I don't know how the implementation of the functions cos(), asin() and sqrt()…
lvella
  • 12,754
  • 11
  • 54
  • 106
8
votes
1 answer

Find degrees (0-360º) of point on a circle

I'm working on a small webapp in which I need to rotate shapes. I would like to achieve this by grabbing a point on a circle and dragging it around to rotate the image. Here's a quick illustration to help explain things: My main circle can be…
Darren Newton
  • 2,847
  • 1
  • 29
  • 31
8
votes
4 answers

Why can cosine similarity between two vectors be negative?

I have 2 vectors with 11 dimentions. a <- c(-0.012813841, -0.024518383, -0.002765056, 0.079496744, 0.063928973, 0.476156960, 0.122111977, 0.322930189, 0.400701256, 0.454048860, 0.525526219) b <- c(0.64175768, 0.54625694, …
Robin
  • 81
  • 1
  • 1
  • 2