3
$\begingroup$

given a list of points I've created a Bézier curve, and now I would like to understand how to extract a "middle point" from a curve or get a list of points (not the input ones, the interpolated ones)

Thank you all in advance!

$\endgroup$
3
  • 2
    $\begingroup$ Please can you include a simple example of what you have done using Mathematica code we can copy and work with? $\endgroup$
    – Hugh
    Jul 27 '21 at 16:41
  • 2
    $\begingroup$ You should use the BezierFunction[your_points][i], where i is parameter (in range 0-1) which is proportional to the path along your curve. $\endgroup$
    – Rom38
    Jul 27 '21 at 16:52
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Jul 27 '21 at 17:39
1
$\begingroup$

Here we provided an example which indicate that we can not use BezierFunction or BSplineFunction since it is different from BezierCurve.( Although for a single Bezier curve which only contain two control points that they are the same.)

pts = {{0, 0}, {1, -1}, {3, -1}, {3, 3}, {4, 1}, {5, 1}, {6, 0}};
a = Graphics[{BezierCurve[pts], Dotted, Line[pts], Red, Point[pts]}];
b = ParametricPlot[BezierFunction[pts[[1 ;; 4]]][t], {t, 0, 1}, 
   PlotStyle -> Yellow];
c = ParametricPlot[BezierFunction[pts[[4 ;; 7]]][t], {t, 0, 1}, 
   PlotStyle -> Green];
d = ParametricPlot[BezierFunction[pts[[1 ;; 7]]][t], {t, 0, 1}, 
   PlotStyle -> Red];
Show[a, b, c]
Show[a, b, c, d]

enter image description here

The red one is BezierFunction and the yellow+green is the BezierCurve.

  • It seems that the Arrow and Arrowheads function give the correct position at all the cases.
pts = {{0, 0}, {1, -1}, {3, -1}, {3, 3}, {4, 1}, {5, 1}, {6, 
   0}}; Table[
 Graphics[{Arrowheads[{{.1, t}}], Thick, Arrow[BezierCurve[pts]]}, 
  PlotRangePadding -> 1], {t, {0, 1/4, 1/2, 3/4, 1}}]

enter image description here

$\endgroup$

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.