0
$\begingroup$

Disclaimer: I am a programmer, not a mathematician, so some math terminology can be completely wrong. Excuse me for that. I will try to illustrate my question with pictures.

I am trying to convert a 3D Bézier curve which is used for animating an object in 3D space to separate curves that would represent the changes of its location in every channel individually (XYZ).

The points on the original curve are defined in this way:

struct M2SplineKey { Vector3 value; Vector3 inTan; Vector3 outTan; };

The distance between each point is defined by timestamps. So, the information this curve is built on is pairs of timestamp + the structure above defining this control point and its tangents.

I need to draw a classic 2D cubic Bézier curve for every channel individually (X, Y and Z)

I am having troubles understanding what value I should use for handles' X coordinate, given that the X coordinate for control points is time. If I use time there as well, the handles end up pointing upwards, which is obviously wrong.

Wrong curve

Does anybody know the formula I can use to split the curve in 3D space to 3 curves in 2D space to preserve the correct handle positions.

$\endgroup$
1
$\begingroup$

If you have 4 handles (call them A, B, C, D) with the form
struct M2SplineKey { Vector3 value; Vector3 inTan; Vector3 outTan; };

Then to plot the x-values as a function of t, you need 4 handles (Q, R, S, T) with the form
struct M2Spline2DKey { Vector2 value; Vector2 inTan; Vector2 outTan; };

and values
Q = { {0/3, A.value.x} , UNUSED , {1/3, A.outTan.x}}
R = { {3/3, B.value.x} , {2/3, B.inTan.x} , {4/3, B.outTan.x}}
S = { {6/3, C.value.x} , {5/3, C.inTan.x} , {7/3, C.outTan.x}}
T = { {9/3, D.value.x} , {8/3, D.inTan.x} , UNUSED }

Note that the points for these 2D handles are not collinear.
In 3D you have $C^1$ continuity of the curve, but each component is merely $C^0$ continuous.
The thing is that composite bezier curves are parametrized such that the velocity is not continuous.

$\endgroup$
0
$\begingroup$

We have a Bezier projection considering as constant the coordinates associated to a plane. Attached a plot showing in black the 3D curve and in red, blue, green the plane projections.

enter image description here

pts = {{0, 0, 0}, {1, 1, 1}, {2, -1, 1}, {3, 0, 2}}; ptx = {{0, 0, 0}, {0, 1, 1}, {0, -1, 1}, {0, 0, 2}}; pty = {{0, 1, 0}, {1, 1, 1}, {2, 1, 1}, {3, 1, 2}}; ptz = {{0, 0, 0}, {1, 1, 0}, {2, -1, 0}, {3, 0, 0}}; gr1 = Graphics3D[{Thick, Black, BezierCurve[pts]}]; gr2 = Graphics3D[{Thick, Dashed, Blue, BezierCurve[ptx]}]; gr3 = Graphics3D[{Thick, Dashed, Red, BezierCurve[pty]}]; gr4 = Graphics3D[{Thick, Dashed, Green, BezierCurve[ptz]}]; Show[gr1, gr2, gr3, gr4, PlotRange -> All]

$\endgroup$
  • $\begingroup$ I don't quite get what's the procedure for projecting those curves is. I am mainly wondering about that. $\endgroup$ – D. Skarn Jun 11 '18 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.