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

How to calculate the height and width of an isometric rectangle/square

I'm writing an isometric tile game. Each tile is twice as wide as it is tall (w:h = 2:1). All tiles in a map are the same size and their width and heights are known (TileWidth and TileHeight). There can be any number of columns (>0) and rows…
Garry Pettet
  • 8,096
  • 22
  • 65
  • 103
7
votes
3 answers

Why is precomputing sin(x) *slower* than using Math.sin() in Javascript?

I've found what appears to be an interesting anomaly in JavaScript. Which centres upon my attempts to speed up trigonometric transformation calculations by precomputing sin(x) and cos(x), and simply referencing the precomputed values. Intuitively,…
David Edwards
  • 794
  • 8
  • 13
7
votes
4 answers

Fast & accurate atan/arctan approximation algorithm

Any fast & accurate atan/arctan approximation function/algorithm out there? Input: x = (0, 1] (minimum x requirement). Output: in radians double FastArcTan(double x) { return M_PI_4*x - x*(fabs(x) - 1)*(0.2447 + 0.0663*fabs(x)); } I've found…
Yingyan Wang
  • 73
  • 1
  • 1
  • 3
7
votes
1 answer

How to translate a point to specified distance at a specified angle?

I want to translate a point to specific distance, along a line whose angle is given in degrees. var initialPoint = [0,0]; //Starting Point var distance = 100; //Distance in pixels to be translated var degree = 45; //Direction of…
Rashid
  • 1,244
  • 3
  • 13
  • 29
7
votes
5 answers

How to compute sine wave with accuracy over the time

Use case is to generate a sine wave for digital synthesis, so, we need to compute all values of sin(d t) where: t is an integer number, representing the sample number. This is variable. Range is from 0 to 158,760,000 for one hour sound of CD…
7
votes
6 answers

Accuracy of Math.Sin() and Math.Cos() in C#

I am terribly annoyed by the inaccuracy of the intrinsic trig functions in the CLR. It is well know that Math.Sin(Math.PI)=0.00000000000000012246063538223773 instead of 0. Something similar happens with Math.Cos(Math.PI/2). But when I am doing a…
John Alexiou
  • 28,472
  • 11
  • 77
  • 133
7
votes
5 answers

Missing Coordinates. Basic Trigonometry Help

please refer to my quick diagram attached below. what i'm trying to do is get the coordinates of the yellow dots by using the angle from the red dots' known coordinates. assuming each yellow dot is about 20 pixels away from the x:50/y:250 red dot…
Chunky Chunk
  • 16,553
  • 15
  • 84
  • 162
7
votes
7 answers

uniform generation of 3D points on cylinder/cone

I wish to randomly and uniformly generate points on a cylinder and a cone (separately). The cylinder is defined by its center, its radius and height. Same specifications for the cone. I am able to get the bounding box for each shape so I was…
Myx
  • 1,792
  • 5
  • 23
  • 37
7
votes
2 answers

Calculate new point offset based on angle of rotation?

I am working on an application for the past few weeks which involves some trigonometry and am currently stuck. As shown in the diagram below, I have a circular item (green circle at position #1) which I know the center point (let's call that…
DataCrypt
  • 307
  • 1
  • 5
  • 15
7
votes
3 answers

3D coordinate of 2D point given camera and view plane

I wish to generate rays from the camera through the viewing plane. In order to do this, I need my camera position ("eye"), the up, right, and towards vectors (where towards is the vector from the camera in the direction of the object that the camera…
Myx
  • 1,792
  • 5
  • 23
  • 37
7
votes
2 answers

Dragging rotated text inside android canvas does not work as expected

There is something I am missing inhere so I hope you can share some light on me. I am drawing some text inside canvas. For this I have a class Word public class Word { private int x; private int y; private String text; } The…
Alin
  • 14,809
  • 40
  • 129
  • 218
7
votes
2 answers

Clojure Trigonometry

In 2014, where do I get Clojure trigonometry functions like sin and atan2 ? I see some of contrib.math is now in https://clojure.github.io/math.numeric-tower/ but that doesn't seem to have these functions.
interstar
  • 26,048
  • 36
  • 112
  • 180
7
votes
3 answers

Flipping an angle using radians

Hello all you math whizzes out there! I am struggling with a math problem I am hoping you can help me with. I have calculated an angle of direction using radians. Within OpenGL ES I move my guy by changing my point value as such: spriteLocation.x…
Scott
  • 874
  • 3
  • 12
  • 36
7
votes
1 answer

Need help for proper rectilinear projection of equirectangular panoramic image

With the algorithm below, when the projection plane is tangent to the equator (the center line of the equirectangular image), projected image looks rectilinear. But when the projection plane is tilted, (py0 != panorama.height/2), lines are…
Panoramidal
  • 309
  • 3
  • 7
7
votes
2 answers

How to uniformly spread points in circle shaped form

I've searched through a dozen questions similar to this one, but none with the same problem I've came upon. I have a map with units, 1000x1000 units, think of it as pixels. The problem is that I have to uniformly spread circle-shaped into the…
Eduard
  • 3,395
  • 8
  • 37
  • 62