Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (687)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Solving Simple tank problem with matrices  (Read 1331 times)
0 Members and 1 Guest are viewing this topic.
Offline dranonymous

Junior Devvie

Hoping to become a Java Titan someday!

« Posted 2006-10-20 00:12:03 »

Ok, so I've tried a few times to figure this out and keep getting the answer wrong.  I've attached a picture to make it more clear.

You have a target point, which is relative to a missile.  I want to find the target location relative to the tank turret's coordinate system.

target location relative to missile coordinate system = (8, -4)
tank location relative to missile coordinate system = (4, 0)
turret is rotated 45 degrees from the front of the tank
The coordinate system is X out the front of a vehicle and Y to the left

Using basic algebra, you can find the answer almost trivially.  I want to understand the process when using rotation matrices.

I thought the answer should be -

R(-45)R(90)(target pos - tank pos)

Where R(x) represents the rotation matrix of x degrees.

I seem to end up getting the correct number (4* sqrt(2), 0), but I end up with it being negative, which isn't correct.

So what is the correct way of doing this?

Dr. A>

PS - I was using column vectors, so my rotation matix looked like:

cos x  -sin x
sin x  cos x

so P2 = RP1

| x2 |  =  | cos x  -sin x | | x1 |
| y2 |     | sin x   cos x | | y1 |

Offline noblemaster

« JGO Spiffy Duke »

Medals: 25
Projects: 10

Age of Conquest makes your day!

« Reply #1 - Posted 2006-10-20 03:22:45 »

your Y goes up for the screenshot - but the actual physical screen coordinates point down. could this be the problem?

Offline dranonymous

Junior Devvie

Hoping to become a Java Titan someday!

« Reply #2 - Posted 2006-10-20 05:41:16 »

It shouldn't be the problem.  The problem is wholly independent of 2d drawing in java.  So, my Y going left and X going out the front of a vehicle should be acceptable.  It might be a tad confusing, but I believe its fine.

I tried to make this problem independent of right and left hand coordinate systems, by reducing it to a 2d one.

Other thoughts?

Dr. A>
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Dwinin (71 views)
2015-11-07 13:29:08

Rems19 (80 views)
2015-10-31 01:36:56

Rems19 (73 views)
2015-10-31 01:32:37

williamwoles (106 views)
2015-10-23 10:42:59

williamwoles (92 views)
2015-10-23 10:42:45

Jervac_ (106 views)
2015-10-18 23:29:12

DarkCart (134 views)
2015-10-16 00:58:11

KaiHH (116 views)
2015-10-11 14:10:14

KaiHH (155 views)
2015-10-11 13:26:18

BurntPizza (171 views)
2015-10-08 03:11:46
Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!