Skip to content

Outline fails for very specific shapes #390

Open
@raydog

Description

@raydog

Hey there! I think I found a bug with the outline method, at least when telling it to generate a path on the inside. It's hard to explain, since it doesn't crash or anything. It just produces empty models with very specific inputs, and very specific outline distances. Here's some code that reproduces what I'm seeing:

import makerjs from "makerjs";

const points = [ 
  [ 36, 504 ],
  [ 540, 504 ],
  [ 576, 360 ],
  [ 756, 360 ],
  [ 864, 144 ],
  [ 864, 36 ],
  [ 36, 36 ]
];

const shape = new makerjs.models.ConnectTheDots(true, points);

const final = {
  models: {
    shape,
    a: makerjs.model.outline(shape, 30, 1, true),
    b: makerjs.model.outline(shape, 36, 1, true),
    c: makerjs.model.outline(shape, 42, 1, true),
  }
};

document.write(makerjs.exporter.toSVG(final));

The result ends up looking like:

image

Where shape, a, and c are all drawn correctly, but b is an empty model. Tweaking the outline distance, even by just a little (ie, changing the 36 into 36.1) seems to "fix" this, but that isn't a REAL solution. :)

Any help would be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions