GithubHelp home page GithubHelp logo

byronknoll / visibility-polygon-js Goto Github PK

View Code? Open in Web Editor NEW
126.0 126.0 17.0 228 KB

This library can be used to construct a visibility polygon for a set of line segments.

Home Page: http://www.byronknoll.com/visibility.html

JavaScript 100.00%

visibility-polygon-js's People

Contributors

byronknoll avatar xaviergonz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

visibility-polygon-js's Issues

o

ooo

Original issue reported on code.google.com by [email protected] on 27 Dec 2013 at 11:33

Need documentation

Hi,

Congrats for the lib.

However source code does not contain comments on the algorithm used.

What are the goals of the following methods:

  • lessThan
  • child
  • parent
  • insert
  • remove

I understand that the vertices are traversed in the inverse clockwise order. However not how segments are selected or not.

Thank you for the clarification.

C sharp version

Hi Byron!
Can this library be translated to C# language?
Or maybe there is C# version exists?
thanks

Cone shaped visibility

Hi, thanks a lot for the code, i'm using it in my Phaser 3 project. You can test it here (beware, might be gpu intensive).
I would like to adapt this code to the game by making the player's visibility as a cone in front of the player. Given the player's rotation in deg/rad and a constant F field of view, how could we adapt the code so that the compute method does return only the rays in front of the player and not the whole 360° ?
Thanks a lot again !

Possible to get the invisibility polygon, so the negative or opposite polygon?

Is it possible to get the invisibility polygon? This could be used as a way to block invisible parts in a game, see this forum post

Theoretically it is possible to draw a "negative" polygon and have it be one single polygon by using the edges of the viewport to connect any seperate parts. So this can result in infinitely thin lines along the viewport edges but that's ok.

Any ideas on how to make such an algorithm?

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.