Graphics, Figures & Tables ⇒ tikZ | Quadratic Bézier Curves
tikZ | Quadratic Bézier Curves
TikZ only provides support for cubic Bézier curves, which is one too much for me.
Failing that, does anyone know how to convert a cubic Bézier curve into a quadratic one?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
tikZ | Quadratic Bézier Curves
Code: Select all
Q0 = P0
Q1 = 1/3 P0 + 2/3 P1
Q2 = 2/3 P1 + 1/3 P2
Q3 = P2
Code: Select all
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,1);
\filldraw [gray] (0,0) circle (2pt)
(2,1) circle (2pt)
(3,0) circle (2pt);
\draw (0,0) .. controls (1.334,0.667) and (2.334,0.667) .. (3,0);
\end{tikzpicture}
\end{document}
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: tikZ | Quadratic Bézier Curves
a 1d explicit quadratic bezier function looks like this:
y = A*(1-x)^2 + B*2x(1-x) + C*x^2
I just did that to get a 1d bezier curve diagram for my paper. Not sure if tikZ can plot multi-dimensional functions or not where f(x,y)=0, but if so, you just have one of those explicit 1d bezier curves per axis, where A,B,C are the control points for that specific axis.
If it helps, here's how to draw a 1d quadratic bezier curve with control points 0,1,0
\draw[scale=1,domain=0:1,smooth,variable=\x,blue] plot ({\x},{2*\x-2*\x*\x});