legends2k / 2d-fov Goto Github PK
View Code? Open in Web Editor NEWField of View and Line of Sight in 2D
Home Page: http://legends2k.github.io/2d-fov
License: BSD 3-Clause "New" or "Revised" License
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
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.