Incorrect results of model.combine

Open
#509 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Start by running the supplied model.combineSubtraction example and inspect the model.combine and exporter.toSVG entry points. Compare the subtraction result with the SVG output to determine where the stray polygon lines remain. Done means subtracting the polygon from the circle produces no visible lines outside the resulting shape.

Written by the indexing model from the issue text.

Description

bug

Hello,
I came across a problem with a strange behaviour of model.combine. I have a circle and a polygon made of lines, and when I try to subtract the polygon from a circle, then a couple of lines stay visible outside of the result shape.

var circle = { 
  type: 'circle', 
  origin: [-122, -154],
  radius: 402.7,
  units: 'cm'
 };

var modelCircle = { paths: { myCircle: circle } };

var line1 = { 
  type: 'line', 
  origin: [-500, -399], 
  end: [-499, 201] 
 };
 var line2 = { 
  type: 'line', 
  origin: [-499, 201] ,
  end: [-670, -136]
 };
 var line3 = { 
  type: 'line', 
  origin: [-670, -136] ,
  end: [-500, -399] 
 };

var modelLinien = { paths: { myLine1: line1, myLine2: line2, myLine3: line3 } };

rootModel = m.model.combineSubtraction(modelCircle, modelLinien);

// same result
rootModel2 = m.model.combine(
            modelCircle,
            modelLinien,
            false,
            true,
            true,
            false
        );
		
var svg = m.exporter.toSVG(rootModel);
document.write(svg);

combine

Dominant language
TypeScript
Stars
2k
Forks
302
Avg merge
21h 28m
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/maker.js

All issues in microsoft/maker.js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.