
Algebra PreAlgebra and Basic Algebra Math Forum 
 LinkBack  Thread Tools  Display Modes 
August 9th, 2010, 11:00 PM  #1 
Newbie Joined: Aug 2010 Posts: 5 Thanks: 0  calculating relative position in 3d space
First please go easy on me I have never taken a formal Trigonometry class and most of what I know is selftaught. For a given set of Cartesian coordinates (x1,y1,z1) in degrees I have found I can find a 2dimensional (i.e. looking from the top view down) set of coordinates D distance away (x2,y2,z2) by doing the following... Code: Given Distance D = 10: x2 = x1 + (D * Cosine( DegreesToRadians(x1) ) * Cosine( DegreesToRadians( y1 ) ) ) y2 = y1 + (D * Cosine( DegreesToRadians(x1) ) * Sine( DegreesToRadians( y1) ) ) z2 = z1 + (D * Sine( DegreesToRadians(x1) ) Code: Given: LengthCannon = 10 (i.e. cannon shaft length in units). Angles (a1,b1,c1) in degrees Cannon butt origin (x1,y1,z1) in degrees Calculate by... a2 = (a1 / 360) * 2 * pi b2 = (b1 / 360) * 2 * pi (c1/c2 doesn't really matter in this case since I do not care about spin/orientation of the object which will be assumed as selfrighted) tip of barrel = LengthCannon * sin(b2) projection = LengthCannon * cos(b2) x = projection * cos(a2) z = projection * sin(a2) The x component of the cannon shaft in space: x2 = (x1  0) / LengthCannon y2 = (y1  0) / LengthCannon z2 = (z1  0) / LengthCannon Am I on the right track? Can someone help correct this formula or perhaps give me a better one? 
August 10th, 2010, 04:15 AM  #2 
Global Moderator Joined: Dec 2006 Posts: 20,746 Thanks: 2133 
Cartesian coordinates are (signed) distances from an origin, not angles.

August 10th, 2010, 05:31 PM  #3  
Newbie Joined: Aug 2010 Posts: 5 Thanks: 0  Re: Quote:
As I stated before I want to find a point in space (x2,y2,z2) that is a fixed distance away (say 10 units to keep math simple) from an originating point in space (x1,y1,z1) following an imaginary line determined by the angles (pitch,yaw,roll) the imaginary barrel / camera is pointing/facing. Could you provide something that could help solve the problem?  
August 11th, 2010, 07:06 PM  #4 
Global Moderator Joined: Dec 2006 Posts: 20,746 Thanks: 2133 
It wasn't obvious, as you explicitly referred to Cartesian coordinates as being "in degrees". Surely pitch, yaw, etc., make sense only when applied to some initial direction of the barrel (unrelated to the initial position, which might as well be the point (0, 0, 0)).

August 12th, 2010, 05:57 PM  #5 
Newbie Joined: Aug 2010 Posts: 5 Thanks: 0  Re: calculating relative position in 3d space
go grief and flame posts from someone else. I am here to look for a formula that works, obviously you rather waste peoples times getting caught up in semantics.. probably because you don't know the answer. It is clear that I have spent some time looking into different related material and it is clear about what I am looking for. Get lost I don't have time for people like you that waste peoples time. For anyone else interested I will post the formula when I find it so no one else has to deal with this moron. 
August 13th, 2010, 01:17 PM  #6 
Member Joined: Aug 2010 From: Osijek Posts: 33 Thanks: 0  Re: calculating relative position in 3d space
It would help a lot if you would post a drawing of what you're trying to accomplish. 
August 14th, 2010, 05:55 PM  #7 
Global Moderator Joined: Dec 2006 Posts: 20,746 Thanks: 2133 
Since the space is 3D, only 3 values are needed, such as a distance and two angles. It's unclear how the angles would be applied, as an angle needs to apply to a direction (which wasn't given) rather than a point.

August 14th, 2010, 06:40 PM  #8  
Senior Member Joined: Jul 2010 From: St. Augustine, FL., U.S.A.'s oldest city Posts: 12,211 Thanks: 521 Math Focus: Calculus/ODEs  Re: calculating relative position in 3d space Quote:
To the OP, you'll find the moderators here really know what they're talking about, but may need to ask questions for clarification, not for the purpose of criticism.  
August 15th, 2010, 11:19 PM  #9 
Newbie Joined: Aug 2010 Posts: 5 Thanks: 0  Re: calculating relative position in 3d space
Here is a snapshot that shows the problem visually. Just to throw out some practical numbers for the math (although I will end up converting to variables for this app): Code: Angles pitch,yaw,roll (a1,b1,c1): 5.0, 8.0, 0.0 Start Position (x1,y1,z1): 100.0, 200.0, 300.0 Distance: 10.0 End position (x2,y2,z2): what I am trying to find the formula for My guess is I am going to end up with something along the lines of the pythagorean theorem to calculate the distance if I have a pitch that is not 0 which then uses the offset of the current location. I am not sure how this would really be calculated through if the camera was pointed in some odd diagonal. although my previous formula would give me accurate information on the direction of the destination cordinates, it would not tell me the elevation (z): Code: Given Distance D = 10: x2 = x1 + (D * Cosine( DegreesToRadians(x1) ) * Cosine( DegreesToRadians( y1 ) ) ) y2 = y1 + (D * Cosine( DegreesToRadians(x1) ) * Sine( DegreesToRadians( y1) ) ) z2 = z1 + (D * Sine( DegreesToRadians(x1) ) 
August 16th, 2010, 09:21 AM  #10 
Global Moderator Joined: Dec 2006 Posts: 20,746 Thanks: 2133 
Why don't you give the start position of the tip of the cannon's barrel as well as the start position of its butt?


Tags 
calculating, position, relative, space 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Calculating distances in a space with varying density.  alikim  Calculus  0  May 22nd, 2013 08:47 PM 
Calculating a position in a range while limiting the range  tale  Computer Science  5  May 23rd, 2012 05:16 AM 
Vertices position relative to a Quad  probiner  Algebra  0  February 21st, 2012 09:42 PM 
position of arc's in a 3d space  laurens23  Algebra  0  January 10th, 2012 06:15 AM 
From relative rotation to absolute rotation in 3D space  Maegfaer  Algebra  1  August 27th, 2010 09:01 PM 