Giter Club home page Giter Club logo

2d-fov's People

Contributors

legends2k 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

Watchers

 avatar  avatar  avatar  avatar

2d-fov's Issues

incorrect hit point intersection, when segment.center x is the same as polygon edge

Hi! I really liked your article and the source codes for that 2d-fov. I've found a bug in your code, I spend 2 days finding and fix, but I can't find a solution. Please help.
A test scene is:

scene = {
         polygons: [
             { coords: [ 96,72,120,72,120,96,96,96 ],
               colour: "128, 128, 128",
               stroke: 1,
               fill: true },

        ],
         observer: { loc: vec2.fromValues(50, 96),
                     dir: vec2.fromValues(-0.707106781186, 0.707106781186),
                     colour: observerColour },
         target: { loc: vec2.fromValues(500, 100),
                   dir: vec2.fromValues(-1, 0),
                   colour: targetColour }
     };

As you see, fov calculation is incorrect

Any field of view greater than 180° fails to render properly

Not sure if you're actually interested in this anymore, but thought I'd bring it up just in case. I'm actually trying to do something similar to what you already have, but with a full 360° range. I could use your code directly and just run it twice for those cases where the total FoV is greater than 180° (splitting the range between the two runs) and union the polygons, but that's likely way more inefficient than it could be with a real solution.

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.