## [PyX-checkins] pyx/design beziers.tex,NONE,1.1

 [PyX-checkins] pyx/design beziers.tex,NONE,1.1 From: Michael Schindler - 2005-08-30 18:31:58 Update of /cvsroot/pyx/pyx/design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19223 Added Files: beziers.tex Log Message: Documentation for some bezier curve methods in the deformer module --- NEW FILE: beziers.tex --- \documentclass{article} \usepackage{amsmath} \newcommand{\sign}{\operatorname{sign}} \begin{document} \section{Bezier curves with prescribed tangent directions and curvatures at the endpoints} Parameterization of the Bezier curve, for $x(t)$ and $y(t)$ equivalently, % \begin{align} x(t) &= x_0(1-t)^3 + 3x_1t(1-t)^2 + 3x_2t^2(1-t) + x_3 t^3\\ \dot x(t) &= 3(x_1-x_0)(1-t)^2 + 3(x_3-x_2)t^2 + 6(x_2-x_1)t(1-t) \\ \ddot x(t) &= 6(x_0 - 2x_1 + x_2)(1-t) + 6(x_1-2x_2+x_3) t \\ \dddot x(t) &= 6(x_3-x_0) + 18(x_1-x_2) \end{align} % The curvature is $$\kappa(t) = \frac{\dot x\ddot y - \ddot x\dot y}{[\dot x^2 + \dot y^2]^{3/2}}$$ % with the sign % \begin{aligned} \sign\kappa &> 0 \quad\text{for left bendings}\\ \sign\kappa &< 0 \quad\text{for right bendings.} \end{aligned} % At the endpoints we can summarize: % \begin{align} \dot x(0) &= 3(x_1 - x_0) \\ \dot x(1) &= 3(x_3 - x_2) \\ \ddot x(0) &= 6(x_0 - 2x_1 + x_2) = -4\dot x(0) - 2\dot x(1) + 6(x_3 - x_0) \\ \ddot x(1) &= 6(x_1 - 2x_2 + x_3) = +4\dot x(1) + 2\dot x(0) - 6(x_3 - x_0) \end{align} % and the same for the $y$ coordinates. The equations for the $\ddot x$ contain a convenient parameterization for this problem, with given endpoints and tangent directions. We now introduce two parameters for the distances between the first and the last pair of control points: % \begin{align} \left(\begin{array}{cc} \dot x(0) \\ \dot y(0) \end{array}\right) = \alpha \left(\begin{array}{cc} t_x(0) \\ t_y(0) \end{array}\right) \qquad \left(\begin{array}{cc} \dot x(1) \\ \dot y(1) \end{array}\right) = \beta \left(\begin{array}{cc} t_x(1) \\ t_y(1) \end{array}\right) \qquad \end{align} % Here, the externally prescribed tangent vectors are expected to be parallel to the tangent vectors of the parameterization and normalized to 1. This implies $\alpha>0$ and $\beta>0$. The problem to now to find proper parameters $\alpha>0$ and $\beta>0$ for a given set of endpoints $(x_0,y_0)$, $(x_3, y_3)$, normalized tangent vectors $\mathbf{t}(0)$, $\mathbf{t}(1)$ and of curvatures $\kappa(0), \kappa(1)$. The rest of the control points is then given by % $$x_1 = x_0 + \frac{\alpha}{3} t_x(0) \quad\text{and}\quad x_2 = x_3 - \frac{\beta}{3} t_x(1).$$ % For the curvatures at the endpoints we get a nonlinear equation, % \begin{align} \kappa(0) (\dot x^2(0) + \dot y^2(0))^{3/2} &= \dot x(0) \ddot y(0) - \ddot x(0) \dot y(0) \\ = \kappa(0) |\alpha|^3 &= \begin{aligned}[t] +\dot x(0) &\bigl[- 4\dot y(0) - 2\dot y(1) + 6(y_3-y_0)\bigr] \\ -\dot y(0) &\bigl[- 4\dot x(0) - 2\dot x(1) + 6(x_3-x_0)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \bigl[\dot x(0) \dot y(1) - \dot y(0)\dot x(1)\bigr] \\ &+6 \bigl[\dot x(0) (y_3-y_0) - \dot y(0) (x_3-x_0)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \alpha\beta \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] \\ &+6 \alpha \bigl[t_x(0) (y_3-y_0) - t_y(0) (x_3-x_0)\bigr] \end{aligned} \end{align} % And in short, % $$0 = \kappa(0) \alpha^2 \sign(\alpha) + 2\beta \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] - 6 \bigl[t_x(0) (y_3-y_0) - t_y(0) (x_3-x_0)\bigr]$$ % A similar calculation can be done for the end curvature, % \begin{align} \kappa(1) (\dot x^2(1) + \dot y^2(1))^{3/2} &= \dot x(1) \ddot y(1) - \ddot x(1) \dot y(1) \\ = \kappa(1) |\beta|^3 &= \begin{aligned}[t] \dot x(1) &\bigl[ 4\dot y(1) + 2\dot y(0) - 6(y_3-y_1)\bigr] \\ -\dot y(1) &\bigl[ 4\dot x(1) + 2\dot x(0) - 6(x_3-x_1)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \bigl[\dot x(0) \dot y(1) - \dot y(0)\dot x(1)\bigr] \\ &-6 \bigl[\dot x(1) (y_3-y_1) - \dot y(1) (x_3-x_1)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \alpha\beta \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] \\ &-6 \beta \bigl[t_x(1) (y_3-y_1) - t_y(1) (x_3-x_1)\bigr] \end{aligned}\\ \end{align} $$0 = \kappa(1) \beta^2 \sign(\beta) + 2\alpha \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] + 6 \bigl[t_x(1) (y_3-y_1) - t_y(1) (x_3-x_1)\bigr]$$ % Alltogether, we find the system of equations that is to be solved. % \begin{gather} \begin{aligned} 0 &= \frac{1}{2} \kappa(0) \alpha^2 \sign(\alpha) + \beta T - D \\ 0 &= \frac{1}{2} \kappa(1) \beta^2 \sign(\beta) + \alpha T + E \end{aligned}\\[\medskipamount] \begin{aligned} T &:= t_x(0)t_y(1) - t_y(0)t_x(1) \\ D &:= 3 \bigl[t_x(0) (y_3-y_0) - t_y(0) (x_3-x_0)\bigr]\\ E &:= 3 \bigl[t_x(1) (y_3-y_0) - t_y(1) (x_3-x_0)\bigr] \end{aligned} \end{gather} % Decoupled, we get two equations of fourth order, % \begin{align} 0 &= \frac{1}{8} \kappa(0)^2\kappa(1) \alpha^4 - \frac{1}{2}D\kappa(0)\kappa(1)\alpha^2 + T^3 \alpha + E T^2 + \frac{1}{2}\kappa(1) D^2 \\ 0 &= \frac{1}{8} \kappa(0)\kappa(1)^2\beta^4 + \frac{1}{2}E\kappa(0)\kappa(1)\beta^2 + T^3 \beta - D T^2 + \frac{1}{2}\kappa(0) E^2 \\ \end{align} % \end{document} 

 [PyX-checkins] pyx/design beziers.tex,NONE,1.1 From: Michael Schindler - 2005-08-30 18:31:58 Update of /cvsroot/pyx/pyx/design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19223 Added Files: beziers.tex Log Message: Documentation for some bezier curve methods in the deformer module --- NEW FILE: beziers.tex --- \documentclass{article} \usepackage{amsmath} \newcommand{\sign}{\operatorname{sign}} \begin{document} \section{Bezier curves with prescribed tangent directions and curvatures at the endpoints} Parameterization of the Bezier curve, for $x(t)$ and $y(t)$ equivalently, % \begin{align} x(t) &= x_0(1-t)^3 + 3x_1t(1-t)^2 + 3x_2t^2(1-t) + x_3 t^3\\ \dot x(t) &= 3(x_1-x_0)(1-t)^2 + 3(x_3-x_2)t^2 + 6(x_2-x_1)t(1-t) \\ \ddot x(t) &= 6(x_0 - 2x_1 + x_2)(1-t) + 6(x_1-2x_2+x_3) t \\ \dddot x(t) &= 6(x_3-x_0) + 18(x_1-x_2) \end{align} % The curvature is $$\kappa(t) = \frac{\dot x\ddot y - \ddot x\dot y}{[\dot x^2 + \dot y^2]^{3/2}}$$ % with the sign % \begin{aligned} \sign\kappa &> 0 \quad\text{for left bendings}\\ \sign\kappa &< 0 \quad\text{for right bendings.} \end{aligned} % At the endpoints we can summarize: % \begin{align} \dot x(0) &= 3(x_1 - x_0) \\ \dot x(1) &= 3(x_3 - x_2) \\ \ddot x(0) &= 6(x_0 - 2x_1 + x_2) = -4\dot x(0) - 2\dot x(1) + 6(x_3 - x_0) \\ \ddot x(1) &= 6(x_1 - 2x_2 + x_3) = +4\dot x(1) + 2\dot x(0) - 6(x_3 - x_0) \end{align} % and the same for the $y$ coordinates. The equations for the $\ddot x$ contain a convenient parameterization for this problem, with given endpoints and tangent directions. We now introduce two parameters for the distances between the first and the last pair of control points: % \begin{align} \left(\begin{array}{cc} \dot x(0) \\ \dot y(0) \end{array}\right) = \alpha \left(\begin{array}{cc} t_x(0) \\ t_y(0) \end{array}\right) \qquad \left(\begin{array}{cc} \dot x(1) \\ \dot y(1) \end{array}\right) = \beta \left(\begin{array}{cc} t_x(1) \\ t_y(1) \end{array}\right) \qquad \end{align} % Here, the externally prescribed tangent vectors are expected to be parallel to the tangent vectors of the parameterization and normalized to 1. This implies $\alpha>0$ and $\beta>0$. The problem to now to find proper parameters $\alpha>0$ and $\beta>0$ for a given set of endpoints $(x_0,y_0)$, $(x_3, y_3)$, normalized tangent vectors $\mathbf{t}(0)$, $\mathbf{t}(1)$ and of curvatures $\kappa(0), \kappa(1)$. The rest of the control points is then given by % $$x_1 = x_0 + \frac{\alpha}{3} t_x(0) \quad\text{and}\quad x_2 = x_3 - \frac{\beta}{3} t_x(1).$$ % For the curvatures at the endpoints we get a nonlinear equation, % \begin{align} \kappa(0) (\dot x^2(0) + \dot y^2(0))^{3/2} &= \dot x(0) \ddot y(0) - \ddot x(0) \dot y(0) \\ = \kappa(0) |\alpha|^3 &= \begin{aligned}[t] +\dot x(0) &\bigl[- 4\dot y(0) - 2\dot y(1) + 6(y_3-y_0)\bigr] \\ -\dot y(0) &\bigl[- 4\dot x(0) - 2\dot x(1) + 6(x_3-x_0)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \bigl[\dot x(0) \dot y(1) - \dot y(0)\dot x(1)\bigr] \\ &+6 \bigl[\dot x(0) (y_3-y_0) - \dot y(0) (x_3-x_0)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \alpha\beta \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] \\ &+6 \alpha \bigl[t_x(0) (y_3-y_0) - t_y(0) (x_3-x_0)\bigr] \end{aligned} \end{align} % And in short, % $$0 = \kappa(0) \alpha^2 \sign(\alpha) + 2\beta \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] - 6 \bigl[t_x(0) (y_3-y_0) - t_y(0) (x_3-x_0)\bigr]$$ % A similar calculation can be done for the end curvature, % \begin{align} \kappa(1) (\dot x^2(1) + \dot y^2(1))^{3/2} &= \dot x(1) \ddot y(1) - \ddot x(1) \dot y(1) \\ = \kappa(1) |\beta|^3 &= \begin{aligned}[t] \dot x(1) &\bigl[ 4\dot y(1) + 2\dot y(0) - 6(y_3-y_1)\bigr] \\ -\dot y(1) &\bigl[ 4\dot x(1) + 2\dot x(0) - 6(x_3-x_1)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \bigl[\dot x(0) \dot y(1) - \dot y(0)\dot x(1)\bigr] \\ &-6 \bigl[\dot x(1) (y_3-y_1) - \dot y(1) (x_3-x_1)\bigr] \end{aligned}\\ &= \begin{aligned}[t] &-2 \alpha\beta \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] \\ &-6 \beta \bigl[t_x(1) (y_3-y_1) - t_y(1) (x_3-x_1)\bigr] \end{aligned}\\ \end{align} $$0 = \kappa(1) \beta^2 \sign(\beta) + 2\alpha \bigl[t_x(0)t_y(1) - t_y(0)t_x(1)\bigr] + 6 \bigl[t_x(1) (y_3-y_1) - t_y(1) (x_3-x_1)\bigr]$$ % Alltogether, we find the system of equations that is to be solved. % \begin{gather} \begin{aligned} 0 &= \frac{1}{2} \kappa(0) \alpha^2 \sign(\alpha) + \beta T - D \\ 0 &= \frac{1}{2} \kappa(1) \beta^2 \sign(\beta) + \alpha T + E \end{aligned}\\[\medskipamount] \begin{aligned} T &:= t_x(0)t_y(1) - t_y(0)t_x(1) \\ D &:= 3 \bigl[t_x(0) (y_3-y_0) - t_y(0) (x_3-x_0)\bigr]\\ E &:= 3 \bigl[t_x(1) (y_3-y_0) - t_y(1) (x_3-x_0)\bigr] \end{aligned} \end{gather} % Decoupled, we get two equations of fourth order, % \begin{align} 0 &= \frac{1}{8} \kappa(0)^2\kappa(1) \alpha^4 - \frac{1}{2}D\kappa(0)\kappa(1)\alpha^2 + T^3 \alpha + E T^2 + \frac{1}{2}\kappa(1) D^2 \\ 0 &= \frac{1}{8} \kappa(0)\kappa(1)^2\beta^4 + \frac{1}{2}E\kappa(0)\kappa(1)\beta^2 + T^3 \beta - D T^2 + \frac{1}{2}\kappa(0) E^2 \\ \end{align} % \end{document}