| 
 | 
     
    
    
    
     
    
    
    
 
    
    
 
    
     
    
    
    
     
    
    
    
     
    
    
    
 
    
    
 
    
    
 | 
       | 
      
 
 
	
	
	
	
	
	
	
	
		  | 
	
	 | 
 
 
		
	
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 07:10 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Mar 2003 
					Location: CHEESE! 
					
					
						Posts: 10,009
					 
					 
	Thanks: 0 
	
		
			
				Thanked 7 Times in 1 Post
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				OT: Looking for a good physics site
	
			 
             
			
		
		
		
		I'm trying to code intercept calculations for two spaceships, both capable of velocity, acceleration and different positions. 
 
I don't want hints. I have been working on this code off and on for months. I don't care about figuring it out myself. I just want to know how to code it. 
 
Many explicitives were deleted in the making of this post. 
		
	
		
		
		
		
		
		
			
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
  Some of my webcomics. I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			  
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 08:00 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Feb 2001 
					Location: Waterloo, Ontario, Canada 
					
					
						Posts: 11,451
					 
					 
	Thanks: 1 
	
		
			
				Thanked 4 Times in 4 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		Is the target ship going to have a constant acceleration, or will it actively evade? 
		
	
		
		
		
		
		
		
			
				__________________ 
				Things you want: 
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 08:52 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Mar 2003 
					Location: CHEESE! 
					
					
						Posts: 10,009
					 
					 
	Thanks: 0 
	
		
			
				Thanked 7 Times in 1 Post
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		I'm just looking for straight-line acceleration right now. More complex stuff can wait. 
 
Thanks for any and all help. 
		
	
		
		
		
		
		
		
			
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
  Some of my webcomics. I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			  
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 09:12 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Mar 2003 
					Location: CHEESE! 
					
					
						Posts: 10,009
					 
					 
	Thanks: 0 
	
		
			
				Thanked 7 Times in 1 Post
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		Also, I just want the enemy ship to hit the target ship - Missile interception. I can probably manage to work out how to match velocities from that. 
		
	
		
		
		
		
		
		
			
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
  Some of my webcomics. I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			  
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 10:11 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Feb 2001 
					Location: Waterloo, Ontario, Canada 
					
					
						Posts: 11,451
					 
					 
	Thanks: 1 
	
		
			
				Thanked 4 Times in 4 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		Wasn't that where you were having all the problems before? 
Reversing thrust at half way causing all kinds of grief? 
		
	
		
		
		
		
		
		
			
				__________________ 
				Things you want: 
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 10:26 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Mar 2003 
					Location: CHEESE! 
					
					
						Posts: 10,009
					 
					 
	Thanks: 0 
	
		
			
				Thanked 7 Times in 1 Post
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		I've gone through a number of calculations. None of them worked completely. The closest I got was an angle calculation that works for velocity only. 
 
I have never gotten any kind of interception that works perfectly for velocity, acceleration and position, either missile interception or matching interception. 
 
And by 'perfectly', I mean, 'Intercepts, in a straight line, a target moving in a straight line'. 
		
	
		
		
		
		
		
		
			
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
  Some of my webcomics. I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			  
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 11:11 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Major 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Apr 2004 
					Location: Atlanta, Georgia 
					
					
						Posts: 1,152
					 
					 
	Thanks: 0 
	
		
			
				Thanked 0 Times in 0 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		I'll see if I can work out the math for a least-time position only intercept, assuming the target has constant acceleration and the only variable is what direction the missile accelerates in. 
		
	
		
		
		
		
		
		
			
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 11:15 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Mar 2003 
					Location: CHEESE! 
					
					
						Posts: 10,009
					 
					 
	Thanks: 0 
	
		
			
				Thanked 7 Times in 1 Post
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		Well, they also start at different positions. 
 
Thanks, wether you manage it or not. 
		
	
		
		
		
		
		
		
			
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
  Some of my webcomics. I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			  
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 16th, 2007, 11:54 PM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Major General 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Oct 2002 
					
					
					
						Posts: 2,174
					 
					 
	Thanks: 0 
	
		
			
				Thanked 0 Times in 0 Posts
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		That's not physics, that's math (mind you, Physics IS math, but nowhere are you actually needing to deal with things like, oh, gravity - you're just looking at acceleration). 
 
A position under constant acceleration vs. time for a given axis has an equation that can be formatted as: 
 
P(T)=(1/2)A(T^2)+VT+S 
 
P(T): Position at time T (the function) 
T: Time (the only variable) 
A: Acceleration (a constant for this exercise) 
V: Initial Velocity (at T = 0; a constant) 
S: Starting position (P(0); a constant) 
 
You're looking to calculate an intercept - well, you've got a lot to worry about, but basically, you're looking for a way to get two different position functions at the same point at the same time: 
 
So basically, you have P1(T) = P2(T), and want T and A (do I need to reword that?). 
 
As each object has a different starting position (otherwise, T=0 always works; this is the definition of interception), Acceleration, and initial velocity are likely to be different; you're looking to solve: 
 
(1/2)A(T^2)+V T+S = (1/2)A(T^2)+V T+S 
 
Do note that your intercepting ship can potentially control it's acceleration.  Well, let's start manipulating: 
 
(1/2)A(T^2)+V T+S = (1/2)A(T^2)+V T+S 
 
(1/2)(A - A)(T^2)+(V - V)T+(S- S) = 0 
 
Oh, hey - we now have a quadratic equation; sub (1/2)(A - A) with a, (V - V) with b, and (S- S) with c, and T with x.  The Quadratic formula will do the job: 
 
x = (-b +/- sqrt(b^2 - 4ac))/(2a) 
 
Note: a is a variable, as the interceptor will need to choose it.  You've got a variable on both sides - but that's okay, as you'll want at least two dimensions, and you've got a separate equation for each dimension; you'll end up with a system of equations (one for each dimension) and some relationship between the a on the various axes (usually the Pythagorean therom). 
 
Edit: 
That is, of course, assuming you don't want to stop at the end, other than ramming the target.... 
		
	
		
		
		
		
		
		
			
				__________________ 
				Of course, by the time I finish this post, it will already be obsolete.  C'est la vie.
			 
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
	
	
		
	
	
	
		
		
		
			
			 
			
				August 17th, 2007, 01:10 AM
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
 
  
			
				
				
				Shrapnel Fanatic 
				
				
				
			 | 
			  | 
			
				
				
					Join Date: Mar 2003 
					Location: CHEESE! 
					
					
						Posts: 10,009
					 
					 
	Thanks: 0 
	
		
			
				Thanked 7 Times in 1 Post
			
		
	 
					
					
					
					     
				 
				
			 | 
		 
		 
		
	 | 
 
    
	
     
	
	
		
		
		
			
			
				 
				Re: OT: Looking for a good physics site
			 
             
			
		
		
		
		Tankee! Tankee very much! 
 
...But, um, if the enemy acceleration needs to be chosen to use the formula and the formula tells it in which direction to accelerate and thus, how much to accelerate... 
 
...Isn't that a closed loop? 
 
/me goes off to see what happens if /me uses that by inputing '0' for the enemy acceleration. 
 
...Uh, the first one is the pursuer, right? 
 
...'+/-'? 
		
	
		
		
		
		
		
		
			
				__________________ 
				If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!  
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++ 
  Some of my webcomics. I've got 400+ webcomics at Last count, some dead. 
Sig updated to remove non-working links.
			  
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
 
	 
	
		 
	 
 
 
	
		
	
	
	
	
	
	
	
		
	
		 
		Posting Rules
	 | 
 
	
		
		You may not post new threads 
		You may not post replies 
		You may not post attachments 
		You may not edit your posts 
		 
		
		
		
		
		HTML code is On 
		 
		
	  | 
 
 
	 | 
	
		
	 | 
 
 
     |  
 |