Code Monkey home page Code Monkey logo

simplepolygon's People

Contributors

deniscarriere avatar ffflabs avatar mclaeysb 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

Watchers

 avatar  avatar  avatar  avatar  avatar

simplepolygon's Issues

process.hrtime not available in browser

process.hrtime is not a valid function in the browser.

Have this ever been tested in the browser? Tests are passing fine in NodeJS.

https://github.com/mclaeysb/simplepolygon/search?utf8=%E2%9C%93&q=process.hrtime&type=

Might be handy to set up a simple /docs folder with an index.html and a browser friendly build to simply test this library in the browser. Here's a "minimalistic" approach I've been doing for some of my libraries https://github.com/DenisCarriere/slippy-tile/tree/master/docs.

I can send a PR to include a simple Rollup config that builds the bundle, let me know.

For this type of debugging/timings, you could look into including debug for your internal testing/debugging.

Self intersecting polygon -- some sub regions not getting detected

Dear Manuel, I am really excited about integrating simplepolygon into a locus-drawing js browser app I've been developing over the past few months. It draws loci of centers of families of triangles "mounted" on ellipses.

Browserifying simplepolygon worked like a charm.

However I am having a few issues with the results returned by simplepolygon. Consider first of all one 800-long sample polygon (it's actually a curve approximation), you can see it live here: https://bit.ly/2Zg7Mv1

x14 raw

As you can see, the above curve has 6 self intersections and 7 simple subregions. The coloring scheme below reveals the independent subregions returned by simplepolygon. unfortunately, only 3 are returned. Any idea why?

x14 filled

For your own testing I am attaching a zipped json w the 800 vertices:

vtx-X14.zip

Clarify robustness / edge cases handling

@mclaeysb Thank you for the library!

I'm quite interested in the Subramaniam algorithm, but the paper is quite vague on details โ€” e.g. it's not clear what order the edges should be processed if there's more than 1 intersection in the same point, and doesn't cover degenerate cases like collinear edges.

Does the algorithm handle cases like this? Are there any known limitations to the input for it to be processed properly?

P.S. Feel free to close the issue if it's not actionable.

documentation outdated?

Hi,

This tool is really helpful to me, thanks a lot!

I have a question regarding an edge case mentioned in the README.md:

An exception includes polygons with spikes or cuts such as [[0,0],[2,0],[1,1],[2,2],[0,2],[1,1],[0,0]], who
are currently allowed and treated correctly, but make the output non-simple (by OGC definition).

This example is rejected in 1.1.7. Try to run this:

var feature, simplepolygon;

simplepolygon = require("simplepolygon");

feature = {
  type: "Feature",
  geometry: {
    type: "Polygon",
    coordinates: [[0, 0], [2, 0], [1, 1], [2, 2], [0, 2], [1, 1], [0, 0]]
  }
};

simplepolygon(feature);

Is this a bug? Or is the README outdated?

allIsectsAsIsectRbushTreeItem is not declared

@mclaeysb

In line

allIsectsAsIsectRbushTreeItem = [];

Variable allIsectsAsIsectRbushTreeItem isn't declared as var, let or const.

In some environments this amounts for the variable becoming global. Linters complain about it being undeclared, and QUnit doesn't pass tests if

QUnit.config.noglobals = true; config option is used.

Do you think you could declare this variable without side effects?

One Step Closer

Just noticed some positive changes in v1.2.0.

Still not 100% there yet, but better than before, only splits 1 geometry.

Using this complex.geojson

image

Before to v1.2.0

image

Now v1.2.0

image

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.