5

Consider the following symmetric (about vertical axis) bezier curve constructed by 4 points A, B, C, and D. Now I want to construct another bezier curve (named L) for just either the left or right part of it.

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{pst-eucl}
\begin{document}

\begin{pspicture}[showgrid=false](-3,-1)(3,3)
    \pstGeonode
        (3,3){A}
        (1,1){B}
        (-1,1){C}
        (-3,3){D}
    \psbezier(A)(B)(C)(D)
    \psline[linecolor=red](0,3)(0,-1)
\end{pspicture}

\end{document}

enter image description here

Without solving a polynomial equation first, how can I construct the bezier curve L? Answers with PSTricks (preferred) or TikZ or Asymptote are welcome.

Note that I hate a trial and error method!

  • Is it specifically this curve and only the half of it or more general? – percusse Dec 29 '13 at 19:56
  • @percusse: \psbezier can only accept 4 points at most so @g.kov solution is enough. No need to expand for higher-order bezier curves consisting of more than 4 points. – kiss my armpit Dec 29 '13 at 20:04
  • PDF doesn't support higher order anyway. I meant is this specific to these curves or arbitrary curves? – percusse Dec 29 '13 at 20:09
  • @percusse: I don't understand you. The given 4 points can be changed to any numbers as long as its curve is symmetrical about vertical axis. :-) – kiss my armpit Dec 29 '13 at 20:11
  • See, we have a constraint of symmetricity? Do you have others that's what I asked. – percusse Dec 29 '13 at 20:21
5

enter image description here

Here is the Asymptote version, which does not use the general Asymptote commands to split a path (guide), it just performs a simple subdivision of the cubic Bezier segment:

// split.asy: 

size(5cm);
pair A,B,C,D;
A=(3,3); B=(1,1); C=(-1,1); D=(-3,3);

pair P,B1,C1,B2,C2;

P=(A+D+3(B+C))/8;

B1 = (A+B)/2;
C1 = ((A+C)/2+B)/2;
C2 = (D+C)/2;
B2 = ((D+B)/2+C)/2;

guide g=A..controls B and C..D;
guide gl=A..controls B1 and C1..P;
guide gr=P..controls B2 and C2..D;
draw(g);
draw(gl,deepgreen+1.6bp+opacity(0.5));
draw(gr,red+1.6bp+opacity(0.5));
draw((0,3)--(0,-1),red);

dot(A--B--C--D--P,UnFill);
dot(B1--C1,deepgreen,UnFill);
dot(B2--C2,red,UnFill);
label("$A$",A,SE);
label("$B$",B,S);
label("$C$",C,S);
label("$D$",D,SW);
label("$P$",P,NE);
label("$B_1$",B1,E,deepgreen);
label("$C_1$",C1,E,deepgreen);
label("$B_2$",B2,W,red);
label("$C_2$",C2,W,red);

To get a standalone split.pdf, run asy -f pdf split.asy.

  • I really need the converting formulae. – kiss my armpit Dec 29 '13 at 19:29
  • 1
    @Stiff Jokes: Btw, the Bezier curve is a very interesting object, you might enjoy studying it in a spare time. – g.kov Dec 29 '13 at 19:43
5

A translated version for @g.kov's Asymptote answer in PSTricks.

\documentclass[pstricks,border=24pt]{standalone}
\usepackage{pst-eucl}
\begin{document}

\begin{pspicture}[showgrid=true](-3,-1)(3,3)
    \pstGeonode
        (3,3){A}
        (1,1){B}
        (-1,1){C}
        (-3,3){D}
    \psbezier(A)(B)(C)(D)
    \psline[linecolor=red](0,3)(0,-1)
    \nodexn{.125(A)+.125(D)+.375(B)+.375(C)}{R'}
    \nodexn{.5(A)+.5(B)}{P'}
    \nodexn{.25(A)+.5(B)+.25(C)}{Q'}
    \pstGeonode
        (P'){P}
        (Q'){Q}
        (R'){R}
    \psbezier[linecolor=red](A)(P)(Q)(R)
\end{pspicture}

\end{document}

enter image description here

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.