0

Im trying to implement SAT in Python and can't seem to get it working. There is a lot on information on the net but none of it seems to explain the code (at least in a way I can understand) and how to apply SAT if you have points on the cartesian plane.

In my problem, I have two rectangles (which may or may not be on an angle) stored as a list of x and y coordinates.

I.e. I have two lists r1, r2 which contain [x1, y1], [x2, ..... [x4, y4] for each of the two rectangles.

How can I implement code in Python to apply Separating Axis theorem to determine collision?

Any help would be greatly appreciated.

2
  • Can you show us what code you have (tried) ? What the input of that code is, what the expected output of that code is, and what the actual output of the code is ? Commented May 11, 2017 at 7:28
  • All I have with me is code to randomly generate the two rectangles and store them in the lists r1, r2 as described in the question. I can't seem to understand the SAT information I am reading to implement the code. From what I understand I need to create vectors to replace the points, create perpendicular axes then I'm sort of lost, but I can't even get the points into vectors at the moment. EDIT: Just thought I would note my code is also printing the rectangles to the screen. Commented May 11, 2017 at 7:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.