Giter Site home page Giter Site logo

sfml-separatingaxistheorem's Introduction

SFML-SeparatingAxisTheorem

Demonstration of SAXT using SFML shapes

alt text

Inctroduction

I wrote this code because I wanted to push my own understanding about collision detection and push my math skills. In this project you will find a pretty decent implementation of the separating axis theorem for convex polygonal collision detection. Collision detection between SFML's base shape types like sf::RectangleShape, sf::CircleShape and sf::ConvexShape are all supported. Calculations are kept low by using a grid partitioning system. In the future I'd like to implement a quad-tree and maybe concave collision resolution.

How to build

This project only depends on SFML so if it is installed you should be all set.

I provided an Example.cpp that serves to demonstrate the collision detection in action. To build the example program on Windows with Visual Studio open a Developer Command Prompt and enter this:

Change your directory to the source directory

cd C:/path/to/source

Compile and link the source code

cl /I C:/path/to/SFML/include C:/path/to/SFML/lib/sfml-system.lib C:/path/to/SFML/lib/sfml-window.lib C:/path/to/SFML/lib/sfml-graphics.lib Example.cpp

The code should compile and produce Example.exe.

If you are using MinGW open a Command Prompt and enter this:

Setup your path variable

path=C:/path/to/MinGW/bin

Change your directory to the source directory

cd C:/path/to/source

Compile and link the source code

mingw32-make

Note! Don't forget to edit the Makefile to make the directories point to where you installed SFML

How to use

You control a giant triangle with the arrow keys and you can spin it by pressing the space button.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.