Comments (10)
You're not logging ttList
in your console log instruction. You're logging an undefined variable tList
. I can highly recommend installing a JS linting extension, or switching your theme, to make sure that undeclared variables are "obviously" highlighted as "this code has a problem even if it'll still run".
from bezierjs.
I tried earlier, and the snippet (once the tList/ttList
typo is fixed) indeed shows an empty result list, despite that the input curves indeed do visually intersect.
from bezierjs.
thanks for the replay,ttList is alse empty.
from bezierjs.
I tried earlier, and the snippet (once the
tList/ttList
typo is fixed) indeed shows an empty result list, despite that the input curves indeed do visually intersect.
I updated the code
from bezierjs.
You're not logging
ttList
in your console log instruction. You're logging an undefined variabletList
. I can highly recommend installing a JS linting extension, or switching your theme, to make sure that undeclared variables are "obviously" highlighted as "this code has a problem even if it'll still run".
I updated the code. The variable name is wrong, but the ttList is alse empty.
from bezierjs.
console logging investigation:
console.log
running
at Bezier.intersects (src/bezier.js:848:13)
console.log
curveintersects args:
at Bezier.curveintersects (src/bezier.js:886:13)
console.log
c1 [
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: true,
_lut: [],
_t1: 0,
_t2: 0.05158051653718898,
dpoints: [ [Array], [Array], [Array] ],
clockwise: false
},
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: true,
_lut: [],
_t1: 0.05158051653718898,
_t2: 0.05455413371263488,
dpoints: [ [Array], [Array], [Array] ],
clockwise: false
}
]
at Bezier.curveintersects (src/bezier.js:887:13)
console.log
c2 [
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: false,
_lut: [],
_t1: 0,
_t2: 0.09,
dpoints: [ [Array], [Array], [Array] ],
clockwise: false
},
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: false,
_lut: [],
_t1: 0.09,
_t2: 1,
dpoints: [ [Array], [Array], [Array] ],
clockwise: false
}
]
at Bezier.curveintersects (src/bezier.js:888:13)
console.log
initial pairs []
at Bezier.curveintersects (src/bezier.js:898:13)
console.log
intersections []
at Bezier.curveintersects (src/bezier.js:913:13)
● Intersection testing › https://github.com/Pomax/bezierjs/issues/203
from bezierjs.
Looks like the this.reduce()
call in intersects
yields a curve set that does not span the full [0,1] interval.
from bezierjs.
console.log
running
at Bezier.intersects (src/bezier.js:859:13)
console.log
first pass reductions: [
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: true,
_lut: [],
_t1: 0,
_t2: 0.05158051653718898,
dpoints: [ [Array], [Array], [Array] ],
clockwise: false
},
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: true,
_lut: [],
_t1: 0.05158051653718898,
_t2: 0.05455413371263488,
dpoints: [ [Array], [Array], [Array] ],
clockwise: false
},
Bezier {
_3d: false,
points: [ [Object], [Object], [Object], [Object] ],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: false,
_lut: [],
_t1: 0.05455413371263488,
_t2: 1,
dpoints: [ [Array], [Array], [Array] ],
clockwise: true
}
]
at Bezier.reduce (src/bezier.js:601:13)
console.log
second pass on: Bezier {
_3d: false,
points: [
{ x: 20.29469871520996, y: 20.116849899291992 },
{ x: 20.62604239936939, y: 20.550107722706766 },
{ x: 20.95792601544804, y: 20.98468086613082 },
{ x: 21.289809631526694, y: 21.419325704546704 }
],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: true,
_lut: [],
_t1: 0,
_t2: 0.05158051653718898,
dpoints: [
[ [Object], [Object], [Object] ],
[ [Object], [Object] ],
[ [Object] ]
],
clockwise: false
}
at forEach (src/bezier.js:605:15)
at Array.forEach (<anonymous>)
console.log
t1: 0, t2: 1.0100000000000007
at forEach (src/bezier.js:629:15)
at Array.forEach (<anonymous>)
console.log
second pass on: Bezier {
_3d: false,
points: [
{ x: 21.289809631526694, y: 21.419325704546704 },
{ x: 21.308942724548533, y: 21.44438298282736 },
{ x: 21.328075817570372, y: 21.469440499388 },
{ x: 21.347208807140635, y: 21.49449801594864 }
],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: true,
_lut: [],
_t1: 0.05158051653718898,
_t2: 0.05455413371263488,
dpoints: [
[ [Object], [Object], [Object] ],
[ [Object], [Object] ],
[ [Object] ]
],
clockwise: false
}
at forEach (src/bezier.js:605:15)
at Array.forEach (<anonymous>)
console.log
t1: 0, t2: 1.0100000000000007
at forEach (src/bezier.js:629:15)
at Array.forEach (<anonymous>)
console.log
second pass on: Bezier {
_3d: false,
points: [
{ x: 21.347208807140635, y: 21.494498015948643 },
{ x: 27.430441729082755, y: 29.46140298519073 },
{ x: 33.50321685100052, y: 37.42830795443282 },
{ x: 36.24053192138672, y: 37.73673629760742 }
],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: false,
_lut: [],
_t1: 0.05455413371263488,
_t2: 1,
dpoints: [
[ [Object], [Object], [Object] ],
[ [Object], [Object] ],
[ [Object] ]
],
clockwise: true
}
at forEach (src/bezier.js:605:15)
at Array.forEach (<anonymous>)
from bezierjs.
console.log
second pass on: Bezier {
_3d: false,
points: [
{ x: 21.347208807140635, y: 21.494498015948643 },
{ x: 27.430441729082755, y: 29.46140298519073 },
{ x: 33.50321685100052, y: 37.42830795443282 },
{ x: 36.24053192138672, y: 37.73673629760742 }
],
order: 3,
dims: [ 'x', 'y' ],
dimlen: 2,
_linear: false,
_lut: [],
_t1: 0.05455413371263488,
_t2: 1,
dpoints: [
[ [Object], [Object], [Object] ],
[ [Object], [Object] ],
[ [Object] ]
],
clockwise: true
}
at forEach (src/bezier.js:605:15)
at Array.forEach (<anonymous>)
console.log
dead segment for t1:0 and t2:0
Looks like the second pass in the reduction function needs some proper debugging.
from bezierjs.
@Pomax I think I'm seeing the same problem. intersect
will correctly detect the intersection most of the time, but occasionally returns an empty array. The most minute change in one of the curves can result in no intersections, and happens for cases where the intersection is obvious between two curves that simply cross (i.e. intersections aren't end points, and curves don't cross multiple times). I can provide an interactive page that will allow to easily replicate the issue if that would be helpful.
from bezierjs.
Related Issues (20)
- Release v6.1.2 broken HOT 3
- Why get(t = 0.5) point is not the middle point of the curve? HOT 5
- Find optmal D1 - Bezier.cubicFromPoints HOT 1
- PolyBezier is not exported correct for ES Module. HOT 3
- Rational Bezier Curve Support HOT 1
- Example usage of `dist/bezier.js` HOT 4
- How to make a "strict" version of bezier.project(point)? HOT 2
- Should bezier.lineIntersects(line) work for line-line intersections? HOT 3
- intersects bug Bezier to Bezier HOT 3
- Suspicious line in `utils.compute()` HOT 2
- The intersection of two identical curves HOT 2
- Intersect line method does not always return existing intersections HOT 6
- Ability to get and estimate the centerline of a list of 3D points HOT 3
- PR for extending API to interpolate values along curve and find point on curve at distance?
- Artifact when offsetting an SVG path
- Split curves do not follow old curve. HOT 2
- Missing LICENSE file HOT 1
- How to Find Y-Coordinate for a Given X-Coordinate on a Bezier Curve HOT 3
- Q: PolyBezier surface calculation HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bezierjs.