Giter Site home page Giter Site logo

songxiaopeng / 2d-fov Goto Github PK

View Code? Open in Web Editor NEW

This project forked from legends2k/2d-fov

0.0 1.0 0.0 64 KB

Field of View and Line of Sight in 2D

Home Page: http://legends2k.github.io/2d-fov

License: BSD 3-Clause "New" or "Revised" License

HTML 100.00%

2d-fov's Introduction

Field of View and Line of Sight in 2D

View it in action in your browser!

The idea is to find the field of view from a given point in a 2D world which has buildings. Many resources on the web doing 360° FoV exists; these have their FoV's distance and angle unbound. This is simpler to design; arriving at a fast implementation is easier since -- if rightly done -- there would be no intersection queries every iteration of the loop to eat up performance. However, the FoV here is different; it's limited both by angle and distance. Care is taken to have an optimised solution that avoids unnecessary intersection tests so that it's usable in a game where multiple agents would need their FoV computed every frame.

This implementation is done in HTML5 Canvas/JavaScript for easy viewing but the idea is mathematical and can be implemented in any language. The only library it uses is glMatrix for vector calculations. The code is heavily commented and includes references to articles and books for someone to learn from it.

The design document has all the gory details, again with references for further study.

2d-fov's People

Contributors

legends2k 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.