fix(core): Fix bug in path.shiftAlong
This bug would be triggered by an edge-case where we have a path that is made up of multiple curves/lines. If the distance to shift lies just beyond the end of one segment, yet the remaining distance is smaller than the step (by default that means smaller than 1/25mm) no point would be returned. This closes #1140
This commit is contained in:
parent
736ce6d854
commit
c463b10e43
5 changed files with 42 additions and 4 deletions
|
@ -775,3 +775,23 @@ it("Should overwrite a path attribute", () => {
|
|||
expect(a.paths.line.attributes.get("class")).to.equal("overwritten");
|
||||
});
|
||||
|
||||
it("Should move along a path even if it lands just on a joint", () => {
|
||||
let pattern = new freesewing.Pattern();
|
||||
pattern.parts.a = new pattern.Part();
|
||||
let a = pattern.parts.a;
|
||||
|
||||
a.paths.curve = new a.Path()
|
||||
.move(new a.Point(20.979322245694167, -219.8547313525503))
|
||||
._curve(
|
||||
new a.Point(35.33122482627704, -153.54225517257478),
|
||||
new a.Point(61.99376179214562, -105.99242252587702)
|
||||
)
|
||||
.curve(
|
||||
new a.Point(88.85254026593002, -58.092613773317105),
|
||||
new a.Point(136.13264764576948, -11.692646171119936),
|
||||
new a.Point(170.69593749999996, -4.180844669736632e-14)
|
||||
)
|
||||
a.points.test = a.paths.curve.shiftAlong(121.36690836797631)
|
||||
expect(a.points.test).to.be.instanceOf(a.Point)
|
||||
console.log({test: a.points.test})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue