BezierCurves

I must be blind or something. I go off and Google for Bezier Curves in jMonkeyEngine and it pulls back a BezierCurve class but it doesn’t appear to be in JME3. Just checking but is this an old class that existed in JME2 and is just not in JME3? Not complaining since the algorithm for such a curve seems fairly trivial to write. I just won’t want to waste my time reinventing the wheel. :stuck_out_tongue:

Nope, they are not in jME3 anymore as we generally cut down on the primitives in favor of custom meshes (which are always more appropriate) :wink: There is support for curve math though so creating those is easier :slight_smile:

Awesome. Thanks!

I’m working on an idea to show some data that has definite beginning and end locations and I’d like to render a curve between the 2 points on a globe. Figured a bezier would be a good route to go. So ya. I think I’ll continue down my custom bezier mesh. Thank yee. :slight_smile:

Not sure if this will help anyone else but here’s the equation that worked for me to calculate points on a bezier curve.

t = a value between 0 and 1 (think of it as time… But not really. Just trust me on this.)
pA, pB, pC, pD = Are corners of a square that define the curve. pA = Bottom Left, pB = Top Left, pC = Top Right, pD = Bottom Right

[java]
result = (Math.pow((1-t), 3) * pA)
+ (3 * Math.pow((1-t), 2) * t * pB)
+ (3 * (1-t) * Math.pow(t, 2) * pC)
+ (Math.pow(t, 3) * pD);
[/java]

If a better explanation or more flushed out code wanted ping me. But this is a pretty good start. :slight_smile: