bezierjs icon indicating copy to clipboard operation
bezierjs copied to clipboard

new Bezier(a, b, a, c, d, e, f, g).outline(h) fails

Open jacobp100 opened this issue 9 years ago • 7 comments

  1. Construct a bezier using four points where the x values of the first and second points are identical
  2. Call .outline with any number on the constructed bezier
  3. Instead of the usual array of curves being returned, an error is thrown
TypeError: p1.split is not a function

Testable example

new Bezier(102,33, 102,33, 101,129, 132,173).outline(5)

bezier.js:1 Uncaught TypeError: t.split is not a function(…)(anonymous function) @ bezier.js:1p.reduce @ bezier.js:1p.outline @ bezier.js:1(anonymous function) @ VM675:2InjectedScript._evaluateOn @ VM90:878InjectedScript._evaluateAndWrap @ VM90:811InjectedScript.evaluate @ VM90:667

jacobp100 avatar Mar 24 '16 11:03 jacobp100

What's .curve? The library in this repo does not have that function as part of its API. Did you mean .get(t)? Because I can't reproduce that behaviour with get:

b = new Bezier(1,4,1,5,2,6,3,7);
b.get(0.5) // gives { x: 1.625, y: 5.5 }

any other value for t seems to work fine too, so if you have some code that's going wrong, please show the exact code you're using in addition to the general problem description.

Pomax avatar Mar 24 '16 15:03 Pomax

closing due to inactivity, feel free to refile if this still happens, with runnable code that demonstrates this problem.

Pomax avatar Mar 31 '16 17:03 Pomax

Sorry, this is meant to be .outline, not .curve. I've added a concrete example to demonstrate the bug.

jacobp100 avatar Apr 01 '16 07:04 jacobp100

I have run into this as well. seems like straight lines being outlined are a no go

RyanElfman avatar Oct 15 '17 09:10 RyanElfman

@RyanElfman do you have some code that demonstrates the problem you ran into related to this, so it can be used to expand the tests?

Pomax avatar Oct 16 '17 16:10 Pomax

@Pomax it's the same problem as @jacobp100 has for .outline and not .curve

RyanElfman avatar Oct 29 '17 16:10 RyanElfman

var test = new Bezier(50, 50, 50, 50, 150, 50);
test.outline(); // error here

var test = new Bezier(50, 50, 60, 60, 150, 50);
test.outline(); // this works

RyanElfman avatar Nov 01 '17 01:11 RyanElfman