trigonometry

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 at a right angle (i think that's what it's called) how do i get their coordinates? i beli...

moving CGPoint a certain distance along a certain heading...iphone

this seems like such a simple problem but I have been unable to find an answer (and im no good at math). I am trying to move a UIView to a new CGPoint X distance away along a certain heading. What is the formula for determining the new coordinates? (i do no want this to be animated, just an instantaneous move) something like: x = 100;...

Math - Displaying multiple objects in a single view using trigonometry

Hi there! It might be that my math is rusty or I'm just stuck in my box after trying to solve this for so long, either way I need your help. Background: I'm making a 2d-based game in C# using XNA. In that game I want a camera to be able to zoom in/out so that a certain part of objects always are in view. Needless to say, the objects mov...

How to find the angle of triangle in MATLAB

I'm trying to find the angle of the the triangle in MATLAB. e.g. in the triangle below, I want to find the angle of ABC (marked as black). if a = 40, b=50, How I can I find the angle (in degree) of ABC in MATLAB ? Thanks ...

Function to get X, Y position of an object orbiting a point, given a distance and angle in radians?

I am trying to code a function for a camera that orbits a point. Assume a 3d coordinate plane where Z is up. Ignore Z. Let's say the camera's position starts at (0, 0, z). The object to orbit is at, say (50, 50, z). So we have a distance of ~70 units. Calling the function with {(50, 50, z), 70, x} where x is the position in orbit, in ra...

How to get X,Y,Z rotations of vertices on a sphere at the origin?

Hey, I have a sphere in my game world and i would like to place a plane at each vertex on this sphere for debugging purposes. The planes should be orientated so that they lie flat against the sphere (perpendicular to the normals). The sphere is located at the origin, so all the vertices are relative to that. If my thinking is correct, i...

Math Problem: Getting Coordinates From Position And Angle

let me begin by stating that's i'm dreadful at math. i'm attempting to reposition and rotate a rectangle. however, i need to rotate the rectangle from a point that is not 0,0 but according to how far its coordinates has shifted. i'm sure that doesn't make much sense, so i've made some sketches to help explain what i need. the image...

How to find angle of reflected Ray to match a Point

this is for a Tank game I am making Please see pic for a clear idea :link text I want to precompute the exacte angle to hit Point T2. T1:point start T2:point Target V1(a,b):line reflect point : this is what I m looking for :) Edit:it would be cool to see some "Code" :p ...

Limit angle to segment

I need to limit an angle so it fits into a segment. I have drawn and links to a diagram below to better describe what I am after. I am trying to calculate this for a computer program, where I have an angle (slope), and a point (the mouse pointer). The distance does not matter to me, just the angles. If the point is within b1 (green area...

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 rotation of the device, but also responds to movement that one would not think is relevant, suc...

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 to origin: p.x -= cx; p.y -= cy; // Which One Is Correct: // This? float xnew ...

"Mirroring" an angle.

I need to obtain the supplement of an angle. Exactly what I need to do is to implement some kind of code that mirror the angle, let's say, I have 45 degrees -> 135, another example: 80 ->100, 0 degrees -> 180, and so on. Solved: I implemented this just a moment ago, and it worked perfectly, I use 180 - angle if angle < 180, and 360 - a...

Please help me out with sine and cosine.

Hello, I know that sin is opposite/hypotenuse in a right angled triangle and cos is adjacent/hypotenuse. But when i come across functions like for Eg. In Flash :- something.x = Math.cos(someNumber) * someotherNumber; something.z = Math.sin(someNumber) * someotherNumber; what does it actually do? My stack overflows when i see such thi...

Rating the straightness of a line

I have a data set that defines a set of points on a 2-dimensional Cartesian plane. Theoretically, those points should form a line, but that line may be perfectly horizontal, perfectly vertical, and anything in between. I would like to design an algorithm that rates the 'straightness' of that line. For example, the following data sets...

How do I implement multiple sources of gravity, specifically the trig required. (C#) VS 2010

Hi guys. I am designing a small game wherein objects are attracted by multiple objects at once. What I am doing is plotting the course that the shots of these objects will take. To calculate the pull of the planets, I am using this formula: gravityStr/distToTarg^2 (pseudo code). Where my problem lies is in calculating the direction (an...

Calculate Triangle From Area And Angles

I'm trying to calculate triangles base on the Area and the angles. If Angle-B is 90° then the formula works, but in my case, the angle can be from 0.1° to 179.8°. The formula assumes that the angle is 90, so I was thinking that there might be something that is hidden that could work for very angle. Here is the formula: The formula in...

Calculating degrees between 2 points with inverse Y axis

I'm creating a simple 2D game in javascript/canvas. I need to figure out the angle of a certain object relative to my position. So: say I'm at (10,10) and the object is at (10,5) - that would result in 90 degrees (as positive Y is down, negative Y is up) (10,10) vs (10,15) would be 270 degrees. How would I go about this? ...

Calculating the angle between two lines without having to calculate the slope? (Java)

Hi, I have two Lines: L1 and L2. I want to calculate the angle between the two lines. L1 has points: {(x1, y1), (x2, y2)} and L2 has points: {(x3, y3), (x4, y4)}. How can I calculate the angle formed between these two lines, without having to calculate the slopes? The problem I am currently having is that sometimes I have horizontal lin...

How to make a sprite point at the mouse. XNA C#

Hi, If you would look at this diagram link text, I need to find angle A by only knowing the length of all sides of a right triangle. I don't know trig and need some help. ...

Change direction of a moving object....(pure physic question)

Hi, This is a pure physic question but i don't know why it doesn't work....i have a moving object.i get the value of vcos(theta) and vsin(theta)...from this i calculate the velocity and angle of motion.....also i know another point (x,y) and want to direct the object to this point.I think i need to apply a certain force(force must hav...