1
0
Fork 0

Docs and code cleanup

This commit is contained in:
Wouter van Wageningen 2023-04-28 18:26:55 +00:00
parent 486fde8b67
commit a5f141a586
3 changed files with 7 additions and 8 deletions

View file

@ -89,10 +89,10 @@ export const utils_beamintersectscurve = {
draft: ({ Point, points, Path, paths, Snippet, snippets, utils, part }) => { draft: ({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
points.A = new Point(10, 10) points.A = new Point(10, 10)
points.Acp = new Point(10, 40) points.Acp = new Point(10, 40)
points.B = new Point(110, 70) points.B = new Point(110, 10)
points.Bcp = new Point(110, 40) points.Bcp = new Point(110, 40)
points.E = new Point(50, 14) points.E = new Point(45, 25)
points.D = new Point(55, 16) points.D = new Point(65, 25)
paths.curve = new Path().move(points.A).curve(points.Acp, points.Bcp, points.B) paths.curve = new Path().move(points.A).curve(points.Acp, points.Bcp, points.B)
paths.line = new Path().move(points.E).line(points.D) paths.line = new Path().move(points.E).line(points.D)

View file

@ -36,10 +36,10 @@ array | false utils.beamIntersectsCurve(
points.A = new Point(10, 10) points.A = new Point(10, 10)
points.Acp = new Point(10, 40) points.Acp = new Point(10, 40)
points.B = new Point(110, 70) points.B = new Point(110, 10)
points.Bcp = new Point(110, 40) points.Bcp = new Point(110, 40)
points.E = new Point(50, 14) points.E = new Point(45, 25)
points.D = new Point(55, 16) points.D = new Point(65, 25)
paths.curve = new Path() paths.curve = new Path()
.move(points.A) .move(points.A)
.curve(points.Acp, points.Bcp, points.B) .curve(points.Acp, points.Bcp, points.B)

View file

@ -126,7 +126,6 @@ export function beamsIntersect(a1, a2, b1, b2) {
export function beamIntersectsCurve(start, end, from, cp1, cp2, to) { export function beamIntersectsCurve(start, end, from, cp1, cp2, to) {
let _start = new Point(start.x + (start.x - end.x) * 1000, start.y + (start.y - end.y) * 1000) let _start = new Point(start.x + (start.x - end.x) * 1000, start.y + (start.y - end.y) * 1000)
let _end = new Point(end.x + (end.x - start.x) * 1000, end.y + (end.y - start.y) * 1000) let _end = new Point(end.x + (end.x - start.x) * 1000, end.y + (end.y - start.y) * 1000)
console.log({ _start: _start, _end: _end })
return lineIntersectsCurve(_start, _end, from, cp1, cp2, to) return lineIntersectsCurve(_start, _end, from, cp1, cp2, to)
} }