Skip to content

Near-degenerate edge causes infinite loop #15

@gkjohnson

Description

@gkjohnson

Hello! Thanks again for this project. I've been using it to triangulate a resulting polygon generated by intersections from polygon intersections (for the three-bvh-csg project) and I'm seeing that the project can fall into a infinite loop in cases possibly when a very short constrained edge is in the graph. It should be good to know, if possible, what the tolerances should be used for the project and throw an error if an infinite loop is reached.

Here's a simplified example case derived from the data:

import Delaunator from 'delaunator';
import Constrainautor from '@kninnug/constrainautor';

const coords = [
  0,0,
  0.05626429153399996,0,
  0.024093852080076722,4.80267923973791e-18,
  0.01379050745122589,0.1463775332929564,
  0.05177587092034522,0.015468457826306506,
  0.024093852080076705,-5.204170427930421e-18
];
const indices = [
  [0,5],
  [5,2]
];

const del = new Delaunator( coords );
const cons = new Constrainautor( del, indices );
// infinite loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions