GithubHelp home page GithubHelp logo

wiseconst / interview_eagle_dynamics Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 521 KB

Solution to fast 2d collision resolving using QuadTree. YOLO. Next better method: Sweep & Prune

License: MIT License

C++ 93.88% CMake 6.12%

interview_eagle_dynamics's Introduction

Interview

Напишите оптимальный обрабочик столкновений объектов между собой и краями окна без использования готовых движков симуляции физики.

Объекты абсолютно упругие, описываются кругами заданного радиуса и имеют заданный вектор скорости.

Объекты двигаются в плоскости окна и абсолютно упруго отскакивают друг от друга и от краёв окна. Массы объектов пропорциональны площади кругов, их описывающих.

Проект зависит от SFML (https://github.com/SFML/SFML). Для OS Windows прикреплены бинарники, для других OS бинарники можно скачать с официального сайта https://www.sfml-dev.org/download.php

Алгоритмическая сложность решения должна быть лучше, чем O(n^2).

В предоставленом коде могут встречаться небольшие ошибки и неточности. Их надо исправить. Просьба комментировать код, чтоб было понятно, почему были приняты те или иные решения.

Tested platforms

  • Windows

Small test, 9999 balls. AMD Ryzen 7 5800H, RTX 3050 Ti Laptop. As you can see in the window, QuadTree implementation is 4 times faster than Naive. First is naive, second is QuadTree + visualization.

Alt text Alt text

Clone:

git clone --recursive -b main --single-branch https://github.com/wiseConst/interview_Eagle_Dynamics.git

Build:

cd interview_Eagle_Dynamics && mkdir build && cd build && cmake ..

interview_eagle_dynamics's People

Contributors

wiseconst avatar

Watchers

 avatar

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.