1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

3D Space Pursuit Problem

  1. Feb 6, 2009 #1

    jst

    User Avatar

    "3D Space Pursuit Problem"

    1. The problem statement, all variables and given/known data

    This is actually a programming assignment, more than a physics problem. However the issue I'm having is more with the math/physics than with the programming. Anyway here it goes:

    Write a simulation program and test it for a three dimensional space pursuit of two spaceships each equipped with a laser beam weapon that can destroy its target if it is within a cylindrical angles of ALPHA degrees and a distance of BETA. Do not assume a pure pursuit, but make any necessary assumptions for smart spaceship commanders. Some sort of graphic output is required in addition to a summary report discussing your results.


    2. Relevant equations


    Included with the problem was these "hints":

    http://glomawr.com/hint.jpg [Broken]


    3. The attempt at a solution

    After looking at the book that my professor referenced in his "hint", 2D is no problem, but I'm a little confused on 3D. I found the book on Google Book Search and copied the 3 pages if anyone wants to take a look: http://glomawr.com/problem.jpg [Broken]

    So looking online, I found:

    http://glomawr.com/eq1.jpg [Broken]

    Do I just combine the above info with the "hint" where I replace the SIN THETA with the value of SIN from the "hint"?

    Also, I assume that the distance equation would be similar, but with an additional z coordinates.

    Just more of an opinion thing...by: "Do not assume a pure pursuit, but make any necessary assumptions for smart spaceship commanders" I think he means not do it exactly like the book and give the second plane some weak AI where it moves a bit. What would you assume? (professor isn't really responding to emails :confused::smile:)


    Thanks a lot. Any opinions, ideas, and info are appreciated.

    -Jason
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Feb 12, 2009 #2
    Re: "3D Space Pursuit Problem"

    Hi jst, Well this actually could become a rather very complex mathematical problem, depending on how far you want to take, so heres my take on it.

    First ill assume that you have you have the positions of the cat and mouse ships (ill call ship1 and ship2 respectively) in some global Cartesian coordinate system (i.e x,y,z coordinates). You will also require the direction vector that ship1 is pointing in and also how much roll it has, that is the angle about the direction vector that ship1 is rotated. I would actually say the best way to implement "roll" is to have a direction vector located at the same position as that of the position of ship1 at right angles (orthogonal) to the direction vector, such that it points down one of the wings of ship1(ill call this the wind vector). Now the reason why you'll need roll will become apparent in a second.

    What you will now need to do is transform the ships coordinates so that ship2 has position relative to ship1, and that ship1's direction vector is pointing down the positive x-axis, and that the wing vector is pointing down the y-axis (depending on which side you put the wind vector will depend which direction along the y axis it points) such that the ship1 is horizontally aligned. After you have done this transformation you will have something similar to the diagram below, I will assume that you can work out how to do that transformation yourself, there is a lot online describing transformations, but obviously if you cant figure out what to do there give it you best shot then come back and well go from where you get stuck.

    http://weald10k.fileave.com/PF003_1.png

    Now given that Ship one is at the origin of our coordinate system and it is align horizontally wee can now see if ship2 is withing range to be shot :D.

    So this is where those second equations you have come in to play. So we can first decide if the ship is within the maximum shooting distance from us, so we can do that by this equation

    [tex]d = \sqrt{x^2 + y^2 + z^2}[/tex]

    where x,y,z represent the coordinates of ship2 in our transformed coordinate space.
    If d is less than the maximum range on the laser then we can proceed to the next stage.
    We now need to decided if ship 2 is within the angle of shooting for ship1. In the diagram you can see angle a, now this angle is the angle in which ship1 can shoot and is symetrical about the x axis, so it stretches around the z axis to +(a/2) and -(a/2) each way, and hopefully you can make out where they reach by the vertical gray bars on the diagram.

    So now we need to calculate the horizontal angle between ship2 and ship1 (call the azimuth angle) which we do with one of you second set of equations:

    [tex]\theta = tan^{-1}\left(\frac{y}{x}\right)[/tex]

    from that we can get the azimuth angle of ship2 from ship1, if it satisfies the interval

    [tex] -\frac{a}{2} < \theta < \frac{a}{2} [/tex]

    then ship1 will be able to shoot ship2.
    I hope that helps, it seems like quite a hard programing problem (but I don't know what level of eduction thats at so sorry for any assumption made there :D) good luck with you program
     
  4. Feb 12, 2009 #3

    jst

    User Avatar

    Re: "3D Space Pursuit Problem"

    Hey, thanks a lot for the info. However, the assignment was due (and turned in yesterday) :eek: Anyway, I think I did okay, but I was fortunate enough to get a couple of responses from my Professor (wasn't expecting that :wink: )

    When I asked him a very close to the way I posted the question here, he stated: "I would stick with Cartesian and measure distances as I hinted."

    So I wrote back, "As far as the coordinates goes, https://www.physicsforums.com/newreply.php?do=postreply&t=290376#1 [Broken] the distance itself is not a problem; it's the same equation, but with z added. So would the only difference in the SIN and COS equations from the "hint" be that the distance in the denominator?"

    His response: "Yes. You are correct."

    So, that's what I did....much more simple than what I was making.

    So if there wasn't a "hit", I did:

    Catx = Catx + speed*(Mousex-Catx)/getDistance();
    Caty = Caty + speed*(Mousey-Caty)/getDistance();
    if (Math.Abs(Catz - Mousez) >= blowupDistance / 3)
    {
    Catz = Catz + MoveUp(1, System.Convert.ToInt32(speed));
    }

    I moved the mouse based on how close the the cat was, but we had a lot a freedom to do whatever for this.

    Was I correct? Based on my Professor's emails, I would say I've very close.

    Thanks again,

    Jason
     
    Last edited by a moderator: May 4, 2017
  5. Feb 12, 2009 #4
    Re: "3D Space Pursuit Problem"

    Hi Jason, ah sorry about that, a day late :D. Sure that I think looks fine, I dont quite understand where the "/3" comes from on line 3, but you know that only a small part of you program.
    I think the way you did is far more sensible, after all it meant to be a programing problem not a math problem. And I think to be honest there wont be a "correct answer", its a simulation and how the simulation pans out will depend on the programmer :D, Im sure you'll do great with the program.
     
  6. Feb 12, 2009 #5

    jst

    User Avatar

    Re: "3D Space Pursuit Problem"

    No worries....my division by 3 is bullsh*t :eek: basically....I moved the Cat's z-position if the difference in z coordinates of the cat and mouse was greater than equal to a third of the distance in which the bomb can hit. Just something to move the z to a better position...hopefully.

    Nothing groundbreaking going on here, but it was fun to run...because some of the movements are based on pseudo-random movements, so sometimes the cat wins, some time the mouse gets away.

    Overall fun, except for getting started ;)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: 3D Space Pursuit Problem
  1. 3D kinematics problem (Replies: 2)

  2. 3D statics problem (Replies: 5)

Loading...