GithubHelp home page GithubHelp logo

Comments (5)

martinfrances107 avatar martinfrances107 commented on April 28, 2024

For all points I can see .. I have refactored the comparison of floats

https://github.com/martinfrances107/d3-delaunay/tree/Make_compare_of_floats_safe

It does not pass tests... yet.

from d3-delaunay.

Fil avatar Fil commented on April 28, 2024

Are we comparing values that can be created by different paths (like a *b versus b * a), or are they created by the same path. If this is the second case, I don't see that we would have an issue?

from d3-delaunay.

martinfrances107 avatar martinfrances107 commented on April 28, 2024

"created by different paths"... I am not sure I understand what you mean

So I am just going to describe a scenario and you can tell me if it meets your thinking..

So I am thinking of user code making use of our library code.

In this scenario the user algorithms, are subject to numerical computation errors but always, in this event, result in a clipping bounds of a unit square.

clipping bound (A) xmin = 0, xmax = 1, ymin = 0, ymax = 1

because of numerical inaccuracies the user code on successive requestAnimationFrame events feed in the following identical clipping bounds into out library code.

so (A) = (B) = (C)

B) xmin=-0.000000001, xmax=0.999999999, ymin = 0.000000001, ymax = 0.9999999

C) xmin= +0.000000001, xmax=+1.00000001, ymin =+0.000000001, ymax = 1.000001

Looking at our edgecode() function - different codes are going to be return and visually I think you may see some jitter as the generated polygons incorrectly change over time.

return (x === this.xmin ? 0b0001 : x === this.xmax ? 0b0010 : 0b0000) | (y === this.ymin ? 0b0100 : y === this.ymax ? 0b1000 : 0b0000);

return (Math.abs(x - this.xmin) < epsilon ? 0b0001 : Math.abs(x - this.xmax) < epsilon ? 0b0010 : 0b0000) | (Math.abs(y - this.ymin) < epsilon ? 0b0100 : Math.abs(y - this.ymax) < epsilon ? 0b1000 : 0b0000);

from d3-delaunay.

Fil avatar Fil commented on April 28, 2024

I'm sorry I don't understand the problem you are trying to solve. Is there a specific array of point coordinates where the current code fails?

The two first tests you propose to change are here to avoid duplicated points: #83 and #88

The edgecode compares S —the result of _clipSegment which returns one of this.xmin, this.ymin this.xmax, this.ymax— with this.xmin &c. So it sounds fair to compare with strict equality?

from d3-delaunay.

Fil avatar Fil commented on April 28, 2024

closing due to inactivity; please don't hesitate to comment if this is still an issue

from d3-delaunay.

Related Issues (20)

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.