trigonometry

Finding the coordinates on the edge of a circle

Using C#: How do I get the (x, y) coordinates on the edge of a circle for any given degree, if I have the center coordinates and the radius? There is probably SIN, TAN, COSIN and other grade ten math involved... :) ...

OpenGL: Calculating z-value for 1:1 pixel ratio

Hi folks, I have a 256x256 texture in my view frustum that I need to move to a z-position where the texture is replicated on-screen at ACTUAL size. What I have so far is: const float zForTrueScale = -((itemSize/2) / tanf(DEGREES_TO_RADIANS(fieldOfView/2)) ) * 2; where itemSize is the size of my texture in world space (2.0 u...

Finding an original rectangle's dimensions from rotation and bounding box dimensions.

In AS3, I have a Sprite that has a Z axis rotation applied. How do I calculate that Sprite's dimensions (it's original size) from Sprite.rotationZ and Sprite.getRect(...)? ...

3d Parabolic Trajectory

Hi, I'm trying to figure out some calculations using arcs in 3d space but am a bit lost. Lets say that I want to animate an arc in 3d space to connect 2 x,y,z coordinates (both coordinates have a z value of 0, and are just points on a plane). I'm controlling the arc by sending it a starting x,y,z position, a rotation, a velocity, and a...

Will Decimal or Double work better for translations that need to be accurate up to .00001?

I'm an inspector at a machine shop. I have an html report generated by another inspector that has some problems I need to fix. This isn't the first time: I need something better than PowerShell and RegEx. (Fear not internet warriors, I know I shouldn't use RegEx for html. I'm using HtmlAgilityPack now.) I'm aware there are a lot of simi...

Finding Signed Angle Between Vectors

How would you find the signed angle theta from vector a to b? And yes, I know that theta = arccos((a.b)/(|a||b|)). However, this does not contain a sign (i.e. it doesn't distinguish between a clockwise or counterclockwise rotation). I need something that can tell me the minimum angle to rotate from a to b. A positive sign indicates a ...

Constraining the drawing of a line to 45 degree angles

I have the start point (x1,y1) and the desired length and angle of the line. If the angles were directions, 0 degrees is W, 90 is N, 180 is E and 270 is S. I can modify this if needed. How can I use the start point, length and angle to determine the end point(x2, y2)? ...

Java BigDecimal trigonometric methods

Hi folks, I am developing a mathematical parser which is able to evaluate String like '5+b*sqrt(c^2)'. I am using ANTLR for the parsing and make good progress. Now I fell over the Java class BigDecimal and thought: hey, why not thinking about precision here. My problem is that the Java API does not provide trigonometric methods for Big...

AS3 Circling the stage

I am trying to have flash draw a line from the center of the stage out and increment around the stage. Not sure what math I would use to do this though. So far I have the line going out to a certain point but not sure how to change that point so that it circles around whatever the dimensions of my stage would be. So far I have this: va...

draw lines protruding from a circle

So I've been messing around with http://processingjs.org/. I want to draw a circle that has a bunch of lines protruding from it. Each of these lines should perpendicular to the tangent of the circle. I don't necessarily need to know how to do this in processing.js, but I don't really remember my trigonometry, so more of an explanation ...

Calculate second point knowing the starting point and distance

Hi, using a Latitude and Longitude value (Point A), I am trying to calculate another Point B, X meters away bearing 0 radians from point A. Then display the point B Latitude and Longitude values. Example (Pseudo code): PointA_Lat = x.xxxx; PointA_Lng = x.xxxx; Distance = 3; //Meters bearing = 0; //radians new_PointB = PointA-Distance;...

Finding intersect in triangle from a vector originating from a particular side

I know the coordinates of A, B and C.. I also know of a vector V originating from C.. I know that the vector intersects A and B, I just don't know how to find i. Can anyone explain the steps involved in solving this problem? Thanks alot. http://img34.imageshack.us/img34/941/triangleprob.png ...

Rotation towards an object in 3d space

hello, i have two coordinates on a 2d plane in 3d space, and am trying to rotate one coordinate (a vector) to face the other coordinate. my vertical axis is the y-axis, so if both of the coordinates are located flat on the 2d plane, they would both have a y-axis of 0, and their x and z coordinates determine their position length/width-w...

Knowing two points of a rectangle, how can I figure out the other two?

Hey there guys, I'm learning processing.js, and I've come across a mathematical problem, which I can't seem to solve with my limited geometry and trigonometry knowledge or by help of Wikipedia. I need to draw a rectangle. To draw this rectangle, I need to know the coordinate points of each corner. All I know is x and y for the midpoints...

acceleration ramp "increments" for Counter AS3

My counter goes to 100 at a constant speed. Is there a way to ramp the speed of a counter? Flash can use trigonometry values to effect speed, but I don't know if that can change the timer class on-the-fly. There's a couple parts to it. (a.) ramp the speed of a counter? (b.) ramp in certain parts? - have a range - 90-100 starts ram...

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 zero. Math.cos(Math.PI/2) = 6.123233995736766E-17 Math.ulp(Math.cos(Math.PI/2)) = 1.2325951644078...

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 -= playerSpeed * cosf(playerRadAngle); spriteLocation.y -= playerSpeed * sinf(playerRad...

Calculate the cosine of a sequence

Hi, I have to calculate the following: float2 y = CONSTANT; for (int i = 0; i < totalN; i++) h[i] = cos(y*i); totalN is a large number, so I would like to make this in a more efficient way. Is there any way to improve this? I suspect there is, because, after all, we know what's the result of cos(n), for n=1..N, so maybe there's so...

Actionscript 3 3D sizing problem

I have an application where I can have an image moving towards the eye. When the image enlarged, I would like to have it resized as 635 px where initial size was 220 px. I have the image with starting position as 0 in z axis. I am wanting to calculate the distance from starting position to the resized image. I have already calculate th...

How to find relation between change in latitudes at centre of map and top/bottom

Hi, Im having little trouble finding a relation between the movement at centre and edge of a circle, Im doing for panning world map,my map extent is 180,89:-180,-89, my map pans by adding change(dx,dY) to its extents and not its centre. Now a situation has arrrised where I have to move the map to a specific centre, to calculate the chan...