Hello,
We are trying to draw a curve based on a formula that takes control points clicked on a canvas and generates a cubic B Spline curve. Our functions generate a series of points that should lie on the curve, but the vertex function will not draw the curve.
Our code can be seen here: p5.js Web Editor
When evaluating the code, focus on the the CubicBSpline_1 function as well as the Draw_BSpline_1 function, and click 3 points on the canvas to see their results.
We greatly appreciate your help!
Hi! Welcome to the forum!
Sorry but what is the question? to add curves?
Also the category Processing is for the Java platform so you should change it to p5.js
1 Like
Hello!
We are trying to generate a curve (in the draw_BSpline_1 function) using the points generated in the cubicBSpline_1 function. The print(tempPoint) command in the draw function yields the points that we would like to use to generate the curve, but the vertex command is not making the curve. We have been working on this for a while and have no idea why the curve won’t generate.
Thanks a lot for your help.
I checked the code, and I see in some lines you do something like
vertex(tempPoint_i);
but actually tempPoint
are objects. You need to decompose it to
vertex(tempPoint_i.x._data[0], tempPoint_i.y._data[0]);
1 Like
Thank you so much! That got us through the issue we’ve been stuck on for a long time. Now it presents more problems, though. I may be back here if we can’t get through it, but we’ll try our best. Thanks again!