1
0
Fork 0
freesewing/packages/examples/src/utils_curvesintersect.js

31 lines
779 B
JavaScript
Raw Normal View History

2019-01-27 12:54:18 +01:00
export default part => {
2019-08-03 15:03:33 +02:00
let { Point, points, Path, paths, Snippet, snippets, utils } = part.shorthand()
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
points.A = new Point(10, 10)
points.Acp = new Point(310, 40)
points.B = new Point(110, 70)
points.Bcp = new Point(-210, 40)
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
points.C = new Point(20, -5)
points.Ccp = new Point(60, 300)
points.D = new Point(100, 85)
points.Dcp = new Point(70, -220)
paths.curveA = new Path().move(points.A).curve(points.Acp, points.Bcp, points.B)
paths.curveB = new Path().move(points.C).curve(points.Ccp, points.Dcp, points.D)
2019-01-27 12:54:18 +01:00
for (let p of utils.curvesIntersect(
points.A,
points.Acp,
points.Bcp,
points.B,
points.C,
points.Ccp,
points.Dcp,
points.D
2019-01-30 14:21:59 +01:00
)) {
2019-08-03 15:03:33 +02:00
snippets[part.getId()] = new Snippet('notch', p)
2019-01-30 14:21:59 +01:00
}
2019-01-27 12:54:18 +01:00
2019-08-03 15:03:33 +02:00
return part
}