trigonometry

Define a function for a circle caps the end of a line segment.

I need a function that returns points on a circle in three dimensions. The circle should "cap" a line segment defined by points A and B and it's radius. each cap is perpendicular to the line segment. and centered at one of the endpoints. Here is a shitty diagram ...

How to implement sineWaveTo squareWaveTo and sawWaveTo lines in html5 canvas 2d context?

I would like to try an implement these so that they can be used in a manner similar to lineTo(). Starting from the current point, given the ending coordinates the functions would draw either a square, saw, or sine line all the way to the the ending coordinates. I dont know if we can factor in both Amplitude AND Frequency because I guess...

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 the problem around slope instead of angles. So that means a couple division oper...

Calculating the angle (of the line) between two points on a wrapping plane

OK, so I have a play field of 512x512 which wraps around, -32 becomes 512 for both x and y. Now I need to calculate the angle between two entities, I have the following code as a kind of workaround, it works most of the time, but sometimes it still fails: Shooter.getAngle = function(a, b) { var ax = a.x; var bx = b.x; if ...

Calculating the coordinates of the third point of a triangle

OK, I know this sounds like it should be asked on math.stackoverflow.com, but this is embarrassingly simple maths that I've forgotten from high-school, rather than advanced post-graduate stuff! I'm doing some graphics programming, and I have a triangle. Incidentally, two of this triangle's sides are equal, but I'm not sure if that's rel...

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 3D game development)? Thanks. ...

Calculating co-ordinates for a sprite in C++

I am trying to calculate the angle of movement for a sprite in C++. Although at the moment I am just using the console to output my results. My problem is that when My results are shown in the console, I cannot get the x axis to go into minus numbers. Unfortunately I have only just learned about basic trig so I have no idea if I am ju...

__CIasin and Is Arcsine much slower than sine in .NET?

I've been running som eprofile tests of a slow area of code. This is with Visual Studio 2008 and .NET 2 (fully patched). About 32% of my computation is used by the Haversine formula. This requires two sines, two cosines, a square root, and an arc sine - all using the standard .NET Math library (ie. Math.Sin, Math.Asin, Math.Sqrt). I've b...

Weird output in bearing between two coordinate calculation

I have a method that that is suppose to calculate the bearing between two geographic coordinates (in 40.7486, -73.9864 example format). I am however, having an issue where the heading that it calculates is different from the heading I calculate using a tried and tested application. For example, the initial bearing between of the follow...

How to calculate points of Chord

Hi, I need to calculate a chord`s starting and ending point, now I have the starting point which lies on the circumfrence of the circle and I also have the angle between starting point and ending point, but I cannot seem to find a way to determine the end of point of chord as it should lie on the circumfrence , I also have the centre an...

Rotated rectangle bounding box size

If I have a given rectangle, with the width w, height h and angle r How large does another rectangle which contains all points of the rotated rectangle need to be? I would need this to perform fast bounding box checks for a 2D physics engine I am making ...

Math Equations for Random Snow in a Snow Globe

I've been experimenting with this and I haven't been able to come up with an adequate solution. Hoping one of you Mathletes can point me in the right direction. I'm building a Snow Globe in ActionScript 3 and I need to come up with a set of equations to control two level of snowflakes - one level random, and the other interactive where ...

Weird Great Circle Distance calculation

Hi, I have some problems with a great circle distance calculation using a map. Context: http://airports.palzkill.de/search/ The map is supposed to work as a great circle distance search map - you move the circles center marker or the radius marker, and the circle gets smaller or larger. For debug purposes, the boxes title field shows ...

Java 1.5 Issue with drawing shape using lines and angles

Hey, I'm trying to write a method that takes a starting Cartesian coordinate(x,y) an angle (in degrees), a length and a number of sides and draws a shape to an applet. So far this is what I have but, I cant figure out what I'm doing wrong. I plan on using line transformations for the actual angle change and that's not written in yet but ...