0
\$\begingroup\$

just wondering why is that? can't get my head around it. wouldn't the use of degree 100 be better? I'm really new to this stuff.

\$\endgroup\$
1
  • \$\begingroup\$ The more math you have to do, the longer it takes. Cubic Beziers are perfectly adequate for visualization. \$\endgroup\$
    – 3Dave
    Jul 9, 2021 at 23:03

2 Answers 2

5
\$\begingroup\$

the higher the degree the more parameters you have to tweak. For example for a 100 point bezier curve there are 100 points to tweak and each point affects every part of the entire bezier curve, a piecewise curve lets you localize any tweaks you want to make.

The higher degree the more intricate the calculations, degree 100 in a polynomial equation means you need to raise a number to the 100th power. This can lead to numeric instability or those terms are meaningless anyway.

A cubic polynomial has enough flexibility to give you a curve match on transitions between adjoining curve. This is good enough that you can hide the transition between subsequent bits in.

\$\endgroup\$
0
\$\begingroup\$

You use whatever fits the job.

If you need code to do arbitrary degree in term of Bézier curves, here it is:

// https://stackoverflow.com/questions/785097/how-do-i-implement-a-bézier-curve-in-c
vector_4 getBezierPoint(vector<vector_4> points, float t)
{
    size_t i = points.size() - 1;

    while (i > 0)
    {
        for (size_t k = 0; k < i; k++)
        {
            points[k].x += t * (points[k + 1].x - points[k].x);
            points[k].y += t * (points[k + 1].y - points[k].y);
            points[k].z += t * (points[k + 1].z - points[k].z);
            points[k].w += t * (points[k + 1].w - points[k].w);
        }

        i--;
    }

    return points[0];
}
\$\endgroup\$
2
  • \$\begingroup\$ The picture seems irrelevant to the question and to the answer .. \$\endgroup\$
    – Kromster
    Jul 12, 2021 at 5:51
  • \$\begingroup\$ I’ll delete the picture. \$\endgroup\$ Jul 12, 2021 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .