microsoft / microsoft/maker.js

Incorrect results of model.combine

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

Nobody has claimed this yet.

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

Description

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

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.