Jump to content

Starting point of curve3 when using continue


Recommended Posts

Having created three Bezier curves


Attempt 1

var curve_0 = BABYLON.Curve3.CreateCubicBezier(start_0, control1_0, control2,_0 destination_0, nb_of_points);var curve_1 = BABYLON.Curve3.CreateCubicBezier(start_1, control1_1, control2,_1 destination_1, nb_of_points);var curve_2 = BABYLON.Curve3.CreateCubicBezier(start_2, control1_2, control2,_2 destination_2, nb_of_points);

I then formed a new curve by joining them together using.

var myFullCurve = curve_0.continue(curve_1).continue(curve_2);

However as start_1 and start_2 where not the origin (0,0,0) myFullCurve had kinks in it.


By ensuring that curve_1 and curve_2 started at (0,0,0) using


Attempt 2

var curve_0 = BABYLON.Curve3.CreateCubicBezier(start_0, control1_0, control2,_0 destination_0, nb_of_points);var curve_1 = BABYLON.Curve3.CreateCubicBezier(start_1.subtract(start_1), control1_1.subtract(start_1), control2_1.subtract(start_1), destination_1.subtract(start_1), nb_of_points);var curve_2 = BABYLON.Curve3.CreateCubicBezier(start_2.subtract(start_2), control1_2.subtract(start_2), control2_2.subtract(start_2), destination_2.subtract(start_2), nb_of_points);

I obtained a continuous curve.


I read in this topic  that there was a suggestion by Jerome to


.... imagine you've got many curves with different origins and you want to "stick" them together one after the other without knowing/handling each curve origin and end.



and gathered from the date (16 Mar 2015) curve3 and continue are recent additions.


Now using subtract.start to create the curve does not require you to know start but you do have to handle it.


Have I misunderstood something or applied continue incorrectly or was it the intention that something like Attempt 1 should have formed a continuous curve and does not as yet do so?



Link to comment
Share on other sites

You are right : I just focused on the last hypothetical unknown point position and my PG were all with curves starting at (0, 0, 0).

The continue() method should work the same way with any curve starting point.. and it doesn't.  :mellow:


I will do a quick fix so the continue() method will work the way you expect, which is the expected way according to what I wrote in the doc.


Your workaround is, well, just what I forgot to implement : an initial subtract down to the origin.  ;)

Link to comment
Share on other sites

Since I can't compile for now, could someone please change this line : https://github.com/BabylonJS/Babylon.js/blob/master/Babylon/Math/babylon.math.ts#L3431 in the math.ts file to this line instead :


then compile and, if ok, push it into the BJS repo.

It should fix the Curve3 continue() method so it will work as expected whatever the starting points in space of the concatened curves.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...