jsBezier icon indicating copy to clipboard operation
jsBezier copied to clipboard

_convertToBezier: Uncaught TypeError: Cannot read property '0' of undefined

Open JohnHardy opened this issue 12 years ago • 2 comments

Hey,

I get this error:

Uncaught TypeError: Cannot read property '0' of undefined

when I pass in this data:

var data = [{x:892,y:55}, {x:915,y:56},{x:972,y:57},{x:1024,y:63},{x:1079,y:82},{x:1112,y:103},{x:1149,y:127},{x:1187,y:148},{x:1240,y:166},{x:1285,y:171},{x:1323,y:177},{x:1346,y:180},{x:1406,y:186},{x:1447,y:189},{x:1502,y:178},{x:1546,y:168},{x:1596,y:160},{x:1668,y:150},{x:1743,y:143},{x:1807,y:138},{x:1869,y:137},{x:1921,y:148},{x:1991,y:158},{x:2080,y:168},{x:2143,y:169},{x:2220,y:162},{x:2299,y:158},{x:2377,y:154},{x:2451,y:154},{x:2554,y:153},{x:2669,y:152},{x:2771,y:151},{x:2861,y:154},{x:2983,y:155},{x:3158,y:157},{x:3275,y:146},{x:3375,y:141},{x:3552,y:137},{x:3690,y:137},{x:3826,y:141},{x:3957,y:167},{x:4061,y:224},{x:4167,y:283},{x:4209,y:321},{x:4302,y:402},{x:4363,y:444},{x:4420,y:465},{x:4506,y:469},{x:4575,y:476},{x:4676,y:497},{x:4709,y:516},{x:4746,y:548},{x:4782,y:579},{x:4820,y:613},{x:4844,y:628},{x:4870,y:636},{x:4895,y:635} ];

From what I can tell, its's because the z array isn't large enough as it only contains 3 lists. I'm going to have a look to see if I can fix it.

Chances are I am doing something wrong... Do you have any example code I could look at?

Cheers,

John

JohnHardy avatar Sep 28 '12 02:09 JohnHardy

the only examples i have of using this are over in the jsPlumb project, but you can't call _convertToBezier directly. where are you calling it from?

sporritt avatar Sep 29 '12 00:09 sporritt

Thanks for the reply. I was calling it from nearestPointOnCurve. Should this happen if the control points are not specified correctly? I am pretty sure that the data (above) is not correct, as those are only points along a line which I wish to convert to a Bezier.

JohnHardy avatar Sep 29 '12 01:09 JohnHardy