microsoft / microsoft/maker.js
Outline fails for very specific shapes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 302
- Avg merge
- 21h 28m
- Merged PRs (30d)
- 5
Description
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:

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!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied JavaScript reproduction and compare the models returned by makerjs.model.outline for distances 30, 36, and 42, including the 36.1 case. Trace the outline entry point and inspect why the 36-distance result becomes empty; done means the reproduction produces a non-empty, correct inner outline at 36 without breaking the neighboring cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100